2
0
Kevin van Dijk 4 сар өмнө
parent
commit
bcb5a3aa2b

+ 7 - 1
packages/types/src/provider-settings.ts

@@ -44,6 +44,7 @@ export const dynamicProviders = [
 	"vercel-ai-gateway",
 	"huggingface",
 	"litellm",
+	"kilocode-openrouter",
 	"deepinfra",
 	"io-intelligence",
 	"requesty",
@@ -133,8 +134,8 @@ export const providerNames = [
 	"moonshot",
 	"openai-native",
 	"qwen-code",
+	"roo",
 	// kilocode_change start
-	// "roo",
 	"kilocode",
 	"gemini-cli",
 	"virtual-quota-fallback",
@@ -582,6 +583,7 @@ export const modelIdKeys = [
 	"ioIntelligenceModelId",
 	"vercelAiGatewayModelId",
 	"deepInfraModelId",
+	"kilocodeModel",
 ] as const satisfies readonly (keyof ProviderSettings)[]
 
 export type ModelIdKey = (typeof modelIdKeys)[number]
@@ -605,6 +607,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
 	"claude-code": "apiModelId",
 	glama: "glamaModelId",
 	openrouter: "openRouterModelId",
+	"kilocode-openrouter": "openRouterModelId",
 	bedrock: "apiModelId",
 	vertex: "apiModelId",
 	"openai-native": "openAiModelId",
@@ -633,6 +636,8 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
 	"io-intelligence": "ioIntelligenceModelId",
 	roo: "apiModelId",
 	"vercel-ai-gateway": "vercelAiGatewayModelId",
+	kilocode: "kilocodeModel",
+	"virtual-quota-fallback": "apiModelId",
 }
 
 /**
@@ -760,6 +765,7 @@ export const MODELS_BY_PROVIDER: Record<
 
 	// kilocode_change start
 	kilocode: { id: "kilocode", label: "Kilocode", models: [] },
+	"kilocode-openrouter": { id: "kilocode-openrouter", label: "Kilocode", models: [] }, // temporarily needed to satisfy because we're using 2 inconsistent names apparently
 	"virtual-quota-fallback": { id: "virtual-quota-fallback", label: "Virtual Quota Fallback", models: [] },
 	// kilocode_change end
 	deepinfra: { id: "deepinfra", label: "DeepInfra", models: [] },

+ 1 - 1
src/api/index.ts

@@ -181,7 +181,7 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
 		case "vercel-ai-gateway":
 			return new VercelAiGatewayHandler(options)
 		default:
-			apiProvider satisfies "gemini-cli" | undefined
+			apiProvider satisfies "gemini-cli" | "kilocode-openrouter" | undefined
 			return new AnthropicHandler(options)
 	}
 }

+ 1 - 0
webview-ui/src/components/kilocode/hooks/__tests__/getModelsByProvider.spec.ts

@@ -26,6 +26,7 @@ describe("getModelsByProvider", () => {
 			"io-intelligence": { "test-model": testModel },
 			deepinfra: { "test-model": testModel },
 			"vercel-ai-gateway": { "test-model": testModel },
+			huggingface: { "test-model": testModel },
 		}
 
 		const exceptions = [

+ 7 - 1
webview-ui/src/components/ui/hooks/useSelectedModel.ts

@@ -439,7 +439,13 @@ function getSelectedModel({
 		// case "human-relay":
 		// case "fake-ai":
 		default: {
-			provider satisfies "anthropic" | "gemini-cli" | "qwen-code" | "human-relay" | "fake-ai"
+			provider satisfies
+				| "anthropic"
+				| "gemini-cli"
+				| "qwen-code"
+				| "human-relay"
+				| "fake-ai"
+				| "kilocode-openrouter"
 			const id = apiConfiguration.apiModelId ?? anthropicDefaultModelId
 			const baseInfo = anthropicModels[id as keyof typeof anthropicModels]