feat(file-check): 持久化 chat_tool_runs 并统一 agent_runtime_context 注入
新增跨 worker 进度绑定表与显式 hxops_turn_id 链路;Dify Start 仅注入 agent_runtime_context,task_id/turn_id 写入 refs 供画布解析后回传 Tool。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c778f40fbc
commit
f4e74f7b07
23 files changed
+1580
-196
No files matched your search
@@ -2,8 +2,8 @@
|
||||
backend/app/services/agent_registry/handlers/file_check.py
|
||||
|
||||
用途:文件检核 Agent Handler — 聊天流 turn 注册与 Dify 进度绑定。
|
||||
依赖:file_check_tools.chat_turn_registry、agent_registry.handlers.registry、resolver。
|
||||
逻辑:DifyChatExecutor 经 resolve_handler_for_agent_code 调用 prepare_stream 注册 hxops_turn_id。
|
||||
依赖:file_check_tools.chat_tool_run_binding、chat_turn_registry、agent_registry.handlers.registry、resolver。
|
||||
逻辑:DifyChatExecutor 经 resolve_handler_for_agent_code 调用 prepare_stream 注册 hxops_turn_id 并写入 chat_tool_runs。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -38,7 +38,9 @@ class FileCheckHandler(AgentHandler):
|
||||
return ctx
|
||||
|
||||
turn_id = uuid.uuid4().hex
|
||||
from app.services.file_check_tools.chat_tool_run_binding import register_pending_turn
|
||||
from app.services.file_check_tools.chat_turn_registry import register_file_check_chat_turn
|
||||
from app.services.file_check_tools.task_resolver import resolve_schedule_task_id_from_agent
|
||||
|
||||
register_file_check_chat_turn(
|
||||
turn_id=turn_id,
|
||||
@@ -47,5 +49,13 @@ class FileCheckHandler(AgentHandler):
|
||||
agent_id=int(getattr(ctx.agent, 'id', 0) or 0),
|
||||
query=ctx.query,
|
||||
)
|
||||
register_pending_turn(
|
||||
turn_id=turn_id,
|
||||
session_id=str(getattr(ctx.session, 'session_id', '') or ''),
|
||||
user_id=int(getattr(ctx.user, 'id', 0) or 0),
|
||||
agent_id=int(getattr(ctx.agent, 'id', 0) or 0),
|
||||
user_message=ctx.query,
|
||||
schedule_task_id=resolve_schedule_task_id_from_agent(ctx.agent),
|
||||
)
|
||||
ctx.hxops_turn_id = turn_id
|
||||
return ctx
|
||||
Reference in new issue
Block a user