mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Fixed model mismatch
This commit is contained in:
committed by
Vignesh Subbiah
parent
62dcfbe549
commit
02ccd77004
@@ -4,26 +4,22 @@ import { Anthropic } from "@anthropic-ai/sdk"
|
|||||||
import { ApiHandler } from "../index"
|
import { ApiHandler } from "../index"
|
||||||
|
|
||||||
export class UnboundHandler implements ApiHandler {
|
export class UnboundHandler implements ApiHandler {
|
||||||
private unboundApiKey: string
|
|
||||||
private unboundModelId: string
|
|
||||||
private unboundBaseUrl: string = "https://ai-gateway-43843357113.us-west1.run.app/v1"
|
private unboundBaseUrl: string = "https://ai-gateway-43843357113.us-west1.run.app/v1"
|
||||||
private options: ApiHandlerOptions
|
private options: ApiHandlerOptions
|
||||||
|
|
||||||
constructor(options: ApiHandlerOptions) {
|
constructor(options: ApiHandlerOptions) {
|
||||||
this.options = options
|
this.options = options
|
||||||
this.unboundApiKey = options.unboundApiKey || ""
|
|
||||||
this.unboundModelId = options.unboundModelId || ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
|
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
|
||||||
const response = await fetch(`${this.unboundBaseUrl}/chat/completions`, {
|
const response = await fetch(`${this.unboundBaseUrl}/chat/completions`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${this.unboundApiKey}`,
|
Authorization: `Bearer ${this.options.unboundApiKey}`,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: this.unboundModelId,
|
model: this.getModel().id,
|
||||||
messages: [{ role: "system", content: systemPrompt }, ...messages],
|
messages: [{ role: "system", content: systemPrompt }, ...messages],
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user