fix:修复章节分析页面状态同步问题
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user