Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 45 additions & 9 deletions src/api/providers/__tests__/roo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ describe("RooHandler", () => {
expect.objectContaining({ role: "user", content: "Second message" }),
]),
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})
})
Expand Down Expand Up @@ -469,7 +473,11 @@ describe("RooHandler", () => {
expect.objectContaining({
temperature: 0.7,
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand All @@ -487,7 +495,11 @@ describe("RooHandler", () => {
expect.objectContaining({
temperature: 0.9,
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand Down Expand Up @@ -572,7 +584,11 @@ describe("RooHandler", () => {
stream_options: { include_usage: true },
reasoning: { enabled: false },
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand All @@ -590,7 +606,11 @@ describe("RooHandler", () => {
expect.objectContaining({
reasoning: { enabled: false },
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand All @@ -608,7 +628,11 @@ describe("RooHandler", () => {
expect.objectContaining({
reasoning: { enabled: true, effort: "low" },
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand All @@ -626,7 +650,11 @@ describe("RooHandler", () => {
expect.objectContaining({
reasoning: { enabled: true, effort: "medium" },
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand All @@ -644,7 +672,11 @@ describe("RooHandler", () => {
expect.objectContaining({
reasoning: { enabled: true, effort: "high" },
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})

Expand Down Expand Up @@ -679,7 +711,11 @@ describe("RooHandler", () => {
expect.objectContaining({
reasoning: { enabled: false },
}),
undefined,
expect.objectContaining({
headers: expect.objectContaining({
"X-Roo-App-Version": expect.any(String),
}),
}),
)
})
})
Expand Down
16 changes: 10 additions & 6 deletions src/api/providers/roo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import OpenAI from "openai"
import { rooDefaultModelId, getApiProtocol, type ImageGenerationApiMethod } from "@roo-code/types"
import { CloudService } from "@roo-code/cloud"

import { Package } from "../../shared/package"
import type { ApiHandlerOptions, ModelRecord } from "../../shared/api"
import { ApiStream } from "../transform/stream"
import { getModelParams } from "../transform/model-params"
Expand Down Expand Up @@ -121,12 +122,15 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
metadata?: ApiHandlerCreateMessageMetadata,
): ApiStream {
try {
const stream = await this.createStream(
systemPrompt,
messages,
metadata,
metadata?.taskId ? { headers: { "X-Roo-Task-ID": metadata.taskId } } : undefined,
)
const headers: Record<string, string> = {
"X-Roo-App-Version": Package.version,
}

if (metadata?.taskId) {
headers["X-Roo-Task-ID"] = metadata.taskId
}

const stream = await this.createStream(systemPrompt, messages, metadata, { headers })

let lastUsage: RooUsage | undefined = undefined

Expand Down
Loading