fix: remove assistant event handler to prevent duplicate messages
This commit is contained in:
parent
44a8ddf458
commit
de8a7798c3
1 changed files with 3 additions and 14 deletions
|
|
@ -171,20 +171,9 @@ const App = () => {
|
|||
}
|
||||
|
||||
// Claude stream-json events
|
||||
if (type === 'assistant') {
|
||||
// Full assistant message (not streaming)
|
||||
const content = data.message?.content;
|
||||
let text = '';
|
||||
if (Array.isArray(content)) {
|
||||
text = content.filter(b => b.type === 'text').map(b => b.text).join('');
|
||||
} else if (typeof content === 'string') {
|
||||
text = content;
|
||||
}
|
||||
if (text) {
|
||||
pendingAssistantRef.current += text;
|
||||
upsertStreamingMessage(pendingAssistantRef.current, false);
|
||||
}
|
||||
}
|
||||
// NOTE: We intentionally skip the 'assistant' event type.
|
||||
// It contains the full message text that was ALREADY streamed via
|
||||
// content_block_delta events, so handling it would create a duplicate bubble.
|
||||
|
||||
if (type === 'content_block_delta') {
|
||||
const delta = data.delta;
|
||||
|
|
|
|||
Reference in a new issue