feat: add realtime workflow vision tools

This commit is contained in:
Xin Wang
2026-08-05 13:35:00 +08:00
parent 11374238f3
commit 10bea48d72
16 changed files with 362 additions and 103 deletions
@@ -411,7 +411,11 @@ export function AssistantPage(props: AssistantPageProps) {
const credOptions = (type: ModelResource["capability"]) =>
modelResources
.filter((c) => c.capability === type)
.map((c) => ({ value: c.id, label: c.name }));
.map((c) => ({
value: c.id,
label: c.name,
supportImageInput: c.supportImageInput,
}));
const agentOptions = (interfaceType: "dify" | "fastgpt" | "opencode") =>
modelResources
.filter(
@@ -66,6 +66,20 @@ const capabilities: ModelType[] = [
];
const capabilityFilters = ["全部", ...capabilities] as const;
const nativeImageUnsupportedRealtimeInterfaces = new Set([
"qwen-audio-realtime",
]);
function canConfigureImageInput(
capability: ModelType,
interfaceType: string,
): boolean {
return (
capability === "LLM" ||
(capability === "Realtime" &&
!nativeImageUnsupportedRealtimeInterfaces.has(interfaceType))
);
}
type ResourceDraft = {
name: string;
@@ -294,6 +308,12 @@ export function ComponentsModelsPage() {
interfaceType,
values: definition ? defaults(definition) : {},
secrets: {},
supportImageInput: canConfigureImageInput(
previous.capability,
interfaceType,
)
? previous.supportImageInput
: false,
}));
setStoredSecretMasks({});
setExtraBodyDraft("");
@@ -310,8 +330,7 @@ export function ComponentsModelsPage() {
interfaceType: first?.interfaceType ?? "",
values: first ? defaults(first) : {},
secrets: {},
supportImageInput:
capability === "LLM" ? previous.supportImageInput : false,
supportImageInput: false,
}));
setStoredSecretMasks({});
setExtraBodyDraft("");
@@ -392,7 +411,9 @@ export function ComponentsModelsPage() {
? { ...storedSecretMasks, ...draft.secrets }
: draft.secrets,
supportImageInput:
draft.capability === "LLM" ? draft.supportImageInput : false,
canConfigureImageInput(draft.capability, draft.interfaceType)
? draft.supportImageInput
: false,
enabled: editingId
? resources.find((resource) => resource.id === editingId)?.enabled ?? true
: true,
@@ -747,11 +768,25 @@ export function ComponentsModelsPage() {
</Select>
</Field>
</div>
{draft.capability === "LLM" && (
{(draft.capability === "LLM" ||
draft.capability === "Realtime") && (
<div className="flex items-center justify-between rounded-xl border border-hairline p-4">
<span className="text-sm font-medium">支持图片输入</span>
<div className="space-y-1">
<p className="text-sm font-medium">原生支持图片输入</p>
{draft.capability === "Realtime" && (
<p className="text-xs text-muted-foreground">
Qwen Audio Realtime 请保持关闭,并为助手选择独立视觉模型。
</p>
)}
</div>
<Switch
checked={draft.supportImageInput}
disabled={
!canConfigureImageInput(
draft.capability,
draft.interfaceType,
)
}
onCheckedChange={(checked) =>
setDraft((previous) => ({
...previous,