feat:架构重构
This commit is contained in:
@@ -75,9 +75,7 @@ async def ainvoke_screen(
|
||||
return result
|
||||
|
||||
|
||||
async def astream_screen(
|
||||
graph, payload, *, thread_id, session_id=None, user_id=None
|
||||
):
|
||||
async def astream_screen(graph, payload, *, thread_id, session_id=None, user_id=None):
|
||||
"""同一轮流保持同一个追踪上下文,关闭流时结束追踪"""
|
||||
from contextlib import aclosing
|
||||
|
||||
@@ -170,11 +168,8 @@ def _run_output(state: dict[str, Any]) -> dict[str, Any]:
|
||||
"outcome": outcome,
|
||||
"intent": state.get("intent"),
|
||||
"answer": state.get("answer"),
|
||||
"offer": state.get("offer"),
|
||||
"clarification": [item.value for item in pending] if pending else None,
|
||||
"actions": state.get("actions"),
|
||||
"validation_passed": state.get("validation_passed"),
|
||||
"failure_reason": state.get("failure_reason"),
|
||||
}
|
||||
|
||||
|
||||
@@ -192,13 +187,7 @@ def observe_decision(request: Any) -> Iterator[Any]:
|
||||
return
|
||||
|
||||
model = request.model or settings.typesafe_model
|
||||
# 意图判断可能附带对上一轮提议的回应判断,仍属于同一次意图识别
|
||||
name = (
|
||||
"classify-intent"
|
||||
if set(request.decisions) <= {"intent", "offer_response"}
|
||||
and "intent" in request.decisions
|
||||
else "run-decision"
|
||||
)
|
||||
name = "classify-intent" if set(request.decisions) == {"intent"} else "run-decision"
|
||||
# 复用本应用已经选定的客户端
|
||||
with client.start_as_current_observation(
|
||||
as_type="generation",
|
||||
|
||||
Reference in New Issue
Block a user