"use client"; import { useEffect, useId, useRef, useState } from "react"; import { ChevronDown, HelpCircle, PenLine, RefreshCw, Sparkles, Square, Wand2, WrapText, } from "lucide-react"; import { Button } from "@/components/ui/Button"; import { Eyebrow } from "@/components/ui/Eyebrow"; import { SectionHeader } from "@/components/ui/SectionHeader"; import { StatusNote } from "@/components/ui/StatusNote"; import { TextArea } from "@/components/ui/TextArea"; import { PLOT_PRESETS, STYLE_PRESETS, type Preset } from "@/lib/workbench/directive"; import { buttonClass, focusRing } from "@/lib/ui/variants"; interface DirectivePanelProps { directive: string; onDirectiveChange: (value: string) => void; presetIds: readonly string[]; onTogglePreset: (id: string) => void; // 空章默认展开(新手最需要看到输入框的时机);满章默认收起以让出编辑视野。 defaultOpen: boolean; // 发送键 = 写本章:把已选文风/剧情 + 自定义要求组装后逐字流式写进正文(不改成聊天气泡)。 streaming: boolean; onWrite: () => void; onStop: () => void; } // 本章写作指令面板(P0-2 / P3-3 提升):正文正上方常驻的「和 AI 说话」输入条。 // 眉题「和 AI 说话」+ 主标题「告诉 AI 这章想怎么写」+ HITL 微文案 +「?这是什么」常驻可见; // 主 CTA「写本章」突出(md 尺寸、独占右侧),空章默认展开露出输入框。 // 发送键即「写本章」,沿用 composeDirective + 文风/剧情 chips + 流式打字机写进正文。 export function DirectivePanel({ directive, onDirectiveChange, presetIds, onTogglePreset, defaultOpen, streaming, onWrite, onStop, }: DirectivePanelProps) { const panelId = useId(); const [open, setOpen] = useState(defaultOpen); const activeCount = presetIds.length + (directive.trim().length > 0 ? 1 : 0); return (
和 AI 说话
{activeCount > 0 ? ( {activeCount} 项指令 ) : null} {/* 常驻主 CTA = 写本章:始终可见(折叠时也在),md 尺寸凸显为本条主动作,逐字流式写进正文。 */} {streaming ? ( ) : ( )}

AI 给草稿,你决定采不采用,原文永远你说了算。

{open ? (