mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-03 02:22:24 +00:00
Merge ec40a48750 into 2bb826039b
This commit is contained in:
commit
fa1bed342b
2 changed files with 38 additions and 2 deletions
|
|
@ -343,6 +343,39 @@ describe("AnthropicHandler", () => {
|
||||||
expect(model.info.inputPrice).toBe(6.0)
|
expect(model.info.inputPrice).toBe(6.0)
|
||||||
expect(model.info.outputPrice).toBe(22.5)
|
expect(model.info.outputPrice).toBe(22.5)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should pass through custom/unknown model IDs instead of falling back to default", () => {
|
||||||
|
const handler = new AnthropicHandler({
|
||||||
|
apiKey: "test-api-key",
|
||||||
|
apiModelId: "qwen/qwen3.6-plus",
|
||||||
|
})
|
||||||
|
const model = handler.getModel()
|
||||||
|
expect(model.id).toBe("qwen/qwen3.6-plus")
|
||||||
|
// Should use default model info as fallback for unknown models
|
||||||
|
expect(model.info).toBeDefined()
|
||||||
|
expect(model.info.contextWindow).toBeDefined()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should use default model ID when no model ID is provided at all", () => {
|
||||||
|
const handler = new AnthropicHandler({
|
||||||
|
apiKey: "test-api-key",
|
||||||
|
apiModelId: undefined,
|
||||||
|
})
|
||||||
|
const model = handler.getModel()
|
||||||
|
expect(model.id).toBeDefined()
|
||||||
|
// Should fall back to anthropicDefaultModelId, not an empty string
|
||||||
|
expect(model.id).not.toBe("")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should preserve custom model ID when using custom base URL", () => {
|
||||||
|
const handler = new AnthropicHandler({
|
||||||
|
apiKey: "test-api-key",
|
||||||
|
anthropicBaseUrl: "http://localhost:3000/api",
|
||||||
|
apiModelId: "my-custom-model",
|
||||||
|
})
|
||||||
|
const model = handler.getModel()
|
||||||
|
expect(model.id).toBe("my-custom-model")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("reasoning block filtering", () => {
|
describe("reasoning block filtering", () => {
|
||||||
|
|
|
||||||
|
|
@ -334,8 +334,11 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
|
||||||
|
|
||||||
getModel() {
|
getModel() {
|
||||||
const modelId = this.options.apiModelId
|
const modelId = this.options.apiModelId
|
||||||
let id = modelId && modelId in anthropicModels ? (modelId as AnthropicModelId) : anthropicDefaultModelId
|
const isKnownModel = modelId !== undefined && modelId in anthropicModels
|
||||||
let info: ModelInfo = anthropicModels[id]
|
let id: string = isKnownModel ? (modelId as AnthropicModelId) : modelId || anthropicDefaultModelId
|
||||||
|
let info: ModelInfo = isKnownModel
|
||||||
|
? anthropicModels[modelId as AnthropicModelId]
|
||||||
|
: anthropicModels[anthropicDefaultModelId]
|
||||||
|
|
||||||
// If 1M context beta is enabled for supported models, update the model info
|
// If 1M context beta is enabled for supported models, update the model info
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue