Skip to content

Commit 6c77ba3

Browse files
committed
feat: Streamline SSE message handling in chat completions
1 parent 6d12770 commit 6c77ba3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/routes/chat-completions/handler-streaming.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Context } from "hono"
22

33
import consola from "consola"
4-
import { streamSSE } from "hono/streaming"
4+
import { streamSSE, type SSEMessage } from "hono/streaming"
55

66
import type { ChatCompletionsPayload } from "~/services/copilot/chat-completions/types"
77

@@ -25,9 +25,7 @@ export async function handlerStreaming(c: Context) {
2525

2626
index++
2727

28-
await stream.writeSSE({
29-
data: JSON.stringify(chunk.data),
30-
})
28+
await stream.writeSSE(chunk as SSEMessage)
3129
}
3230
})
3331
}

0 commit comments

Comments
 (0)