fix:修复章节分析页面状态同步问题

This commit is contained in:
xiamuceer-j
2026-01-24 12:39:14 +08:00
parent f29eb3d8dc
commit ceb52da1ef
4 changed files with 49 additions and 16 deletions
+10 -3
View File
@@ -1193,12 +1193,19 @@ export default function Chapters() {
</Tag>
);
case 'running':
case 'running': {
// 检查是否正在重试(后端会在error_message中包含"重试"信息)
const isRetrying = task.error_message && task.error_message.includes('重试');
return (
<Tag icon={<SyncOutlined spin />} color="processing">
{task.progress}%
<Tag
icon={<SyncOutlined spin />}
color={isRetrying ? "warning" : "processing"}
title={task.error_message || undefined}
>
{isRetrying ? `重试中 ${task.progress}%` : `分析中 ${task.progress}%`}
</Tag>
);
}
case 'completed':
return (
<Tag icon={<CheckCircleOutlined />} color="success">
+6 -3
View File
@@ -363,12 +363,15 @@ export function useChapterSync() {
}
} else if (message.type === 'error') {
throw new Error(message.error || '生成失败');
} else if (message.type === 'done') {
// 生成完成,保存分析任务ID
analysisTaskId = message.analysis_task_id;
} else if (message.type === 'result') {
// 结果消息,包含分析任务ID
if (message.data?.analysis_task_id) {
analysisTaskId = message.data.analysis_task_id;
}
if (onProgressUpdate) {
onProgressUpdate('生成完成', 100);
}
} else if (message.type === 'done') {
// 生成完成,刷新章节数据
await refreshChapters();
} else if (message.type === 'analysis_started') {