Skip to content

Commit d6d1228

Browse files
authored
fix: simplify null checks for reasoning and content (#135)
* fix: simplify null checks for reasoning and content in OpenRouterChatLanguageModel * fix(test): ci
1 parent 98a8c98 commit d6d1228

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/chat/index.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,6 @@ describe('doStream', () => {
660660
type: 'response-metadata',
661661
modelId: 'gpt-3.5-turbo-0613',
662662
},
663-
{
664-
type: 'text-start',
665-
id: expect.any(String),
666-
},
667-
{ type: 'text-delta', delta: '', id: expect.any(String) },
668663
{
669664
type: 'response-metadata',
670665
id: 'chatcmpl-96aZqmeDpA9IPD6tACY8djkMsJCMP',
@@ -673,6 +668,7 @@ describe('doStream', () => {
673668
type: 'response-metadata',
674669
modelId: 'gpt-3.5-turbo-0613',
675670
},
671+
{ type: 'text-start', id: expect.any(String) },
676672
{ type: 'text-delta', delta: 'Hello', id: expect.any(String) },
677673
{
678674
type: 'response-metadata',

src/chat/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,11 @@ export class OpenRouterChatLanguageModel implements LanguageModelV2 {
560560
}
561561
}
562562
}
563-
} else if (delta.reasoning != null) {
563+
} else if (delta.reasoning) {
564564
emitReasoningChunk(delta.reasoning);
565565
}
566566

567-
if (delta.content != null) {
567+
if (delta.content) {
568568
if (!textStarted) {
569569
textId = openrouterResponseId || generateId();
570570
controller.enqueue({

0 commit comments

Comments
 (0)