mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 22:43:45 +08:00
fix: claude duplicate messages in stream
This commit is contained in:
parent
c96d3b546c
commit
0fac03a05a
@ -200,6 +200,7 @@ class ClaudeService extends BaseService {
|
||||
event.delta.type !== 'text_delta'
|
||||
) return;
|
||||
const str = JSON.stringify({
|
||||
type: 'text',
|
||||
text: event.delta.text,
|
||||
});
|
||||
stream.write(str + '\n');
|
||||
@ -217,6 +218,9 @@ class ClaudeService extends BaseService {
|
||||
buffer = '{}';
|
||||
}
|
||||
const str = JSON.stringify({
|
||||
...content_block,
|
||||
|
||||
// deprecated {}.tool_use (because it was like that before)
|
||||
tool_use: {
|
||||
...content_block,
|
||||
input: JSON.parse(buffer),
|
||||
@ -257,7 +261,6 @@ class ClaudeService extends BaseService {
|
||||
type: 'text',
|
||||
text: event.delta.text,
|
||||
});
|
||||
stream.write(str + '\n');
|
||||
}
|
||||
stream.end();
|
||||
usage_promise.resolve(counts);
|
||||
|
Loading…
Reference in New Issue
Block a user