feat(workflow): add edge-tool routing and realtime runtime

This commit is contained in:
Xin Wang
2026-08-04 22:29:04 +08:00
parent 1902ffc240
commit 59588ba88d
25 changed files with 1952 additions and 107 deletions

View File

@@ -37,6 +37,14 @@ def _validate_workflow(body: AssistantUpsert) -> None:
return
body.graph = normalize_graph(body.graph or {})
errors = validate_graph(body.graph)
settings = body.graph.get("settings") or {}
graph_runtime_mode = str(settings.get("runtimeMode") or "pipeline")
if graph_runtime_mode != body.runtime_mode:
errors.append("工作流全局运行模式与 Assistant runtimeMode 不一致")
graph_realtime_id = str(settings.get("defaultRealtimeResourceId") or "")
bound_realtime_id = str(body.model_resource_ids.get("Realtime") or "")
if graph_realtime_id != bound_realtime_id:
errors.append("工作流 Realtime 模型与 Assistant Realtime 绑定不一致")
declared_variables = set(body.dynamic_variable_definitions)
for node in body.graph.get("nodes") or []:
node_id = str(node.get("id") or "")
@@ -80,6 +88,7 @@ async def _validate_workflow_references(
resource_expectations: dict[str, str] = {}
vision_resource_ids: set[str] = set()
for key, capability in (
("defaultRealtimeResourceId", "Realtime"),
("defaultLlmResourceId", "LLM"),
("defaultAsrResourceId", "ASR"),
("defaultTtsResourceId", "TTS"),