feat: route workflow image inputs natively

This commit is contained in:
Xin Wang
2026-08-03 10:55:57 +08:00
parent 2e84de0798
commit f3439b21d1
10 changed files with 412 additions and 33 deletions

View File

@@ -2,6 +2,8 @@
from __future__ import annotations
from typing import Any
from models import AssistantConfig
from pipecat.flows import ContextStrategy, ContextStrategyConfig, NodeConfig
from pipecat.frames.frames import LLMUpdateSettingsFrame
@@ -106,7 +108,7 @@ class WorkflowAgentStage:
node_id: str,
*,
functions: list,
leading_messages: list[dict[str, str]] | None = None,
leading_messages: list[dict[str, Any]] | None = None,
) -> NodeConfig:
data = self._engine.data(node_id)
strategy = (

View File

@@ -3,6 +3,7 @@
from __future__ import annotations
from collections.abc import Callable
from typing import Any
from services.runtime_variables import DynamicVariableStore
from services.workflow.models import EdgeEvaluation, RouteStatus
@@ -23,7 +24,12 @@ class WorkflowEdgeEvaluator:
self._store = store
self._router_for_node = router_for_node
async def evaluate(self, node_id: str) -> EdgeEvaluation:
async def evaluate(
self,
node_id: str,
*,
current_user_message: dict[str, Any] | None = None,
) -> EdgeEvaluation:
"""Select the first matching conditional path, then the default path."""
outgoing = self._engine.outgoing(node_id)
expression_edge = self._engine.deterministic_edge(
@@ -61,6 +67,7 @@ class WorkflowEdgeEvaluator:
node_prompt=self._engine.routing_prompt(node_id, self._store),
edges=llm_edges,
history=self._store.history,
current_user_message=current_user_message,
variables={
key: value
for key, value in self._store.values.items()
@@ -94,4 +101,3 @@ class WorkflowEdgeEvaluator:
if edge is None:
return EdgeEvaluation(status=RouteStatus.NO_MATCH)
return EdgeEvaluation(status=RouteStatus.MATCHED, edge=edge)