feat: 更新 SmartContentFormatter,确保格式化内容始终返回可显示的字符串

This commit is contained in:
catlog22
2026-01-11 22:37:44 +08:00
parent 7f3033b1c1
commit 37614a3362
7 changed files with 100 additions and 39 deletions

View File

@@ -794,8 +794,8 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec
// Always broadcast to dashboard for real-time viewing
// Note: /api/hook wraps extraData into payload, so send fields directly
// Maintain backward compatibility with frontend expecting { chunkType, data }
// Use SmartContentFormatter for intelligent content formatting
const content = SmartContentFormatter.format(unit.content, unit.type) || JSON.stringify(unit.content);
// Use SmartContentFormatter for intelligent content formatting (never returns null)
const content = SmartContentFormatter.format(unit.content, unit.type);
broadcastStreamEvent('CLI_OUTPUT', {
executionId,
chunkType: unit.type, // For backward compatibility