feat(file-check): 增加文件检核进度展示功能及相关配置
This commit is contained in:
1 parent
d3cfd24d6f
commit
9b36ced288
11 files changed
+361
-13
No files matched your search
@@ -653,6 +653,51 @@ def test_workspace_file_check_run_for_log_returns_null_when_unbound(app, client)
|
||||
assert payload.get('match_source') is None
|
||||
|
||||
|
||||
def test_workspace_file_check_run_for_log_lazy_binds_via_session_query(app, client):
|
||||
"""chat_log 尚无 run_id 时,for-log 应按 session/query 兜底匹配并回写。"""
|
||||
with app.app_context():
|
||||
admin = _mk_admin()
|
||||
db.session.commit()
|
||||
task = _mk_check_task(admin.id)
|
||||
run = ScheduleRun(
|
||||
run_no='RUN-ROHS-LAZY',
|
||||
schedule_task_id=task.id,
|
||||
status='running',
|
||||
trigger_type='dify_chatflow',
|
||||
api_request_json={
|
||||
'bind_session_id': 'sess-lazy-bind',
|
||||
'bind_user_message': '立即执行文件检核',
|
||||
},
|
||||
)
|
||||
db.session.add(run)
|
||||
db.session.commit()
|
||||
log = ChatLog(
|
||||
user_id=admin.id,
|
||||
agent_id=1,
|
||||
query='立即执行文件检核',
|
||||
answer='检核已启动',
|
||||
session_id='sess-lazy-bind',
|
||||
)
|
||||
db.session.add(log)
|
||||
db.session.commit()
|
||||
task_id = task.id
|
||||
chat_log_id = log.id
|
||||
run_id = run.id
|
||||
|
||||
res = client.get(
|
||||
f'/api/workspace/file-check/runs/for-log?task_id={task_id}&chat_log_id={chat_log_id}',
|
||||
headers={'X-Username': 'admin'},
|
||||
)
|
||||
assert res.status_code == 200
|
||||
payload = res.get_json()
|
||||
assert payload['run']['run_id'] == run_id
|
||||
assert payload['match_source'] == 'chat_log'
|
||||
|
||||
with app.app_context():
|
||||
rebound = db.session.get(ChatLog, chat_log_id)
|
||||
assert rebound.run_id == run_id
|
||||
|
||||
|
||||
def test_workspace_file_check_run_for_log_reads_bound_run_id(app, client):
|
||||
with app.app_context():
|
||||
admin = _mk_admin()
|
||||
|
||||
Reference in new issue
Block a user