mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
fix(gateway): preserve FIM gateway model passthrough
This commit is contained in:
@@ -24,6 +24,10 @@ const CODESTRAL_FIM_URL = "https://codestral.mistral.ai/v1/fim/completions"
|
||||
const INCEPTION_FIM_URL = "https://api.inceptionlabs.ai/v1/fim/completions"
|
||||
|
||||
export function resolveFimTarget(provider?: string, model?: string): FimTarget {
|
||||
if (!provider || provider === "kilo") {
|
||||
return { provider: "kilo", model: model ?? "mistralai/codestral-2501", urls: [KILO_FIM_URL] }
|
||||
}
|
||||
|
||||
const info = getAutocompleteModel(provider, model)
|
||||
if (info.directProvider === "mistral") {
|
||||
return { provider: "mistral", model: info.requestModel, urls: [MISTRAL_FIM_URL, CODESTRAL_FIM_URL] }
|
||||
@@ -31,7 +35,7 @@ export function resolveFimTarget(provider?: string, model?: string): FimTarget {
|
||||
if (info.directProvider === "inception") {
|
||||
return { provider: "inception", model: info.requestModel, urls: [INCEPTION_FIM_URL] }
|
||||
}
|
||||
return { provider: "kilo", model: info.requestModel, urls: [KILO_FIM_URL] }
|
||||
return { provider: "kilo", model: model ?? "mistralai/codestral-2501", urls: [KILO_FIM_URL] }
|
||||
}
|
||||
|
||||
async function getProxyAuth(Auth: Auth) {
|
||||
|
||||
@@ -28,7 +28,12 @@ describe("FIM target resolution", () => {
|
||||
})
|
||||
})
|
||||
|
||||
test("maps legacy gateway IDs to explicit Kilo Gateway targets", () => {
|
||||
test("preserves gateway model pass-through behavior", () => {
|
||||
expect(resolveFimTarget()).toEqual({
|
||||
provider: "kilo",
|
||||
model: "mistralai/codestral-2501",
|
||||
urls: ["https://api.kilo.ai/api/fim/completions"],
|
||||
})
|
||||
expect(resolveFimTarget(undefined, "mistralai/codestral-2508")).toEqual({
|
||||
provider: "kilo",
|
||||
model: "mistralai/codestral-2508",
|
||||
@@ -36,12 +41,12 @@ describe("FIM target resolution", () => {
|
||||
})
|
||||
expect(resolveFimTarget(undefined, "inception/mercury-edit")).toEqual({
|
||||
provider: "kilo",
|
||||
model: "inception/mercury-edit-2",
|
||||
model: "inception/mercury-edit",
|
||||
urls: ["https://api.kilo.ai/api/fim/completions"],
|
||||
})
|
||||
expect(resolveFimTarget(undefined, "inception/mercury-edit-2")).toEqual({
|
||||
expect(resolveFimTarget("kilo", "custom/fim-model")).toEqual({
|
||||
provider: "kilo",
|
||||
model: "inception/mercury-edit-2",
|
||||
model: "custom/fim-model",
|
||||
urls: ["https://api.kilo.ai/api/fim/completions"],
|
||||
})
|
||||
})
|
||||
|
||||
@@ -52,6 +52,10 @@ const DIRECT_FIM_ENV: Record<Exclude<FimProvider, "kilo">, string[]> = {
|
||||
}
|
||||
|
||||
function resolveFimTarget(provider?: string, model?: string) {
|
||||
if (!provider || provider === "kilo") {
|
||||
return { provider: "kilo" as const, model: model ?? "mistralai/codestral-2501", urls: [KILO_FIM_URL] }
|
||||
}
|
||||
|
||||
const info = getAutocompleteModel(provider, model)
|
||||
if (info.directProvider === "mistral") {
|
||||
return { provider: "mistral" as const, model: info.requestModel, urls: [MISTRAL_FIM_URL, CODESTRAL_FIM_URL] }
|
||||
@@ -59,7 +63,7 @@ function resolveFimTarget(provider?: string, model?: string) {
|
||||
if (info.directProvider === "inception") {
|
||||
return { provider: "inception" as const, model: info.requestModel, urls: [INCEPTION_FIM_URL] }
|
||||
}
|
||||
return { provider: "kilo" as const, model: info.requestModel, urls: [KILO_FIM_URL] }
|
||||
return { provider: "kilo" as const, model: model ?? "mistralai/codestral-2501", urls: [KILO_FIM_URL] }
|
||||
}
|
||||
|
||||
export const kiloGatewayHandlers = HttpApiBuilder.group(InstanceHttpApi, "kilo", (handlers) =>
|
||||
|
||||
Reference in New Issue
Block a user