feat(workflow): add per-agent vision configuration

This commit is contained in:
Xin Wang
2026-07-18 00:00:28 +08:00
parent bdf3d3dd9c
commit 28c6380d8a
23 changed files with 553 additions and 34 deletions

View File

@@ -38,6 +38,8 @@ export type WorkflowNodeData = {
llmResourceId?: string;
asrResourceId?: string;
ttsResourceId?: string;
visionEnabled?: boolean;
visionModelResourceId?: string;
enableInterrupt?: boolean;
turnConfig?: TurnConfig;
toolId?: string;
@@ -140,6 +142,8 @@ export type WorkflowGraph = {
defaultLlmResourceId: string;
defaultAsrResourceId: string;
defaultTtsResourceId: string;
visionEnabled: boolean;
visionModelResourceId: string;
toolIds: string[];
knowledgeBaseId: string;
knowledgeMode: "automatic" | "on_demand";
@@ -172,6 +176,8 @@ export function defaultGraph(): WorkflowGraph {
defaultLlmResourceId: "",
defaultAsrResourceId: "",
defaultTtsResourceId: "",
visionEnabled: false,
visionModelResourceId: "",
toolIds: [],
knowledgeBaseId: "",
knowledgeMode: "automatic",
@@ -234,3 +240,14 @@ export function defaultGraph(): WorkflowGraph {
],
};
}
/** The camera stays connected when at least one effective Agent can use it. */
export function workflowUsesVision(graph: WorkflowGraph): boolean {
return graph.nodes.some((node) => {
if (node.type !== "agent") return false;
const inheritsGlobal = node.data.inheritGlobalConfig !== false;
return inheritsGlobal
? graph.settings.visionEnabled
: Boolean(node.data.visionEnabled);
});
}