From 7c18cea16d1c03152b6c12491674c4b4d67bd146 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Wed, 12 Aug 2026 21:38:42 +0800 Subject: [PATCH] refactor: use dropdown for vision prompt mode --- .../editor/vision-config-section.tsx | 88 ++++++++----------- .../src/components/workflow/graph-settings.ts | 8 +- .../workflow/panels/GlobalSettingsPanel.tsx | 4 +- 3 files changed, 41 insertions(+), 59 deletions(-) diff --git a/frontend/src/components/editor/vision-config-section.tsx b/frontend/src/components/editor/vision-config-section.tsx index 1aa60c5..b97a5c8 100644 --- a/frontend/src/components/editor/vision-config-section.tsx +++ b/frontend/src/components/editor/vision-config-section.tsx @@ -1,6 +1,6 @@ "use client"; -import { Camera, Check } from "lucide-react"; +import { Camera } from "lucide-react"; import { ResourceSelectField, @@ -20,16 +20,16 @@ const promptModes: Array<{ title: string; description: string; }> = [ + { + value: "runtime", + title: "运行时自动生成(默认)", + description: "模型结合当前对话,临时生成看图问题。", + }, { value: "fixed", title: "固定提示词", description: "每次获取画面都发送同一个问题。", }, - { - value: "runtime", - title: "运行时自动生成", - description: "模型结合当前对话,临时生成看图问题。", - }, { value: "guided", title: "固定提示词引导", @@ -72,6 +72,10 @@ export function VisionConfigSection({ const independentModelOptions = modelOptions.filter( (option) => option.value !== mainModelResourceId, ); + const effectivePromptMode = promptMode || "runtime"; + const selectedPromptMode = + promptModes.find((option) => option.value === effectivePromptMode) ?? + promptModes[0]; return ( )} -
- -
- {promptModes.map((option) => { - const selected = promptMode === option.value; - return ( - - ); - })} -
+
+ ({ + value: option.value, + label: option.title, + }))} + onChange={(value) => + onPromptModeChange( + value === "fixed" || value === "guided" + ? value + : "runtime", + ) + } + /> +

+ {selectedPromptMode.description} +

- {promptMode !== "runtime" && ( + {effectivePromptMode !== "runtime" && (