mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-05 00:45:29 +08:00
fix: make FINISHED status check case-insensitive in chat stream parsing
This commit is contained in:
@@ -291,6 +291,19 @@ test('parseChunkForContent preserves output tokens on FINISHED lines', () => {
|
||||
assert.deepEqual(parsed.parts, []);
|
||||
});
|
||||
|
||||
test('parseChunkForContent matches FINISHED case-insensitively on status paths', () => {
|
||||
const parsed = parseChunkForContent(
|
||||
{ p: 'response/status', v: ' finished ', accumulated_token_usage: 190 },
|
||||
false,
|
||||
'text',
|
||||
);
|
||||
assert.equal(parsed.parsed, true);
|
||||
assert.equal(parsed.finished, true);
|
||||
assert.equal(parsed.contentFilter, false);
|
||||
assert.equal(parsed.outputTokens, 190);
|
||||
assert.deepEqual(parsed.parts, []);
|
||||
});
|
||||
|
||||
test('parseChunkForContent filters INCOMPLETE status text without stopping stream', () => {
|
||||
const parsed = parseChunkForContent(
|
||||
{ p: 'response/status', v: 'INCOMPLETE', accumulated_token_usage: 190 },
|
||||
|
||||
Reference in New Issue
Block a user