feat(file-check): 增加文件检核进度展示功能及相关配置

This commit is contained in:
hugo committed 2026-06-16 17:34:25 +08:00
1 parent d3cfd24d6f
commit 9b36ced288
11 files changed
+361 -13

No files matched your search

@@ -4,7 +4,7 @@
* 依赖:useToolRunProgress、toolRunProgressConfig、ChatMessage。
* 逻辑:按助手消息 ChatLog.run_id 展示进度,每轮问答独立绑定;无 run_id 时不展示进度卡片。
* 逻辑:仅当 chat_logs.run_id 已绑定(消息含 run_id 或 for-log 已解析到批次)时展示进度卡片;未绑定时不展示等待条,后台仍轮询 for-log。
*/
@@ -32,6 +32,7 @@ import {
isRunningToolRunStatus,
resolveScheduleTaskId,
resolveMessageAnchorKey,
resolveToolRunProgressOptions,
} from '../utils/toolRunProgressConfig';
@@ -62,6 +63,8 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
const pollingChatLogIds = ref<number[]>([]);
const emptyPollCounts = ref<Record<number, number>>({});
let pollTimer: number | undefined;
@@ -108,6 +111,8 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
const boundScheduleTaskId = computed(() => resolveScheduleTaskId(rawToolRunConfig.value));
const progressPollOptions = computed(() => resolveToolRunProgressOptions(rawToolRunConfig.value));
const clearPollTimer = () => {
@@ -246,6 +251,12 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
storeRunPayload(payload.run, chatLogId);
const nextEmptyCounts = { ...emptyPollCounts.value };
delete nextEmptyCounts[chatLogId];
emptyPollCounts.value = nextEmptyCounts;
const msg = ctx.messages.value[messageIndex];
if (msg && !getRunIdFromMessage(msg)) {
@@ -254,6 +265,32 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
}
} else {
const nextCount = (emptyPollCounts.value[chatLogId] || 0) + 1;
emptyPollCounts.value = {
...emptyPollCounts.value,
[chatLogId]: nextCount,
};
const emptyPollMax = progressPollOptions.value.empty_poll_max;
if (nextCount >= emptyPollMax) {
chatLogErrors.value = {
...chatLogErrors.value,
[chatLogId]: '暂未找到关联的检核任务,请稍后刷新或查看排程执行记录',
};
}
}
const nextErrors = { ...chatLogErrors.value };
@@ -314,6 +351,8 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
pollingChatLogIds.value = [];
emptyPollCounts.value = {};
return;
}
@@ -398,7 +437,19 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
const hasRunning = Object.values(nextRuns).some((run) => isRunningToolRunStatus(run.status));
if (hasRunning) schedulePoll();
const emptyPollMax = progressPollOptions.value.empty_poll_max;
const hasPendingChatLogs = chatLogIds.some((chatLogId) => {
if (chatLogRunMap.value[chatLogId]) return false;
if (chatLogErrors.value[chatLogId]) return false;
return (emptyPollCounts.value[chatLogId] || 0) < emptyPollMax;
});
if (hasRunning || hasPendingChatLogs) schedulePoll();
};
@@ -424,6 +475,8 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
clearPollTimer();
emptyPollCounts.value = {};
},
);
@@ -532,7 +585,7 @@ export function useChatPageToolRun(ctx: ChatPageToolRunContext) {
* 判断是否在该助手消息后展示进度卡片。
* 核心逻辑:已解析到 run_id 时展示;执行中、已完成、加载中或查询报错均保留卡片,无 run_id 不展示。
* 核心逻辑:chat_logs.run_id 未绑定时不展示;已解析到 run_id 后展示进度/加载/报错状态。
*/