fix: switch to processing status when receiving response tokens from LLM

This commit is contained in:
Xiaohan-Tian
2026-05-14 21:37:06 -07:00
parent 1a051fea54
commit 2bd6925f27
5 changed files with 139 additions and 8 deletions
+3 -1
View File
@@ -16,6 +16,8 @@ interface StreamProcessorResult {
isProcessing: boolean;
}
const PROCESSING_WAVE = '<span class="processing-wave">Processing...</span>';
export const useStreamProcessor = (options: StreamProcessorOptions): StreamProcessorResult => {
const { onMessageUpdate, onMessageAdd, onMessageRemove, onProcessingChange } = options;
const [abortController, setAbortController] = useState<AbortController | null>(null);
@@ -56,7 +58,7 @@ export const useStreamProcessor = (options: StreamProcessorOptions): StreamProce
onMessageUpdate(currentStreamingId, (msg) => ({
...msg,
content: `<span class="processing-wave">Thinking...</span>${tokenCount > 0 ? ` ${tokenCount} tokens received.` : ''} click here to abort.`,
content: `${PROCESSING_WAVE}${tokenCount > 0 ? ` ${tokenCount} tokens received.` : ''} click here to abort.`,
tokenCount
}));
} else if (chunk.type === 'tool_call' && chunk.toolCall) {