mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Remove logs
This commit is contained in:
@@ -83,9 +83,7 @@ export class OpenRouterHandler implements ApiHandler {
|
|||||||
|
|
||||||
let genId: string | undefined
|
let genId: string | undefined
|
||||||
|
|
||||||
console.log("Starting stream processing for OpenRouter")
|
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
console.log("Received chunk:", chunk)
|
|
||||||
// openrouter returns an error object instead of the openai sdk throwing an error
|
// openrouter returns an error object instead of the openai sdk throwing an error
|
||||||
if ("error" in chunk) {
|
if ("error" in chunk) {
|
||||||
const error = chunk.error as { message?: string; code?: number }
|
const error = chunk.error as { message?: string; code?: number }
|
||||||
@@ -95,31 +93,27 @@ export class OpenRouterHandler implements ApiHandler {
|
|||||||
|
|
||||||
if (!genId && chunk.id) {
|
if (!genId && chunk.id) {
|
||||||
genId = chunk.id
|
genId = chunk.id
|
||||||
console.log("Generation ID set:", genId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const delta = chunk.choices[0]?.delta
|
const delta = chunk.choices[0]?.delta
|
||||||
if (delta?.content) {
|
if (delta?.content) {
|
||||||
console.log("Yielding content:", delta.content)
|
|
||||||
yield {
|
yield {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: delta.content,
|
text: delta.content,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Stream processing completed")
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log("Fetching generation details for ID:", genId)
|
|
||||||
const response = await axios.get(`https://openrouter.ai/api/v1/generation?id=${genId}`, {
|
const response = await axios.get(`https://openrouter.ai/api/v1/generation?id=${genId}`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${this.options.openRouterApiKey}`,
|
Authorization: `Bearer ${this.options.openRouterApiKey}`,
|
||||||
},
|
},
|
||||||
|
timeout: 5_000, // this request hangs sometimes
|
||||||
})
|
})
|
||||||
|
|
||||||
const generation = response.data?.data
|
const generation = response.data?.data
|
||||||
console.log("OpenRouter generation details:", response.data)
|
console.log("OpenRouter generation details:", response.data)
|
||||||
console.log("Yielding usage information")
|
|
||||||
yield {
|
yield {
|
||||||
type: "usage",
|
type: "usage",
|
||||||
inputTokens: generation?.native_tokens_prompt || 0,
|
inputTokens: generation?.native_tokens_prompt || 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user