Skip to content

Commit 059d39b

Browse files
committed
feat: actually log stuff when --verbose
1 parent 60f8ca8 commit 059d39b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/routes/chat-completions/handler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export async function handleCompletion(c: Context) {
1818
await checkRateLimit(state)
1919

2020
let payload = await c.req.json<ChatCompletionsPayload>()
21+
consola.debug("Request payload:", JSON.stringify(payload))
2122

2223
consola.info("Current token count:", getTokenCount(payload.messages))
2324

@@ -32,16 +33,20 @@ export async function handleCompletion(c: Context) {
3233
...payload,
3334
max_tokens: selectedModel?.capabilities.limits.max_output_tokens,
3435
}
36+
consola.debug("Set max_tokens to:", JSON.stringify(payload.max_tokens))
3537
}
3638

3739
const response = await createChatCompletions(payload)
3840

3941
if (isNonStreaming(response)) {
42+
consola.debug("Non-streaming response:", JSON.stringify(response))
4043
return c.json(response)
4144
}
4245

46+
consola.debug("Streaming response")
4347
return streamSSE(c, async (stream) => {
4448
for await (const chunk of response) {
49+
consola.debug("Streaming chunk:", JSON.stringify(chunk))
4550
await stream.writeSSE(chunk as SSEMessage)
4651
}
4752
})

0 commit comments

Comments
 (0)