修复:完整展示AI原文并穿插图表,统一运行反馈与变化符号

This commit is contained in:
2026-11-02 12:03:37 +08:00
parent cf8e25a30d
commit 903fa94c00
35 changed files with 1016 additions and 172 deletions
+13
View File
@@ -136,3 +136,16 @@ export function partialAnswerIsOnlyProgress(turn: Record<string, unknown>): bool
if (lastAssistant < 0 || String(record(entries[lastAssistant]).text || '').trim() !== answer) return false;
return entries.slice(lastAssistant + 1).some(item => ['tool_start', 'tool_result'].includes(String(record(item).kind)));
}
/** Tool event names describe a step, never the lifecycle of the whole turn. */
export function analysisStreamStatus(previous: unknown, event: string, reported: unknown): string {
const prior = String(previous || '').toUpperCase();
const terminal = new Set(['COMPLETED', 'PARTIAL', 'FAILED', 'CANCELLED', 'NEEDS_CLARIFICATION']);
if (terminal.has(prior)) return prior;
const name = event.toUpperCase().replaceAll('.', '_').replaceAll('-', '_');
const status = String(reported || '').toUpperCase();
if (/^(?:TURN_)?(COMPLETED|PARTIAL|FAILED|CANCELLED|NEEDS_CLARIFICATION)$/.test(name)) return name.replace(/^TURN_/, '');
if (!name.startsWith('TOOL_') && (analysisIsRunning(status) || terminal.has(status))) return status;
if (name.startsWith('TOOL_') || name === 'ANSWER') return 'RUNNING';
return analysisIsRunning(prior) ? prior : 'RUNNING';
}