mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Pass app version to provider (#9730)
This commit is contained in:
parent
ba7340f460
commit
b2b4f6411f
2 changed files with 55 additions and 15 deletions
|
|
@ -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),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
@ -469,7 +473,11 @@ describe("RooHandler", () => {
|
|||
expect.objectContaining({
|
||||
temperature: 0.7,
|
||||
}),
|
||||
undefined,
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
"X-Roo-App-Version": expect.any(String),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -487,7 +495,11 @@ describe("RooHandler", () => {
|
|||
expect.objectContaining({
|
||||
temperature: 0.9,
|
||||
}),
|
||||
undefined,
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
"X-Roo-App-Version": expect.any(String),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -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),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -590,7 +606,11 @@ describe("RooHandler", () => {
|
|||
expect.objectContaining({
|
||||
reasoning: { enabled: false },
|
||||
}),
|
||||
undefined,
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
"X-Roo-App-Version": expect.any(String),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -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),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -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),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -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),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -679,7 +711,11 @@ describe("RooHandler", () => {
|
|||
expect.objectContaining({
|
||||
reasoning: { enabled: false },
|
||||
}),
|
||||
undefined,
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
"X-Roo-App-Version": expect.any(String),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue