|
|
@@ -1,8 +1,7 @@
|
|
|
import { useCallback, useState } from "react"
|
|
|
-import { Loader2, MessageSquare, Sparkles } from "lucide-react"
|
|
|
+import { Loader2, MessageSquare } from "lucide-react"
|
|
|
import { useTranslation } from "react-i18next"
|
|
|
import { Button } from "@/components/ui/button"
|
|
|
-import { OutlineGeneratorDialog, type OutlineGeneratorMode } from "@/components/sources/outline-generator-dialog"
|
|
|
import { runBulkOutlineIngest, formatBulkOutlineIngestResult, OutlineIngestNotReadyError } from "@/lib/novel/outline-generation"
|
|
|
import { cn } from "@/lib/utils"
|
|
|
import { toast } from "@/lib/toast"
|
|
|
@@ -25,8 +24,6 @@ export function OutlineActionToolbar({
|
|
|
const project = useWikiStore((s) => s.project)
|
|
|
const setActiveView = useWikiStore((s) => s.setActiveView)
|
|
|
const setOutlineChatOpen = useOutlineGenerationStore((s) => s.setPanelOpen)
|
|
|
- const [outlineDialogOpen, setOutlineDialogOpen] = useState(false)
|
|
|
- const [outlineDialogMode, setOutlineDialogMode] = useState<OutlineGeneratorMode>("outline")
|
|
|
const [bulkIngestRunning, setBulkIngestRunning] = useState(false)
|
|
|
|
|
|
const bulkOutlineProgressRunning = useImportProgressStore((s) => (
|
|
|
@@ -39,11 +36,6 @@ export function OutlineActionToolbar({
|
|
|
|
|
|
const bulkIngestActive = bulkIngestRunning || bulkOutlineProgressRunning
|
|
|
|
|
|
- function openOutlineDialog(mode: OutlineGeneratorMode) {
|
|
|
- setOutlineDialogMode(mode)
|
|
|
- setOutlineDialogOpen(true)
|
|
|
- }
|
|
|
-
|
|
|
const handleOpenOutlineChat = useCallback(() => {
|
|
|
if (onToggleOutlineChat) {
|
|
|
onToggleOutlineChat()
|
|
|
@@ -74,36 +66,21 @@ export function OutlineActionToolbar({
|
|
|
}, [bulkIngestActive, onBulkIngestResult, project, t])
|
|
|
|
|
|
return (
|
|
|
- <>
|
|
|
- <div className={cn("flex flex-wrap gap-1", className)}>
|
|
|
- <Button size="sm" onClick={() => openOutlineDialog("outline")}>
|
|
|
- <Sparkles className="mr-1 h-4 w-4" />
|
|
|
- {t("novel.outlineGenerator.title")}
|
|
|
- </Button>
|
|
|
- <Button size="sm" variant="outline" onClick={handleOpenOutlineChat}>
|
|
|
- <MessageSquare className="mr-1 h-4 w-4" />
|
|
|
- AI大纲
|
|
|
- </Button>
|
|
|
- <Button size="sm" variant="outline" onClick={() => openOutlineDialog("refine")}>
|
|
|
- {t("novel.outlineGenerator.refineTitle")}
|
|
|
- </Button>
|
|
|
- <Button size="sm" variant="outline" onClick={() => void handleBulkIngest()} disabled={bulkIngestActive}>
|
|
|
- {bulkIngestActive ? (
|
|
|
- <>
|
|
|
- <Loader2 className="mr-1 h-4 w-4 animate-spin" />
|
|
|
- {t("novel.outlineGenerator.bulkIngesting")}
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- t("novel.outlineGenerator.bulkIngest")
|
|
|
- )}
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <OutlineGeneratorDialog
|
|
|
- open={outlineDialogOpen}
|
|
|
- onOpenChange={setOutlineDialogOpen}
|
|
|
- mode={outlineDialogMode}
|
|
|
- />
|
|
|
- </>
|
|
|
+ <div className={cn("flex flex-wrap gap-1", className)}>
|
|
|
+ <Button size="sm" variant="outline" onClick={handleOpenOutlineChat}>
|
|
|
+ <MessageSquare className="mr-1 h-4 w-4" />
|
|
|
+ AI大纲
|
|
|
+ </Button>
|
|
|
+ <Button size="sm" variant="outline" onClick={() => void handleBulkIngest()} disabled={bulkIngestActive}>
|
|
|
+ {bulkIngestActive ? (
|
|
|
+ <>
|
|
|
+ <Loader2 className="mr-1 h-4 w-4 animate-spin" />
|
|
|
+ {t("novel.outlineGenerator.bulkIngesting")}
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ t("novel.outlineGenerator.bulkIngest")
|
|
|
+ )}
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
)
|
|
|
}
|