"use client"; import { Camera, Check } from "lucide-react"; import { ResourceSelectField, ToggleRow, } from "@/components/assistant-editor/editor-controls"; import { SectionCard } from "@/components/editor/section-card"; import { Textarea } from "@/components/ui/textarea"; import type { VisionPromptMode } from "@/lib/api"; type VisionModelOption = { value: string; label: string; }; const promptModes: Array<{ value: VisionPromptMode; title: string; description: string; }> = [ { value: "fixed", title: "固定提示词", description: "每次获取画面都发送同一个问题。", }, { value: "runtime", title: "运行时自动生成", description: "模型结合当前对话,临时生成看图问题。", }, { value: "guided", title: "固定提示词引导", description: "模型动态生成问题,同时遵守固定引导。", }, ]; export function VisionConfigSection({ description, hint, enabled, modelResourceId, promptMode, prompt, mainModelResourceId, mainModelSupportsImageInput, modelOptions, onEnabledChange, onModelResourceIdChange, onPromptModeChange, onPromptChange, }: { description: string; hint: string; enabled: boolean; modelResourceId: string; promptMode: VisionPromptMode; prompt: string; mainModelResourceId: string; mainModelSupportsImageInput?: boolean; modelOptions: VisionModelOption[]; onEnabledChange: (enabled: boolean) => void; onModelResourceIdChange: (modelResourceId: string) => void; onPromptModeChange: (promptMode: VisionPromptMode) => void; onPromptChange: (prompt: string) => void; }) { const mainModelSupportsVision = mainModelSupportsImageInput ?? modelOptions.some((option) => option.value === mainModelResourceId); const independentModelOptions = modelOptions.filter( (option) => option.value !== mainModelResourceId, ); return ( } title="视觉理解" description={description} > {enabled && ( <> {!modelResourceId && !mainModelSupportsVision && (

当前模型未标记支持图片输入,请选择独立视觉模型。

)}
{promptModes.map((option) => { const selected = promptMode === option.value; return ( ); })}
{promptMode !== "runtime" && (