Skip to content

Commit d5a5bab

Browse files
authored
Merge branch 'main' into beatlevic/fetch-openrouter-models-for-org
2 parents 65aecff + 5614648 commit d5a5bab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+222
-388
lines changed

.changeset/angry-fans-mix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Kilo Code provider now falls back to the default model when the selected model no longer exists

.changeset/giant-eyes-approve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Improvements to German language translation

.changeset/good-chicken-yell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Show message when Virtual Quota Fallback Provider switches profiles

.changeset/shaggy-mails-study.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Changed the API domain for the Kilo Code provider

.changeset/unlucky-knives-cheer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
The Kilo Code API Provider settings now also shows the average cost per request in addition to the average cost per million tokens for a particular model.

packages/telemetry/src/PostHogTelemetryClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class PostHogTelemetryClient extends BaseTelemetryClient {
129129
}
130130
const id = ++this.counter
131131
try {
132-
const response = await fetch("https://kilocode.ai/api/profile", {
132+
const response = await fetch("https://api.kilocode.ai/api/profile", {
133133
headers: {
134134
Authorization: `Bearer ${kilocodeToken}`,
135135
"Content-Type": "application/json",

src/api/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import {
4545
} from "./providers"
4646
// kilocode_change start
4747
import { KilocodeOpenrouterHandler } from "./providers/kilocode-openrouter"
48-
import { KilocodeOllamaHandler } from "./providers/kilocode-ollama"
4948
// kilocode_change end
5049
import { NativeOllamaHandler } from "./providers/native-ollama"
5150

@@ -116,7 +115,7 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
116115
case "openai":
117116
return new OpenAiHandler(options)
118117
case "ollama":
119-
return new KilocodeOllamaHandler(options)
118+
return new NativeOllamaHandler(options)
120119
case "lmstudio":
121120
return new LmStudioHandler(options)
122121
case "gemini":

src/api/providers/__tests__/constants.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("DEFAULT_HEADERS", () => {
5353
})
5454
})
5555

56-
it("should have exactly 3 headers", () => {
56+
it("should have exactly 4 headers", () => {
5757
const headerKeys = Object.keys(DEFAULT_HEADERS)
5858
expect(headerKeys).toHaveLength(4)
5959
expect(headerKeys).toEqual(["HTTP-Referer", "X-Title", "X-KiloCode-Version", "User-Agent"])

src/api/providers/__tests__/virtual-quota-fallback-provider.spec.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// npx vitest run src/api/providers/__tests__/virtual-quota-fallback-provider.spec.spec.ts
1+
// npx vitest run src/api/providers/__tests__/virtual-quota-fallback-provider.spec.ts
22

33
// Mock vscode first to avoid import errors
44
vitest.mock("vscode", () => ({
@@ -298,14 +298,12 @@ describe("VirtualQuotaFallbackProvider", () => {
298298

299299
describe("adjustActiveHandler", () => {
300300
beforeEach(() => {
301-
// kilocode_change start
302301
;(mockSettingsManager.getProfile as any).mockImplementation(async ({ id }: { id: string }) => {
303302
if (id === "p1") return { id: "p1", name: "primary-profile" }
304303
if (id === "p2") return { id: "p2", name: "secondary-profile" }
305304
if (id === "p3") return { id: "p3", name: "backup-profile" }
306305
return undefined
307306
})
308-
// kilocode_change end
309307
})
310308
it("should set first handler as active if it is under limit", async () => {
311309
const handler = new VirtualQuotaFallbackHandler({
@@ -505,7 +503,15 @@ describe("VirtualQuotaFallbackProvider", () => {
505503
it("should delegate to the active handler", () => {
506504
const handler = new VirtualQuotaFallbackHandler({} as any)
507505
const getModelMock = vitest.fn().mockReturnValue({ id: "test-model" })
506+
507+
// Set up handler configs to ensure the active handler isn't overridden by our default logic
508+
;(handler as any).handlerConfigs = [
509+
{ handler: { getModel: getModelMock }, profileId: "p1", config: { profileId: "p1" } },
510+
]
511+
512+
// Set the active handler
508513
;(handler as any).activeHandler = { getModel: getModelMock }
514+
;(handler as any).activeProfileId = "p1"
509515

510516
const result = handler.getModel()
511517

@@ -565,17 +571,22 @@ describe("VirtualQuotaFallbackProvider", () => {
565571
profiles: manyProfiles,
566572
} as any)
567573

568-
// The constructor already calls initialize through initializationPromise
569-
// We don't need to call it again, but we need to wait for it to complete
570-
await (handler as any).initializationPromise
574+
// Explicitly call initialize since constructor no longer does this automatically
575+
await handler.initialize()
571576

572577
// Verify that all profiles were processed
573-
// In the current implementation, buildApiHandler is called for each profile
574-
expect(buildApiHandler).toHaveBeenCalledTimes(1)
578+
// buildApiHandler should be called for each profile
579+
expect(buildApiHandler).toHaveBeenCalledTimes(manyProfiles.length)
575580

576581
// Verify that handler configs were created for all profiles
577582
const handlerConfigs = (handler as any).handlerConfigs
578-
expect(handlerConfigs).toHaveLength(0)
583+
expect(handlerConfigs).toHaveLength(manyProfiles.length)
584+
585+
// Verify each handler config has the correct profileId
586+
handlerConfigs.forEach((config: any, index: number) => {
587+
expect(config.profileId).toBe(manyProfiles[index].profileId)
588+
expect(config.handler.getModel().id).toBe(`${manyProfiles[index].profileId}-model`)
589+
})
579590
})
580591
it("should maintain active handler if it's still valid", async () => {
581592
const handler = new VirtualQuotaFallbackHandler({

src/api/providers/kilocode-ollama.ts

Lines changed: 0 additions & 223 deletions
This file was deleted.

0 commit comments

Comments
 (0)