feat: add realtime workflow vision tools
This commit is contained in:
@@ -85,6 +85,7 @@ async def _validate_workflow_references(
|
||||
graph = body.graph
|
||||
engine = WorkflowEngine(graph)
|
||||
settings = graph.get("settings") or {}
|
||||
runtime_mode = str(settings.get("runtimeMode") or "pipeline")
|
||||
resource_expectations: dict[str, str] = {}
|
||||
vision_resource_ids: set[str] = set()
|
||||
for key, capability in (
|
||||
@@ -118,16 +119,22 @@ async def _validate_workflow_references(
|
||||
stage = engine.agent_stage_config(node_id)
|
||||
if not stage.vision_enabled:
|
||||
continue
|
||||
resource_id = (
|
||||
stage.vision_model_resource_id or stage.llm_resource_id
|
||||
)
|
||||
if stage.vision_model_resource_id:
|
||||
resource_id = stage.vision_model_resource_id
|
||||
capability = "LLM"
|
||||
elif runtime_mode == "realtime":
|
||||
resource_id = str(settings.get("defaultRealtimeResourceId") or "")
|
||||
capability = "Realtime"
|
||||
else:
|
||||
resource_id = stage.llm_resource_id
|
||||
capability = "LLM"
|
||||
if not resource_id:
|
||||
raise HTTPException(
|
||||
400,
|
||||
f"Agent 节点 {node_id} 开启视觉理解时必须选择"
|
||||
"支持图片输入的大语言模型或视觉模型",
|
||||
"支持图片输入的当前模型或独立视觉模型",
|
||||
)
|
||||
resource_expectations[resource_id] = "LLM"
|
||||
resource_expectations[resource_id] = capability
|
||||
vision_resource_ids.add(resource_id)
|
||||
for resource_id, capability in resource_expectations.items():
|
||||
resource = await session.get(ModelResource, resource_id)
|
||||
|
||||
Reference in New Issue
Block a user