diff --git a/frontend/src/components/assistant-editor/dynamic-variables.tsx b/frontend/src/components/assistant-editor/dynamic-variables.tsx index a8a303d..3800397 100644 --- a/frontend/src/components/assistant-editor/dynamic-variables.tsx +++ b/frontend/src/components/assistant-editor/dynamic-variables.tsx @@ -1,16 +1,9 @@ "use client"; -import { Braces, Check, Copy } from "lucide-react"; +import { Check, Copy } from "lucide-react"; import { useState } from "react"; import { Badge } from "@/components/ui/badge"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Select, @@ -141,40 +134,6 @@ export function DynamicVariableEditorHint({ ); } -export function DynamicVariablesDialog({ - open, - onOpenChange, - definitions, - onChange, -}: { - open: boolean; - onOpenChange: (open: boolean) => void; - definitions: Record; - onChange: (definitions: Record) => void; -}) { - return ( - - - - - - 动态变量 - - - 助手配置中引用的自定义变量会自动出现在这里。 - - - - - - - ); -} - export function DynamicVariablesPanel({ definitions, onChange, @@ -196,6 +155,27 @@ export function DynamicVariablesPanel({ ); } +export function DynamicVariablesSection({ + definitions, + onChange, +}: { + definitions: Record; + onChange: (definitions: Record) => void; +}) { + return ( +
+

+ 助手配置中引用的自定义变量会自动出现在这里。 +

+ +
+ ); +} + function DynamicVariablesEditor({ definitions, onChange, @@ -203,7 +183,7 @@ function DynamicVariablesEditor({ }: { definitions: Record; onChange: (definitions: Record) => void; - layout: "dialog" | "panel"; + layout: "panel" | "section"; }) { const entries = Object.entries(definitions); const [copiedSystemVariable, setCopiedSystemVariable] = useState( @@ -226,7 +206,7 @@ function DynamicVariablesEditor({ className={ layout === "panel" ? "flex min-h-0 flex-1 flex-col" - : "min-h-0 px-6 pb-6" + : "min-h-0 flex-none" } > @@ -249,7 +229,7 @@ function DynamicVariablesEditor({ className={ layout === "panel" ? "scrollbar-subtle min-h-0 flex-1 overflow-y-auto pt-3" - : "max-h-[calc(78vh-168px)] overflow-y-auto pt-3" + : "flex-none pt-3" } > {entries.length === 0 ? ( @@ -371,7 +351,7 @@ function DynamicVariablesEditor({ className={ layout === "panel" ? "scrollbar-subtle min-h-0 flex-1 space-y-3 overflow-y-auto pt-3" - : "max-h-[calc(78vh-168px)] space-y-3 overflow-y-auto pt-3" + : "flex-none space-y-3 pt-3" } >

diff --git a/frontend/src/components/assistant-editor/prompt-editor.tsx b/frontend/src/components/assistant-editor/prompt-editor.tsx index f93f9b3..8806978 100644 --- a/frontend/src/components/assistant-editor/prompt-editor.tsx +++ b/frontend/src/components/assistant-editor/prompt-editor.tsx @@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from "react"; import { + Braces, Bot, Brain, Database, @@ -15,7 +16,7 @@ import { import { DebugDrawer } from "@/components/assistant-editor/debug-preview"; import { DynamicVariableEditorHint, - DynamicVariablesDialog, + DynamicVariablesSection, } from "@/components/assistant-editor/dynamic-variables"; import { AssistantIdentity, @@ -43,6 +44,7 @@ const promptSections = [ { id: "models", label: "模型与语音" }, { id: "capabilities", label: "知识与工具" }, { id: "interaction", label: "交互策略" }, + { id: "variables", label: "动态变量" }, ] as const; type PromptSectionId = (typeof promptSections)[number]["id"]; @@ -50,7 +52,6 @@ type PromptSectionId = (typeof promptSections)[number]["id"]; type PromptEditorProps = { assistantId: string | null; form: AssistantForm; - dynamicVariablesOpen: boolean; dynamicVariableDefinitions: Record; saving: boolean; dirty: boolean; @@ -64,7 +65,6 @@ type PromptEditorProps = { tools: Tool[]; onBack: () => void; onSave: () => void; - setDynamicVariablesOpen: (open: boolean) => void; updateForm: ( key: K, value: AssistantForm[K], @@ -76,7 +76,6 @@ type PromptEditorProps = { export function PromptEditor({ assistantId, form, - dynamicVariablesOpen, dynamicVariableDefinitions, saving, dirty, @@ -90,7 +89,6 @@ export function PromptEditor({ tools, onBack, onSave, - setDynamicVariablesOpen, updateForm, handlePromptVisionEnabledChange, handlePromptModelChange, @@ -102,6 +100,7 @@ export function PromptEditor({ models: null, capabilities: null, interaction: null, + variables: null, }); const selectedAnchorRef = useRef(null); const [activeSection, setActiveSection] = @@ -217,7 +216,7 @@ export function PromptEditor({ } return ( -

+
@@ -249,25 +248,13 @@ export function PromptEditor({
- - updateForm( - "dynamicVariableDefinitions", - dynamicVariableDefinitions, - ) - } - /> -