(sourceNodes, sourceEdges)
| 3364 | if (activeId) await loadReportContent(activeId, true); |
| 3365 | else clearReportViewer(); |
| 3366 | } |
| 3367 | |
| 3368 | async function pollReadingTask(taskId, activeReportId = "") { |
| 3369 | if (!taskId) return; |
| 3370 | const pollToken = ++state.readingPollToken; |
| 3371 | while (pollToken === state.readingPollToken) { |
| 3372 | await new Promise((resolve) => window.setTimeout(resolve, 2500)); |
| 3373 | const data = await api(`/api/read/status?task_id=${encodeURIComponent(taskId)}`); |
| 3374 | if (pollToken !== state.readingPollToken) return; |
| 3375 | const task = data.task; |
| 3376 | if (!task) return; |
| 3377 | await refreshReports({ |
| 3378 | keepSelection: true, |
| 3379 | activeReportId: state.currentReport?.report_id || activeReportId |
| 3380 | }); |
| 3381 | if (task.status === "completed" || task.status === "failed") { |
| 3382 | const detail = `${task.completed_count || 0}/${task.total_count || 0}`; |
| 3383 | showFeedbackToast(task.status === "failed" ? "warning" : "success", task.status === "failed" ? "精读任务结束但有错误" : "精读任务完成", detail); |
| 3384 | return; |
| 3385 | } |
| 3386 | } |
| 3387 | } |
no test coverage detected