Skip to content

Commit 6f47926

Browse files
committed
fix: correct typo in warning message and refine whitespace handling logic
1 parent 83cdfde commit 6f47926

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/routes/messages/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const handleWithResponsesApi = async (
181181

182182
if (!streamState.messageCompleted) {
183183
logger.warn(
184-
"Responses stream ended without completion; sending erorr event",
184+
"Responses stream ended without completion; sending error event",
185185
)
186186
const errorEvent = buildErrorEvent(
187187
"Responses stream ended without completion",

src/routes/messages/responses-stream-translation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ const updateWhitespaceRunState = (
3838
let count = previousCount
3939

4040
for (const char of chunk) {
41-
if (char === " " || char === "\r" || char === "\n") {
41+
if (char === "\r" || char === "\n") {
4242
count += 1
4343
if (count > MAX_CONSECUTIVE_FUNCTION_CALL_WHITESPACE) {
4444
return { nextCount: count, exceeded: true }
4545
}
4646
continue
4747
}
4848

49-
count = 0
49+
if (char !== " ") {
50+
count = 0
51+
}
5052
}
5153

5254
return { nextCount: count, exceeded: false }

0 commit comments

Comments
 (0)