Skip to content

Commit a80cea2

Browse files
committed
feat: limit logging length
1 parent 76b0c41 commit a80cea2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export async function runServer(options: RunServerOptions): Promise<void> {
7272
)
7373

7474
const selectedSmallModel = await consola.prompt(
75-
"Select a small model to use with Claude Code (https://docs.anthropic.com/en/docs/claude-code/costs#background-token-usage)",
75+
"Select a small model to use with Claude Code",
7676
{
7777
type: "select",
7878
options: state.models.data.map((model) => model.id),

src/routes/chat-completions/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +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))
21+
consola.debug("Request payload:", JSON.stringify(payload).slice(-400))
2222

2323
consola.info("Current token count:", getTokenCount(payload.messages))
2424

src/routes/messages/handler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function handleCompletion(c: Context) {
4444
if (isNonStreaming(response)) {
4545
consola.debug(
4646
"Non-streaming response from Copilot:",
47-
JSON.stringify(response),
47+
JSON.stringify(response).slice(-400),
4848
)
4949
const anthropicResponse = translateToAnthropic(response)
5050
consola.debug(
@@ -64,7 +64,7 @@ export async function handleCompletion(c: Context) {
6464
}
6565

6666
for await (const rawEvent of response) {
67-
consola.trace("Copilot raw stream event:", JSON.stringify(rawEvent))
67+
consola.debug("Copilot raw stream event:", JSON.stringify(rawEvent))
6868
if (rawEvent.data === "[DONE]") {
6969
break
7070
}
@@ -77,7 +77,7 @@ export async function handleCompletion(c: Context) {
7777
const events = translateChunkToAnthropicEvents(chunk, streamState)
7878

7979
for (const event of events) {
80-
consola.trace("Translated Anthropic event:", JSON.stringify(event))
80+
consola.debug("Translated Anthropic event:", JSON.stringify(event))
8181
await stream.writeSSE({
8282
event: event.type,
8383
data: JSON.stringify(event),

0 commit comments

Comments
 (0)