feat: add prompt startup actions and shared vision config
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Camera,
|
||||
Bot,
|
||||
Brain,
|
||||
Database,
|
||||
@@ -12,12 +11,9 @@ import {
|
||||
Wrench,
|
||||
} from "lucide-react";
|
||||
|
||||
import {
|
||||
ResourceSelectField,
|
||||
ToggleRow,
|
||||
} from "@/components/assistant-editor/editor-controls";
|
||||
import { KnowledgeRetrievalConfigDialog } from "@/components/editor/knowledge-retrieval-config-dialog";
|
||||
import { SectionCard } from "@/components/editor/section-card";
|
||||
import { VisionConfigSection } from "@/components/editor/vision-config-section";
|
||||
import { TurnConfigEditor } from "@/components/turn-config-editor";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
@@ -235,48 +231,23 @@ export function AgentNodePanel({
|
||||
/>
|
||||
</SectionCard>
|
||||
|
||||
<SectionCard
|
||||
icon={<Camera size={15} />}
|
||||
title="视觉理解"
|
||||
<VisionConfigSection
|
||||
description="配置当前 Agent 是否可以按需理解用户摄像头画面"
|
||||
>
|
||||
<ToggleRow
|
||||
title="允许理解当前画面"
|
||||
hint="开启后,该 Agent 会获得读取当前视频画面的工具。选择「模型自己」时,当前大语言模型必须支持图片输入。"
|
||||
checked={Boolean(draft.visionEnabled)}
|
||||
onChange={(visionEnabled) =>
|
||||
setPatch({
|
||||
visionEnabled,
|
||||
...(!visionEnabled
|
||||
? { visionModelResourceId: "" }
|
||||
: {}),
|
||||
})
|
||||
}
|
||||
/>
|
||||
{draft.visionEnabled && (
|
||||
<>
|
||||
<ResourceSelectField
|
||||
label="视觉模型"
|
||||
value={draft.visionModelResourceId ?? ""}
|
||||
onChange={(visionModelResourceId) =>
|
||||
set("visionModelResourceId", visionModelResourceId)
|
||||
}
|
||||
options={visionOptions.filter(
|
||||
(option) => option.value !== draft.llmResourceId,
|
||||
)}
|
||||
noneLabel="模型自己"
|
||||
/>
|
||||
{!draft.visionModelResourceId &&
|
||||
!visionOptions.some(
|
||||
(option) => option.value === draft.llmResourceId,
|
||||
) && (
|
||||
<p className="text-xs text-destructive">
|
||||
当前大语言模型未标记支持图片输入,请选择独立视觉模型。
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</SectionCard>
|
||||
hint="开启后,该 Agent 会获得读取当前视频画面的工具。选择「模型自己」时,当前大语言模型必须支持图片输入。"
|
||||
enabled={Boolean(draft.visionEnabled)}
|
||||
modelResourceId={draft.visionModelResourceId ?? ""}
|
||||
mainModelResourceId={(draft.llmResourceId as string) || ""}
|
||||
modelOptions={visionOptions}
|
||||
onEnabledChange={(visionEnabled) =>
|
||||
setPatch({
|
||||
visionEnabled,
|
||||
...(!visionEnabled ? { visionModelResourceId: "" } : {}),
|
||||
})
|
||||
}
|
||||
onModelResourceIdChange={(visionModelResourceId) =>
|
||||
set("visionModelResourceId", visionModelResourceId)
|
||||
}
|
||||
/>
|
||||
|
||||
<SectionCard
|
||||
icon={<Database size={15} />}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
AudioLines,
|
||||
Brain,
|
||||
Database,
|
||||
MessageSquareText,
|
||||
@@ -9,12 +8,9 @@ import {
|
||||
Wrench,
|
||||
} from "lucide-react";
|
||||
|
||||
import {
|
||||
ResourceSelectField,
|
||||
ToggleRow,
|
||||
} from "@/components/assistant-editor/editor-controls";
|
||||
import { KnowledgeRetrievalConfigDialog } from "@/components/editor/knowledge-retrieval-config-dialog";
|
||||
import { SectionCard } from "@/components/editor/section-card";
|
||||
import { VisionConfigSection } from "@/components/editor/vision-config-section";
|
||||
import { TurnConfigEditor } from "@/components/turn-config-editor";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
|
||||
@@ -60,8 +56,8 @@ export function GlobalSettingsPanel({
|
||||
|
||||
<SectionCard
|
||||
icon={<Brain size={15} />}
|
||||
title="模型配置"
|
||||
description="工作流中所有 Agent 共用的大语言模型"
|
||||
title="模型与语音"
|
||||
description="继承全局配置的 Agent 共用的推理、语音识别和语音合成资源"
|
||||
>
|
||||
<ModelSelect
|
||||
label="大语言模型"
|
||||
@@ -77,62 +73,39 @@ export function GlobalSettingsPanel({
|
||||
})
|
||||
}
|
||||
/>
|
||||
<ToggleRow
|
||||
title="视觉理解"
|
||||
hint="开启后,继承全局配置的 Agent 可以按需理解当前视频画面。选择「模型自己」时,全局大语言模型必须支持图片输入。"
|
||||
checked={settings.visionEnabled}
|
||||
onChange={(visionEnabled) =>
|
||||
onSettingsChange({
|
||||
...settings,
|
||||
visionEnabled,
|
||||
...(!visionEnabled ? { visionModelResourceId: "" } : {}),
|
||||
})
|
||||
}
|
||||
/>
|
||||
{settings.visionEnabled && (
|
||||
<>
|
||||
<ResourceSelectField
|
||||
label="视觉模型"
|
||||
value={settings.visionModelResourceId}
|
||||
onChange={(visionModelResourceId) =>
|
||||
onSettingsChange({ ...settings, visionModelResourceId })
|
||||
}
|
||||
options={modelOptions.vision.filter(
|
||||
(option) => option.value !== settings.llm,
|
||||
)}
|
||||
noneLabel="模型自己"
|
||||
/>
|
||||
{!settings.visionModelResourceId &&
|
||||
!modelOptions.vision.some(
|
||||
(option) => option.value === settings.llm,
|
||||
) && (
|
||||
<p className="text-xs text-destructive">
|
||||
当前大语言模型未标记支持图片输入,请选择独立视觉模型。
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</SectionCard>
|
||||
|
||||
<SectionCard
|
||||
icon={<AudioLines size={15} />}
|
||||
title="语音配置"
|
||||
description="Agent 节点未单独选择资源时继承这里的默认值"
|
||||
>
|
||||
<ModelSelect
|
||||
label="语音识别"
|
||||
value={settings.asr}
|
||||
options={modelOptions.asr}
|
||||
onChange={(v) => onSettingsChange({ ...settings, asr: v })}
|
||||
onChange={(asr) => onSettingsChange({ ...settings, asr })}
|
||||
/>
|
||||
<ModelSelect
|
||||
label="语音合成"
|
||||
value={settings.tts}
|
||||
options={modelOptions.tts}
|
||||
onChange={(v) => onSettingsChange({ ...settings, tts: v })}
|
||||
onChange={(tts) => onSettingsChange({ ...settings, tts })}
|
||||
/>
|
||||
</SectionCard>
|
||||
|
||||
<VisionConfigSection
|
||||
description="配置继承全局设置的 Agent 是否可以按需理解用户摄像头画面"
|
||||
hint="开启后,继承全局配置的 Agent 会获得读取当前视频画面的工具。选择「模型自己」时,全局大语言模型必须支持图片输入。"
|
||||
enabled={settings.visionEnabled}
|
||||
modelResourceId={settings.visionModelResourceId}
|
||||
mainModelResourceId={settings.llm ?? ""}
|
||||
modelOptions={modelOptions.vision}
|
||||
onEnabledChange={(visionEnabled) =>
|
||||
onSettingsChange({
|
||||
...settings,
|
||||
visionEnabled,
|
||||
...(!visionEnabled ? { visionModelResourceId: "" } : {}),
|
||||
})
|
||||
}
|
||||
onModelResourceIdChange={(visionModelResourceId) =>
|
||||
onSettingsChange({ ...settings, visionModelResourceId })
|
||||
}
|
||||
/>
|
||||
|
||||
<SectionCard
|
||||
icon={<Database size={15} />}
|
||||
title="知识库配置"
|
||||
|
||||
Reference in New Issue
Block a user