feat(file-check): 增加文件检核进度展示功能及相关配置
This commit is contained in:
1 parent
d3cfd24d6f
commit
9b36ced288
11 files changed
+361
-13
No files matched your search
@@ -2,13 +2,17 @@
|
||||
services/file_check_tools/chat_log_run_resolver.py
|
||||
|
||||
用途:按 ChatLog.run_id 解析文件检核进度(按轮问答)。
|
||||
依赖:ChatLog、ScheduleRun。
|
||||
逻辑:由 for-log API 调用;run_id 在 message_end 写入 chat_logs 表。
|
||||
依赖:ChatLog、ScheduleRun、chat_log_run_binding、chat_turn_registry。
|
||||
逻辑:for-log API 调用;优先读 chat_logs.run_id,缺失时按 session/query 兜底匹配并懒回写。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from app import db
|
||||
from app.models import ChatLog, ScheduleRun
|
||||
from app.services.file_check_tools.chat_log_run_binding import (
|
||||
resolve_run_id_for_chat_log,
|
||||
update_chat_log_run_id,
|
||||
)
|
||||
|
||||
|
||||
def find_run_for_chat_log(
|
||||
@@ -30,10 +34,24 @@ def find_run_for_chat_log(
|
||||
return None
|
||||
|
||||
log = db.session.get(ChatLog, chat_log_id)
|
||||
if not log or not log.run_id:
|
||||
if not log:
|
||||
return None
|
||||
|
||||
run = db.session.get(ScheduleRun, log.run_id)
|
||||
run_id = int(log.run_id) if log.run_id else None
|
||||
if not run_id:
|
||||
# [STEP 1] message_end 可能早于 Tool 启动完成,按 session/query 从注册表或 ScheduleRun 兜底
|
||||
resolved = resolve_run_id_for_chat_log(
|
||||
session_id=log.session_id,
|
||||
query=log.query,
|
||||
)
|
||||
if resolved:
|
||||
update_chat_log_run_id(chat_log_id, resolved)
|
||||
run_id = resolved
|
||||
|
||||
if not run_id:
|
||||
return None
|
||||
|
||||
run = db.session.get(ScheduleRun, run_id)
|
||||
if run and run.schedule_task_id == task_id:
|
||||
return run
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user