Compare commits

...

1 Commits

Author SHA1 Message Date
celestial-vault 24852c4cad get rid of shared apiModelId field 2025-07-20 10:46:54 -07:00
46 changed files with 664 additions and 143 deletions
+34 -2
View File
@@ -232,7 +232,6 @@ message ModelsApiConfiguration {
// Plan mode configurations
optional ApiProvider plan_mode_api_provider = 100;
optional string plan_mode_api_model_id = 101;
optional int32 plan_mode_thinking_budget_tokens = 102;
optional string plan_mode_reasoning_effort = 103;
optional LanguageModelChatSelector plan_mode_vs_code_lm_model_selector = 104;
@@ -255,10 +254,26 @@ message ModelsApiConfiguration {
optional OpenRouterModelInfo plan_mode_groq_model_info = 121;
optional string plan_mode_hugging_face_model_id = 122;
optional OpenRouterModelInfo plan_mode_hugging_face_model_info = 123;
optional string plan_mode_anthropic_model_id = 124;
optional string plan_mode_claude_code_model_id = 125;
optional string plan_mode_vertex_model_id = 126;
optional string plan_mode_gemini_model_id = 127;
optional string plan_mode_openai_native_model_id = 128;
optional string plan_mode_deepseek_model_id = 129;
optional string plan_mode_qwen_model_id = 130;
optional string plan_mode_doubao_model_id = 131;
optional string plan_mode_mistral_model_id = 132;
optional string plan_mode_asksage_model_id = 133;
optional string plan_mode_xai_model_id = 134;
optional string plan_mode_moonshot_model_id = 135;
optional string plan_mode_nebius_model_id = 136;
optional string plan_mode_sambanova_model_id = 137;
optional string plan_mode_cerebras_model_id = 138;
optional string plan_mode_aws_bedrock_model_id = 139;
optional string plan_mode_sapaicore_model_id = 140;
// Act mode configurations
optional ApiProvider act_mode_api_provider = 200;
optional string act_mode_api_model_id = 201;
optional int32 act_mode_thinking_budget_tokens = 202;
optional string act_mode_reasoning_effort = 203;
optional LanguageModelChatSelector act_mode_vs_code_lm_model_selector = 204;
@@ -281,6 +296,23 @@ message ModelsApiConfiguration {
optional OpenRouterModelInfo act_mode_groq_model_info = 221;
optional string act_mode_hugging_face_model_id = 222;
optional OpenRouterModelInfo act_mode_hugging_face_model_info = 223;
optional string act_mode_anthropic_model_id = 224;
optional string act_mode_claude_code_model_id = 225;
optional string act_mode_vertex_model_id = 226;
optional string act_mode_gemini_model_id = 227;
optional string act_mode_openai_native_model_id = 228;
optional string act_mode_deepseek_model_id = 229;
optional string act_mode_qwen_model_id = 230;
optional string act_mode_doubao_model_id = 231;
optional string act_mode_mistral_model_id = 232;
optional string act_mode_asksage_model_id = 233;
optional string act_mode_xai_model_id = 234;
optional string act_mode_moonshot_model_id = 235;
optional string act_mode_nebius_model_id = 236;
optional string act_mode_sambanova_model_id = 237;
optional string act_mode_cerebras_model_id = 238;
optional string act_mode_aws_bedrock_model_id = 239;
optional string act_mode_sapaicore_model_id = 240;
repeated string favorited_model_ids = 300;
}
+44 -2
View File
@@ -174,10 +174,11 @@ message ApiConfiguration {
optional string sap_ai_core_base_url = 53;
optional string moonshot_api_key = 54;
optional string moonshot_api_line = 55;
optional string groq_api_key = 56;
optional string hugging_face_api_key = 57;
// Plan mode configurations
optional string plan_mode_api_provider = 100;
optional string plan_mode_api_model_id = 101;
optional int64 plan_mode_thinking_budget_tokens = 102;
optional string plan_mode_reasoning_effort = 103;
optional string plan_mode_vscode_lm_model_selector = 104; // JSON string
@@ -196,10 +197,30 @@ message ApiConfiguration {
optional string plan_mode_together_model_id = 117;
optional string plan_mode_fireworks_model_id = 118;
optional string plan_mode_sap_ai_core_model_id = 119;
optional string plan_mode_anthropic_model_id = 120;
optional string plan_mode_claude_code_model_id = 121;
optional string plan_mode_vertex_model_id = 122;
optional string plan_mode_gemini_model_id = 123;
optional string plan_mode_openai_native_model_id = 124;
optional string plan_mode_deep_seek_model_id = 125;
optional string plan_mode_qwen_model_id = 126;
optional string plan_mode_doubao_model_id = 127;
optional string plan_mode_mistral_model_id = 128;
optional string plan_mode_asksage_model_id = 129;
optional string plan_mode_xai_model_id = 130;
optional string plan_mode_moonshot_model_id = 131;
optional string plan_mode_nebius_model_id = 132;
optional string plan_mode_sambanova_model_id = 133;
optional string plan_mode_cerebras_model_id = 134;
optional string plan_mode_aws_bedrock_model_id = 135;
optional string plan_mode_groq_model_id = 136;
optional string plan_mode_groq_model_info = 137; // JSON string
optional string plan_mode_hugging_face_model_id = 138;
optional string plan_mode_hugging_face_model_info = 139; // JSON string
optional string plan_mode_sapaicore_model_id = 140;
// Act mode configurations
optional string act_mode_api_provider = 200;
optional string act_mode_api_model_id = 201;
optional int64 act_mode_thinking_budget_tokens = 202;
optional string act_mode_reasoning_effort = 203;
optional string act_mode_vscode_lm_model_selector = 204; // JSON string
@@ -218,6 +239,27 @@ message ApiConfiguration {
optional string act_mode_together_model_id = 217;
optional string act_mode_fireworks_model_id = 218;
optional string act_mode_sap_ai_core_model_id = 219;
optional string act_mode_anthropic_model_id = 220;
optional string act_mode_claude_code_model_id = 221;
optional string act_mode_vertex_model_id = 222;
optional string act_mode_gemini_model_id = 223;
optional string act_mode_openai_native_model_id = 224;
optional string act_mode_deep_seek_model_id = 225;
optional string act_mode_qwen_model_id = 226;
optional string act_mode_doubao_model_id = 227;
optional string act_mode_mistral_model_id = 228;
optional string act_mode_asksage_model_id = 229;
optional string act_mode_xai_model_id = 230;
optional string act_mode_moonshot_model_id = 231;
optional string act_mode_nebius_model_id = 232;
optional string act_mode_sambanova_model_id = 233;
optional string act_mode_cerebras_model_id = 234;
optional string act_mode_aws_bedrock_model_id = 235;
optional string act_mode_groq_model_id = 236;
optional string act_mode_groq_model_info = 237; // JSON string
optional string act_mode_hugging_face_model_id = 238;
optional string act_mode_hugging_face_model_info = 239; // JSON string
optional string act_mode_sapaicore_model_id = 240;
// Favorited model IDs
repeated string favorited_model_ids = 300;
+19 -19
View File
@@ -52,7 +52,7 @@ function createHandlerForProvider(
return new AnthropicHandler({
apiKey: options.apiKey,
anthropicBaseUrl: options.anthropicBaseUrl,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
anthropicModelId: mode === "plan" ? options.planModeAnthropicModelId : options.actModeAnthropicModelId,
thinkingBudgetTokens:
mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens,
})
@@ -68,7 +68,7 @@ function createHandlerForProvider(
})
case "bedrock":
return new AwsBedrockHandler({
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
awsBedrockModelId: mode === "plan" ? options.planModeAwsBedrockModelId : options.actModeAwsBedrockModelId,
awsAccessKey: options.awsAccessKey,
awsSecretKey: options.awsSecretKey,
awsSessionToken: options.awsSessionToken,
@@ -91,7 +91,7 @@ function createHandlerForProvider(
return new VertexHandler({
vertexProjectId: options.vertexProjectId,
vertexRegion: options.vertexRegion,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
vertexModelId: mode === "plan" ? options.planModeVertexModelId : options.actModeVertexModelId,
thinkingBudgetTokens:
mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens,
geminiApiKey: options.geminiApiKey,
@@ -128,19 +128,19 @@ function createHandlerForProvider(
geminiBaseUrl: options.geminiBaseUrl,
thinkingBudgetTokens:
mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
geminiModelId: mode === "plan" ? options.planModeGeminiModelId : options.actModeGeminiModelId,
taskId: options.taskId,
})
case "openai-native":
return new OpenAiNativeHandler({
openAiNativeApiKey: options.openAiNativeApiKey,
reasoningEffort: mode === "plan" ? options.planModeReasoningEffort : options.actModeReasoningEffort,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
openaiNativeModelId: mode === "plan" ? options.planModeOpenAiNativeModelId : options.actModeOpenAiNativeModelId,
})
case "deepseek":
return new DeepSeekHandler({
deepSeekApiKey: options.deepSeekApiKey,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
deepSeekModelId: mode === "plan" ? options.planModeDeepSeekModelId : options.actModeDeepSeekModelId,
})
case "requesty":
return new RequestyHandler({
@@ -167,19 +167,19 @@ function createHandlerForProvider(
return new QwenHandler({
qwenApiKey: options.qwenApiKey,
qwenApiLine: options.qwenApiLine,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
qwenModelId: mode === "plan" ? options.planModeQwenModelId : options.actModeQwenModelId,
thinkingBudgetTokens:
mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens,
})
case "doubao":
return new DoubaoHandler({
doubaoApiKey: options.doubaoApiKey,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
doubaoModelId: mode === "plan" ? options.planModeDoubaoModelId : options.actModeDoubaoModelId,
})
case "mistral":
return new MistralHandler({
mistralApiKey: options.mistralApiKey,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
mistralModelId: mode === "plan" ? options.planModeMistralModelId : options.actModeMistralModelId,
})
case "vscode-lm":
return new VsCodeLmHandler({
@@ -209,10 +209,11 @@ function createHandlerForProvider(
taskId: options.taskId,
})
case "moonshot":
console.log("moonshot", mode === "plan" ? options.planModeMoonshotModelId : options.actModeMoonshotModelId)
return new MoonshotHandler({
moonshotApiKey: options.moonshotApiKey,
moonshotApiLine: options.moonshotApiLine,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
moonshotModelId: mode === "plan" ? options.planModeMoonshotModelId : options.actModeMoonshotModelId,
})
case "huggingface":
return new HuggingFaceHandler({
@@ -224,36 +225,35 @@ function createHandlerForProvider(
case "nebius":
return new NebiusHandler({
nebiusApiKey: options.nebiusApiKey,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
nebiusModelId: mode === "plan" ? options.planModeNebiusModelId : options.actModeNebiusModelId,
})
case "asksage":
return new AskSageHandler({
asksageApiKey: options.asksageApiKey,
asksageApiUrl: options.asksageApiUrl,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
asksageModelId: mode === "plan" ? options.planModeAskSageModelId : options.actModeAskSageModelId,
})
case "xai":
return new XAIHandler({
xaiApiKey: options.xaiApiKey,
reasoningEffort: mode === "plan" ? options.planModeReasoningEffort : options.actModeReasoningEffort,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
xaiModelId: mode === "plan" ? options.planModeXaiModelId : options.actModeXaiModelId,
})
case "sambanova":
return new SambanovaHandler({
sambanovaApiKey: options.sambanovaApiKey,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
sambanovaModelId: mode === "plan" ? options.planModeSambanovaModelId : options.actModeSambanovaModelId,
})
case "cerebras":
return new CerebrasHandler({
cerebrasApiKey: options.cerebrasApiKey,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
cerebrasModelId: mode === "plan" ? options.planModeCerebrasModelId : options.actModeCerebrasModelId,
})
case "groq":
return new GroqHandler({
groqApiKey: options.groqApiKey,
groqModelId: mode === "plan" ? options.planModeGroqModelId : options.actModeGroqModelId,
groqModelInfo: mode === "plan" ? options.planModeGroqModelInfo : options.actModeGroqModelInfo,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
})
case "sapaicore":
return new SapAiCoreHandler({
@@ -262,12 +262,12 @@ function createHandlerForProvider(
sapAiCoreTokenUrl: options.sapAiCoreTokenUrl,
sapAiResourceGroup: options.sapAiResourceGroup,
sapAiCoreBaseUrl: options.sapAiCoreBaseUrl,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
sapAiCoreModelId: mode === "plan" ? options.planModeSapAiCoreModelId : options.actModeSapAiCoreModelId,
})
case "claude-code":
return new ClaudeCodeHandler({
claudeCodePath: options.claudeCodePath,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
claudeCodeModelId: mode === "plan" ? options.planModeClaudeCodeModelId : options.actModeClaudeCodeModelId,
thinkingBudgetTokens:
mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens,
})
@@ -275,7 +275,7 @@ function createHandlerForProvider(
return new AnthropicHandler({
apiKey: options.apiKey,
anthropicBaseUrl: options.anthropicBaseUrl,
apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId,
anthropicModelId: mode === "plan" ? options.planModeAnthropicModelId : options.actModeAnthropicModelId,
thinkingBudgetTokens:
mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens,
})
+5 -5
View File
@@ -203,7 +203,7 @@ describe("AwsBedrockHandler", () => {
})
const mockOptions: ApiHandlerOptions = {
actModeApiModelId: "anthropic.claude-3-7-sonnet-20250219-v1:0",
actModeAwsBedrockModelId: "anthropic.claude-3-7-sonnet-20250219-v1:0",
awsRegion: "us-east-1",
awsAccessKey: "test-key",
awsSecretKey: "test-secret",
@@ -617,7 +617,7 @@ describe("AwsBedrockHandler", () => {
const customOptions: ApiHandlerOptions = {
...mockOptions,
actModeAwsBedrockCustomSelected: true,
actModeApiModelId:
actModeAwsBedrockModelId:
"arn:aws:bedrock:us-west-2:123456789012:custom-model/anthropic.claude-3-5-sonnet-20241022-v2:0/Qk8MMyLmRd",
}
const customHandler = new AwsBedrockHandler(customOptions)
@@ -632,7 +632,7 @@ describe("AwsBedrockHandler", () => {
const customOptions: ApiHandlerOptions = {
...mockOptions,
actModeAwsBedrockCustomSelected: true,
actModeApiModelId: "my-namespace/my-custom-model",
actModeAwsBedrockModelId: "my-namespace/my-custom-model",
}
const customHandler = new AwsBedrockHandler(customOptions)
@@ -681,7 +681,7 @@ describe("AwsBedrockHandler", () => {
const customCrossRegionOptions: ApiHandlerOptions = {
...mockOptions,
actModeAwsBedrockCustomSelected: true,
actModeApiModelId: "arn:aws:bedrock:us-west-2:123456789012:custom-model/my-model",
actModeAwsBedrockModelId: "arn:aws:bedrock:us-west-2:123456789012:custom-model/my-model",
awsUseCrossRegionInference: true,
}
const customCrossRegionHandler = new AwsBedrockHandler(customCrossRegionOptions)
@@ -694,7 +694,7 @@ describe("AwsBedrockHandler", () => {
const ultraThinkOptions: ApiHandlerOptions = {
...mockOptions,
actModeAwsBedrockCustomSelected: true,
actModeApiModelId:
actModeAwsBedrockModelId:
"arn:aws:bedrock:us-west-2:123456789012:custom-model/anthropic.claude-3-5-sonnet-20241022-v2:0/Qk8MMyLmRd",
actModeAwsBedrockCustomModelBaseId: "anthropic.claude-3-5-sonnet-20241022-v2:0",
}
+2 -2
View File
@@ -8,7 +8,7 @@ import { ApiStream } from "../transform/stream"
interface AnthropicHandlerOptions {
apiKey?: string
anthropicBaseUrl?: string
apiModelId?: string
anthropicModelId?: string
thinkingBudgetTokens?: number
}
@@ -237,7 +237,7 @@ export class AnthropicHandler implements ApiHandler {
}
getModel(): { id: AnthropicModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.anthropicModelId
if (modelId && modelId in anthropicModels) {
const id = modelId as AnthropicModelId
return { id, info: anthropicModels[id] }
+2 -2
View File
@@ -7,7 +7,7 @@ import { withRetry } from "../retry"
interface AskSageHandlerOptions {
asksageApiKey?: string
asksageApiUrl?: string
apiModelId?: string
asksageModelId?: string
}
type AskSageRequest = {
@@ -103,7 +103,7 @@ export class AskSageHandler implements ApiHandler {
}
getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.asksageModelId
if (modelId && modelId in askSageModels) {
const id = modelId as AskSageModelId
return { id, info: askSageModels[id] }
+2 -2
View File
@@ -17,7 +17,7 @@ import {
import type { Message, ContentBlock } from "@aws-sdk/client-bedrock-runtime"
interface AwsBedrockHandlerOptions {
apiModelId?: string
awsBedrockModelId?: string
awsAccessKey?: string
awsSecretKey?: string
awsSessionToken?: string
@@ -143,7 +143,7 @@ export class AwsBedrockHandler implements ApiHandler {
}
getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.awsBedrockModelId
if (modelId && modelId in bedrockModels) {
const id = modelId as BedrockModelId
return { id, info: bedrockModels[id] }
+2 -2
View File
@@ -7,7 +7,7 @@ import { ApiStream } from "@api/transform/stream"
interface CerebrasHandlerOptions {
cerebrasApiKey?: string
apiModelId?: string
cerebrasModelId?: string
}
export class CerebrasHandler implements ApiHandler {
@@ -175,7 +175,7 @@ export class CerebrasHandler implements ApiHandler {
}
getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.cerebrasModelId
if (modelId && modelId in cerebrasModels) {
const id = modelId as CerebrasModelId
return { id, info: cerebrasModels[id] }
+2 -2
View File
@@ -8,7 +8,7 @@ import { filterMessagesForClaudeCode } from "@/integrations/claude-code/message-
interface ClaudeCodeHandlerOptions {
claudeCodePath?: string
apiModelId?: string
claudeCodeModelId?: string
thinkingBudgetTokens?: number
}
@@ -143,7 +143,7 @@ export class ClaudeCodeHandler implements ApiHandler {
}
getModel() {
const modelId = this.options.apiModelId
const modelId = this.options.claudeCodeModelId
if (modelId && modelId in claudeCodeModels) {
const id = modelId as ClaudeCodeModelId
return { id, info: claudeCodeModels[id] }
+2 -2
View File
@@ -10,7 +10,7 @@ import { convertToR1Format } from "../transform/r1-format"
interface DeepSeekHandlerOptions {
deepSeekApiKey?: string
apiModelId?: string
deepSeekModelId?: string
}
export class DeepSeekHandler implements ApiHandler {
@@ -119,7 +119,7 @@ export class DeepSeekHandler implements ApiHandler {
}
getModel(): { id: DeepSeekModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.deepSeekModelId
if (modelId && modelId in deepSeekModels) {
const id = modelId as DeepSeekModelId
return { id, info: deepSeekModels[id] }
+2 -2
View File
@@ -8,7 +8,7 @@ import { withRetry } from "../retry"
interface DoubaoHandlerOptions {
doubaoApiKey?: string
apiModelId?: string
doubaoModelId?: string
}
export class DoubaoHandler implements ApiHandler {
@@ -36,7 +36,7 @@ export class DoubaoHandler implements ApiHandler {
}
getModel(): { id: DoubaoModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.doubaoModelId
if (modelId && modelId in doubaoModels) {
const id = modelId as DoubaoModelId
return { id, info: doubaoModels[id] }
+2 -2
View File
@@ -19,7 +19,7 @@ interface GeminiHandlerOptions {
geminiApiKey?: string
geminiBaseUrl?: string
thinkingBudgetTokens?: number
apiModelId?: string
geminiModelId?: string
taskId?: string
}
@@ -353,7 +353,7 @@ export class GeminiHandler implements ApiHandler {
* Get the model ID and info for the current configuration
*/
getModel(): { id: GeminiModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.geminiModelId
if (modelId && modelId in geminiModels) {
const id = modelId as GeminiModelId
return { id, info: geminiModels[id] }
+1 -2
View File
@@ -11,7 +11,6 @@ interface GroqHandlerOptions {
groqApiKey?: string
groqModelId?: string
groqModelInfo?: ModelInfo
apiModelId?: string // For backward compatibility
}
// Model family definitions for enhanced behavior
@@ -267,7 +266,7 @@ export class GroqHandler implements ApiHandler {
}
// Third priority: apiModelId (for backward compatibility)
const apiModelId = this.options.apiModelId
const apiModelId = this.options.groqModelId
if (apiModelId && apiModelId in groqModels) {
const id = apiModelId as GroqModelId
return { id, info: groqModels[id] }
+2 -2
View File
@@ -8,7 +8,7 @@ import { ApiStream } from "../transform/stream"
interface MistralHandlerOptions {
mistralApiKey?: string
apiModelId?: string
mistralModelId?: string
}
export class MistralHandler implements ApiHandler {
@@ -82,7 +82,7 @@ export class MistralHandler implements ApiHandler {
}
getModel(): { id: MistralModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.mistralModelId
if (modelId && modelId in mistralModels) {
const id = modelId as MistralModelId
return { id, info: mistralModels[id] }
+2 -2
View File
@@ -9,7 +9,7 @@ import { ModelInfo, MoonshotModelId, moonshotModels, moonshotDefaultModelId } fr
interface MoonshotHandlerOptions {
moonshotApiKey?: string
moonshotApiLine?: string
apiModelId?: string
moonshotModelId?: string
}
export class MoonshotHandler implements ApiHandler {
@@ -79,7 +79,7 @@ export class MoonshotHandler implements ApiHandler {
}
getModel(): { id: MoonshotModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.moonshotModelId
if (modelId && modelId in moonshotModels) {
const id = modelId as MoonshotModelId
+2 -2
View File
@@ -9,7 +9,7 @@ import { nebiusDefaultModelId, nebiusModels, type ModelInfo, type NebiusModelId
interface NebiusHandlerOptions {
nebiusApiKey?: string
apiModelId?: string
nebiusModelId?: string
}
export class NebiusHandler implements ApiHandler {
@@ -77,7 +77,7 @@ export class NebiusHandler implements ApiHandler {
}
getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.nebiusModelId
if (modelId !== undefined && modelId in nebiusModels) {
return { id: modelId, info: nebiusModels[modelId as NebiusModelId] }
+2 -2
View File
@@ -11,7 +11,7 @@ import type { ChatCompletionReasoningEffort } from "openai/resources/chat/comple
interface OpenAiNativeHandlerOptions {
openAiNativeApiKey?: string
reasoningEffort?: string
apiModelId?: string
openaiNativeModelId?: string
}
export class OpenAiNativeHandler implements ApiHandler {
@@ -132,7 +132,7 @@ export class OpenAiNativeHandler implements ApiHandler {
}
getModel(): { id: OpenAiNativeModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.openaiNativeModelId
if (modelId && modelId in openAiNativeModels) {
const id = modelId as OpenAiNativeModelId
return { id, info: openAiNativeModels[id] }
+2 -2
View File
@@ -18,7 +18,7 @@ import { withRetry } from "../retry"
interface QwenHandlerOptions {
qwenApiKey?: string
qwenApiLine?: string
apiModelId?: string
qwenModelId?: string
thinkingBudgetTokens?: number
}
@@ -51,7 +51,7 @@ export class QwenHandler implements ApiHandler {
}
getModel(): { id: MainlandQwenModelId | InternationalQwenModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.qwenModelId
// Branch based on API line to let poor typescript know what to do
if (this.options.qwenApiLine === "china") {
return {
+2 -2
View File
@@ -9,7 +9,7 @@ import { convertToR1Format } from "@api/transform/r1-format"
interface SambanovaHandlerOptions {
sambanovaApiKey?: string
apiModelId?: string
sambanovaModelId?: string
}
export class SambanovaHandler implements ApiHandler {
@@ -81,7 +81,7 @@ export class SambanovaHandler implements ApiHandler {
}
getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.sambanovaModelId
if (modelId && modelId in sambanovaModels) {
const id = modelId as SambanovaModelId
return { id, info: sambanovaModels[id] }
+2 -2
View File
@@ -12,7 +12,7 @@ interface SapAiCoreHandlerOptions {
sapAiCoreTokenUrl?: string
sapAiResourceGroup?: string
sapAiCoreBaseUrl?: string
apiModelId?: string
sapAiCoreModelId?: string
}
interface Deployment {
@@ -574,7 +574,7 @@ export class SapAiCoreHandler implements ApiHandler {
}
getModel(): { id: SapAiCoreModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.sapAiCoreModelId
if (modelId && modelId in sapAiCoreModels) {
const id = modelId as SapAiCoreModelId
return { id, info: sapAiCoreModels[id] }
+2 -2
View File
@@ -9,7 +9,7 @@ import { GeminiHandler } from "./gemini"
interface VertexHandlerOptions {
vertexProjectId?: string
vertexRegion?: string
apiModelId?: string
vertexModelId?: string
thinkingBudgetTokens?: number
geminiApiKey?: string
geminiBaseUrl?: string
@@ -264,7 +264,7 @@ export class VertexHandler implements ApiHandler {
}
getModel(): { id: VertexModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.vertexModelId
if (modelId && modelId in vertexModels) {
const id = modelId as VertexModelId
return { id, info: vertexModels[id] }
+2 -8
View File
@@ -11,13 +11,7 @@ import { shouldSkipReasoningForModel } from "@utils/model-utils"
interface XAIHandlerOptions {
xaiApiKey?: string
reasoningEffort?: string
apiModelId?: string
}
interface XAIHandlerOptions {
xaiApiKey?: string
reasoningEffort?: string
apiModelId?: string
xaiModelId?: string
}
export class XAIHandler implements ApiHandler {
@@ -102,7 +96,7 @@ export class XAIHandler implements ApiHandler {
}
getModel(): { id: XAIModelId; info: ModelInfo } {
const modelId = this.options.apiModelId
const modelId = this.options.xaiModelId
if (modelId && modelId in xaiModels) {
const id = modelId as XAIModelId
return { id, info: xaiModels[id] }
+32 -2
View File
@@ -87,7 +87,22 @@ export type GlobalStateKey =
| "mode"
// Plan mode configurations
| "planModeApiProvider"
| "planModeApiModelId"
| "planModeAnthropicModelId"
| "planModeClaudeCodeModelId"
| "planModeAwsBedrockModelId"
| "planModeVertexModelId"
| "planModeGeminiModelId"
| "planModeOpenAiNativeModelId"
| "planModeDeepSeekModelId"
| "planModeQwenModelId"
| "planModeDoubaoModelId"
| "planModeMistralModelId"
| "planModeAskSageModelId"
| "planModeXaiModelId"
| "planModeMoonshotModelId"
| "planModeNebiusModelId"
| "planModeSambanovaModelId"
| "planModeCerebrasModelId"
| "planModeThinkingBudgetTokens"
| "planModeReasoningEffort"
| "planModeVsCodeLmModelSelector"
@@ -112,7 +127,22 @@ export type GlobalStateKey =
| "planModeHuggingFaceModelInfo"
// Act mode configurations
| "actModeApiProvider"
| "actModeApiModelId"
| "actModeAnthropicModelId"
| "actModeClaudeCodeModelId"
| "actModeAwsBedrockModelId"
| "actModeVertexModelId"
| "actModeGeminiModelId"
| "actModeOpenAiNativeModelId"
| "actModeDeepSeekModelId"
| "actModeQwenModelId"
| "actModeDoubaoModelId"
| "actModeMistralModelId"
| "actModeAskSageModelId"
| "actModeXaiModelId"
| "actModeMoonshotModelId"
| "actModeNebiusModelId"
| "actModeSambanovaModelId"
| "actModeCerebrasModelId"
| "actModeThinkingBudgetTokens"
| "actModeReasoningEffort"
| "actModeVsCodeLmModelSelector"
+150 -10
View File
@@ -279,7 +279,21 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
currentMode,
// Plan mode configurations
planModeApiProvider,
planModeApiModelId,
planModeAnthropicModelId,
planModeClaudeCodeModelId,
planModeVertexModelId,
planModeGeminiModelId,
planModeOpenAiNativeModelId,
planModeDeepSeekModelId,
planModeQwenModelId,
planModeDoubaoModelId,
planModeMistralModelId,
planModeAskSageModelId,
planModeXaiModelId,
planModeMoonshotModelId,
planModeNebiusModelId,
planModeSambanovaModelId,
planModeCerebrasModelId,
planModeThinkingBudgetTokens,
planModeReasoningEffort,
planModeVsCodeLmModelSelector,
@@ -304,7 +318,21 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
planModeHuggingFaceModelInfo,
// Act mode configurations
actModeApiProvider,
actModeApiModelId,
actModeAnthropicModelId,
actModeClaudeCodeModelId,
actModeVertexModelId,
actModeGeminiModelId,
actModeOpenAiNativeModelId,
actModeDeepSeekModelId,
actModeQwenModelId,
actModeDoubaoModelId,
actModeMistralModelId,
actModeAskSageModelId,
actModeXaiModelId,
actModeMoonshotModelId,
actModeNebiusModelId,
actModeSambanovaModelId,
actModeCerebrasModelId,
actModeThinkingBudgetTokens,
actModeReasoningEffort,
actModeVsCodeLmModelSelector,
@@ -332,7 +360,21 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
getGlobalState(context, "mode") as Promise<Mode | undefined>,
// Plan mode configurations
getGlobalState(context, "planModeApiProvider") as Promise<ApiProvider | undefined>,
getGlobalState(context, "planModeApiModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeAnthropicModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeClaudeCodeModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeVertexModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeGeminiModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeOpenAiNativeModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeDeepSeekModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeQwenModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeDoubaoModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeMistralModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeAskSageModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeXaiModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeMoonshotModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeNebiusModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeSambanovaModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeCerebrasModelId") as Promise<string | undefined>,
getGlobalState(context, "planModeThinkingBudgetTokens") as Promise<number | undefined>,
getGlobalState(context, "planModeReasoningEffort") as Promise<string | undefined>,
getGlobalState(context, "planModeVsCodeLmModelSelector") as Promise<vscode.LanguageModelChatSelector | undefined>,
@@ -357,7 +399,21 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
getGlobalState(context, "planModeHuggingFaceModelInfo") as Promise<ModelInfo | undefined>,
// Act mode configurations
getGlobalState(context, "actModeApiProvider") as Promise<ApiProvider | undefined>,
getGlobalState(context, "actModeApiModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeAnthropicModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeClaudeCodeModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeVertexModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeGeminiModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeOpenAiNativeModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeDeepSeekModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeQwenModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeDoubaoModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeMistralModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeAskSageModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeXaiModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeMoonshotModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeNebiusModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeSambanovaModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeCerebrasModelId") as Promise<string | undefined>,
getGlobalState(context, "actModeThinkingBudgetTokens") as Promise<number | undefined>,
getGlobalState(context, "actModeReasoningEffort") as Promise<string | undefined>,
getGlobalState(context, "actModeVsCodeLmModelSelector") as Promise<vscode.LanguageModelChatSelector | undefined>,
@@ -482,7 +538,21 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
huggingFaceApiKey,
// Plan mode configurations
planModeApiProvider: planModeApiProvider || apiProvider,
planModeApiModelId,
planModeAnthropicModelId,
planModeClaudeCodeModelId,
planModeVertexModelId,
planModeGeminiModelId,
planModeOpenAiNativeModelId,
planModeDeepSeekModelId,
planModeQwenModelId,
planModeDoubaoModelId,
planModeMistralModelId,
planModeAskSageModelId,
planModeXaiModelId,
planModeMoonshotModelId,
planModeNebiusModelId,
planModeSambanovaModelId,
planModeCerebrasModelId,
planModeThinkingBudgetTokens,
planModeReasoningEffort,
planModeVsCodeLmModelSelector,
@@ -507,7 +577,21 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
planModeHuggingFaceModelInfo,
// Act mode configurations
actModeApiProvider: actModeApiProvider || apiProvider,
actModeApiModelId,
actModeAnthropicModelId,
actModeClaudeCodeModelId,
actModeVertexModelId,
actModeGeminiModelId,
actModeOpenAiNativeModelId,
actModeDeepSeekModelId,
actModeQwenModelId,
actModeDoubaoModelId,
actModeMistralModelId,
actModeAskSageModelId,
actModeXaiModelId,
actModeMoonshotModelId,
actModeNebiusModelId,
actModeSambanovaModelId,
actModeCerebrasModelId,
actModeThinkingBudgetTokens,
actModeReasoningEffort,
actModeVsCodeLmModelSelector,
@@ -621,7 +705,21 @@ export async function updateApiConfiguration(context: vscode.ExtensionContext, a
huggingFaceApiKey,
// Plan mode configurations
planModeApiProvider,
planModeApiModelId,
planModeAnthropicModelId,
planModeClaudeCodeModelId,
planModeVertexModelId,
planModeGeminiModelId,
planModeOpenAiNativeModelId,
planModeDeepSeekModelId,
planModeQwenModelId,
planModeDoubaoModelId,
planModeMistralModelId,
planModeAskSageModelId,
planModeXaiModelId,
planModeMoonshotModelId,
planModeNebiusModelId,
planModeSambanovaModelId,
planModeCerebrasModelId,
planModeThinkingBudgetTokens,
planModeReasoningEffort,
planModeVsCodeLmModelSelector,
@@ -646,7 +744,21 @@ export async function updateApiConfiguration(context: vscode.ExtensionContext, a
planModeHuggingFaceModelInfo,
// Act mode configurations
actModeApiProvider,
actModeApiModelId,
actModeAnthropicModelId,
actModeClaudeCodeModelId,
actModeVertexModelId,
actModeGeminiModelId,
actModeOpenAiNativeModelId,
actModeDeepSeekModelId,
actModeQwenModelId,
actModeDoubaoModelId,
actModeMistralModelId,
actModeAskSageModelId,
actModeXaiModelId,
actModeMoonshotModelId,
actModeNebiusModelId,
actModeSambanovaModelId,
actModeCerebrasModelId,
actModeThinkingBudgetTokens,
actModeReasoningEffort,
actModeVsCodeLmModelSelector,
@@ -675,7 +787,21 @@ export async function updateApiConfiguration(context: vscode.ExtensionContext, a
const batchedGlobalUpdates = {
// Plan mode configuration updates
planModeApiProvider,
planModeApiModelId,
planModeAnthropicModelId,
planModeClaudeCodeModelId,
planModeVertexModelId,
planModeGeminiModelId,
planModeOpenAiNativeModelId,
planModeDeepSeekModelId,
planModeQwenModelId,
planModeDoubaoModelId,
planModeMistralModelId,
planModeAskSageModelId,
planModeXaiModelId,
planModeMoonshotModelId,
planModeNebiusModelId,
planModeSambanovaModelId,
planModeCerebrasModelId,
planModeThinkingBudgetTokens,
planModeReasoningEffort,
planModeVsCodeLmModelSelector,
@@ -701,7 +827,21 @@ export async function updateApiConfiguration(context: vscode.ExtensionContext, a
// Act mode configuration updates
actModeApiProvider,
actModeApiModelId,
actModeAnthropicModelId,
actModeClaudeCodeModelId,
actModeVertexModelId,
actModeGeminiModelId,
actModeOpenAiNativeModelId,
actModeDeepSeekModelId,
actModeQwenModelId,
actModeDoubaoModelId,
actModeMistralModelId,
actModeAskSageModelId,
actModeXaiModelId,
actModeMoonshotModelId,
actModeNebiusModelId,
actModeSambanovaModelId,
actModeCerebrasModelId,
actModeThinkingBudgetTokens,
actModeReasoningEffort,
actModeVsCodeLmModelSelector,
+32 -3
View File
@@ -94,7 +94,22 @@ export interface ApiHandlerOptions {
sapAiCoreBaseUrl?: string
onRetryAttempt?: (attempt: number, maxRetries: number, delay: number, error: any) => void
// Plan mode configurations
planModeApiModelId?: string
planModeAnthropicModelId?: string
planModeClaudeCodeModelId?: string
planModeAwsBedrockModelId?: string
planModeVertexModelId?: string
planModeGeminiModelId?: string
planModeOpenAiNativeModelId?: string
planModeDeepSeekModelId?: string
planModeQwenModelId?: string
planModeDoubaoModelId?: string
planModeMistralModelId?: string
planModeAskSageModelId?: string
planModeXaiModelId?: string
planModeMoonshotModelId?: string
planModeNebiusModelId?: string
planModeSambanovaModelId?: string
planModeCerebrasModelId?: string
planModeThinkingBudgetTokens?: number
planModeReasoningEffort?: string
planModeVsCodeLmModelSelector?: LanguageModelChatSelector
@@ -118,8 +133,22 @@ export interface ApiHandlerOptions {
planModeHuggingFaceModelId?: string
planModeHuggingFaceModelInfo?: ModelInfo
// Act mode configurations
actModeApiModelId?: string
actModeAnthropicModelId?: string
actModeClaudeCodeModelId?: string
actModeAwsBedrockModelId?: string
actModeVertexModelId?: string
actModeGeminiModelId?: string
actModeOpenAiNativeModelId?: string
actModeDeepSeekModelId?: string
actModeQwenModelId?: string
actModeDoubaoModelId?: string
actModeMistralModelId?: string
actModeAskSageModelId?: string
actModeXaiModelId?: string
actModeMoonshotModelId?: string
actModeNebiusModelId?: string
actModeSambanovaModelId?: string
actModeCerebrasModelId?: string
actModeThinkingBudgetTokens?: number
actModeReasoningEffort?: string
actModeVsCodeLmModelSelector?: LanguageModelChatSelector
@@ -381,7 +381,6 @@ export function convertApiConfigurationToProto(config: ApiConfiguration): ProtoA
// Plan mode configurations
planModeApiProvider: config.planModeApiProvider ? convertApiProviderToProto(config.planModeApiProvider) : undefined,
planModeApiModelId: config.planModeApiModelId,
planModeThinkingBudgetTokens: config.planModeThinkingBudgetTokens,
planModeReasoningEffort: config.planModeReasoningEffort,
planModeVsCodeLmModelSelector: config.planModeVsCodeLmModelSelector,
@@ -404,10 +403,25 @@ export function convertApiConfigurationToProto(config: ApiConfiguration): ProtoA
planModeHuggingFaceModelId: config.planModeHuggingFaceModelId,
planModeHuggingFaceModelInfo: convertModelInfoToProtoOpenRouter(config.planModeHuggingFaceModelInfo),
planModeSapAiCoreModelId: config.planModeSapAiCoreModelId,
planModeAnthropicModelId: config.planModeAnthropicModelId,
planModeClaudeCodeModelId: config.planModeClaudeCodeModelId,
planModeAwsBedrockModelId: config.planModeAwsBedrockModelId,
planModeVertexModelId: config.planModeVertexModelId,
planModeGeminiModelId: config.planModeGeminiModelId,
planModeOpenaiNativeModelId: config.planModeOpenAiNativeModelId,
planModeDeepseekModelId: config.planModeDeepSeekModelId,
planModeQwenModelId: config.planModeQwenModelId,
planModeDoubaoModelId: config.planModeDoubaoModelId,
planModeMistralModelId: config.planModeMistralModelId,
planModeAsksageModelId: config.planModeAskSageModelId,
planModeXaiModelId: config.planModeXaiModelId,
planModeMoonshotModelId: config.planModeMoonshotModelId,
planModeNebiusModelId: config.planModeNebiusModelId,
planModeSambanovaModelId: config.planModeSambanovaModelId,
planModeCerebrasModelId: config.planModeCerebrasModelId,
// Act mode configurations
actModeApiProvider: config.actModeApiProvider ? convertApiProviderToProto(config.actModeApiProvider) : undefined,
actModeApiModelId: config.actModeApiModelId,
actModeThinkingBudgetTokens: config.actModeThinkingBudgetTokens,
actModeReasoningEffort: config.actModeReasoningEffort,
actModeVsCodeLmModelSelector: config.actModeVsCodeLmModelSelector,
@@ -430,6 +444,22 @@ export function convertApiConfigurationToProto(config: ApiConfiguration): ProtoA
actModeHuggingFaceModelId: config.actModeHuggingFaceModelId,
actModeHuggingFaceModelInfo: convertModelInfoToProtoOpenRouter(config.actModeHuggingFaceModelInfo),
actModeSapAiCoreModelId: config.actModeSapAiCoreModelId,
actModeAnthropicModelId: config.actModeAnthropicModelId,
actModeClaudeCodeModelId: config.actModeClaudeCodeModelId,
actModeAwsBedrockModelId: config.actModeAwsBedrockModelId,
actModeVertexModelId: config.actModeVertexModelId,
actModeGeminiModelId: config.actModeGeminiModelId,
actModeOpenaiNativeModelId: config.actModeOpenAiNativeModelId,
actModeDeepseekModelId: config.actModeDeepSeekModelId,
actModeQwenModelId: config.actModeQwenModelId,
actModeDoubaoModelId: config.actModeDoubaoModelId,
actModeMistralModelId: config.actModeMistralModelId,
actModeAsksageModelId: config.actModeAskSageModelId,
actModeXaiModelId: config.actModeXaiModelId,
actModeMoonshotModelId: config.actModeMoonshotModelId,
actModeNebiusModelId: config.actModeNebiusModelId,
actModeSambanovaModelId: config.actModeSambanovaModelId,
actModeCerebrasModelId: config.actModeCerebrasModelId,
// Favorited model IDs
favoritedModelIds: config.favoritedModelIds || [],
@@ -505,7 +535,6 @@ export function convertProtoToApiConfiguration(protoConfig: ProtoApiConfiguratio
protoConfig.planModeApiProvider !== undefined
? convertProtoToApiProvider(protoConfig.planModeApiProvider)
: undefined,
planModeApiModelId: protoConfig.planModeApiModelId,
planModeThinkingBudgetTokens: protoConfig.planModeThinkingBudgetTokens,
planModeReasoningEffort: protoConfig.planModeReasoningEffort,
planModeVsCodeLmModelSelector: protoConfig.planModeVsCodeLmModelSelector,
@@ -528,11 +557,26 @@ export function convertProtoToApiConfiguration(protoConfig: ProtoApiConfiguratio
planModeHuggingFaceModelId: protoConfig.planModeHuggingFaceModelId,
planModeHuggingFaceModelInfo: convertProtoToModelInfo(protoConfig.planModeHuggingFaceModelInfo),
planModeSapAiCoreModelId: protoConfig.planModeSapAiCoreModelId,
planModeAnthropicModelId: protoConfig.planModeAnthropicModelId,
planModeClaudeCodeModelId: protoConfig.planModeClaudeCodeModelId,
planModeAwsBedrockModelId: protoConfig.planModeAwsBedrockModelId,
planModeVertexModelId: protoConfig.planModeVertexModelId,
planModeGeminiModelId: protoConfig.planModeGeminiModelId,
planModeOpenAiNativeModelId: protoConfig.planModeOpenaiNativeModelId,
planModeDeepSeekModelId: protoConfig.planModeDeepseekModelId,
planModeQwenModelId: protoConfig.planModeQwenModelId,
planModeDoubaoModelId: protoConfig.planModeDoubaoModelId,
planModeMistralModelId: protoConfig.planModeMistralModelId,
planModeAskSageModelId: protoConfig.planModeAsksageModelId,
planModeXaiModelId: protoConfig.planModeXaiModelId,
planModeMoonshotModelId: protoConfig.planModeMoonshotModelId,
planModeNebiusModelId: protoConfig.planModeNebiusModelId,
planModeSambanovaModelId: protoConfig.planModeSambanovaModelId,
planModeCerebrasModelId: protoConfig.planModeCerebrasModelId,
// Act mode configurations
actModeApiProvider:
protoConfig.actModeApiProvider !== undefined ? convertProtoToApiProvider(protoConfig.actModeApiProvider) : undefined,
actModeApiModelId: protoConfig.actModeApiModelId,
actModeThinkingBudgetTokens: protoConfig.actModeThinkingBudgetTokens,
actModeReasoningEffort: protoConfig.actModeReasoningEffort,
actModeVsCodeLmModelSelector: protoConfig.actModeVsCodeLmModelSelector,
@@ -555,6 +599,22 @@ export function convertProtoToApiConfiguration(protoConfig: ProtoApiConfiguratio
actModeHuggingFaceModelId: protoConfig.actModeHuggingFaceModelId,
actModeHuggingFaceModelInfo: convertProtoToModelInfo(protoConfig.actModeHuggingFaceModelInfo),
actModeSapAiCoreModelId: protoConfig.actModeSapAiCoreModelId,
actModeAnthropicModelId: protoConfig.actModeAnthropicModelId,
actModeClaudeCodeModelId: protoConfig.actModeClaudeCodeModelId,
actModeAwsBedrockModelId: protoConfig.actModeAwsBedrockModelId,
actModeVertexModelId: protoConfig.actModeVertexModelId,
actModeGeminiModelId: protoConfig.actModeGeminiModelId,
actModeOpenAiNativeModelId: protoConfig.actModeOpenaiNativeModelId,
actModeDeepSeekModelId: protoConfig.actModeDeepseekModelId,
actModeQwenModelId: protoConfig.actModeQwenModelId,
actModeDoubaoModelId: protoConfig.actModeDoubaoModelId,
actModeMistralModelId: protoConfig.actModeMistralModelId,
actModeAskSageModelId: protoConfig.actModeAsksageModelId,
actModeXaiModelId: protoConfig.actModeXaiModelId,
actModeMoonshotModelId: protoConfig.actModeMoonshotModelId,
actModeNebiusModelId: protoConfig.actModeNebiusModelId,
actModeSambanovaModelId: protoConfig.actModeSambanovaModelId,
actModeCerebrasModelId: protoConfig.actModeCerebrasModelId,
// Favorited model IDs
favoritedModelIds:
@@ -73,7 +73,6 @@ export function convertApiConfigurationToProtoApiConfiguration(config: ApiConfig
// Plan mode configurations
planModeApiProvider: config.planModeApiProvider,
planModeApiModelId: config.planModeApiModelId,
planModeThinkingBudgetTokens: config.planModeThinkingBudgetTokens
? Number(config.planModeThinkingBudgetTokens)
: undefined,
@@ -100,10 +99,25 @@ export function convertApiConfigurationToProtoApiConfiguration(config: ApiConfig
planModeTogetherModelId: config.planModeTogetherModelId,
planModeFireworksModelId: config.planModeFireworksModelId,
planModeSapAiCoreModelId: config.planModeSapAiCoreModelId,
planModeAnthropicModelId: config.planModeAnthropicModelId,
planModeClaudeCodeModelId: config.planModeClaudeCodeModelId,
planModeAwsBedrockModelId: config.planModeAwsBedrockModelId,
planModeVertexModelId: config.planModeVertexModelId,
planModeGeminiModelId: config.planModeGeminiModelId,
planModeOpenaiNativeModelId: config.planModeOpenAiNativeModelId,
planModeDeepSeekModelId: config.planModeDeepSeekModelId,
planModeQwenModelId: config.planModeQwenModelId,
planModeDoubaoModelId: config.planModeDoubaoModelId,
planModeMistralModelId: config.planModeMistralModelId,
planModeAskSageModelId: config.planModeAskSageModelId,
planModeXaiModelId: config.planModeXaiModelId,
planModeMoonshotModelId: config.planModeMoonshotModelId,
planModeNebiusModelId: config.planModeNebiusModelId,
planModeSambanovaModelId: config.planModeSambanovaModelId,
planModeCerebrasModelId: config.planModeCerebrasModelId,
// Act mode configurations
actModeApiProvider: config.actModeApiProvider,
actModeApiModelId: config.actModeApiModelId,
actModeThinkingBudgetTokens: config.actModeThinkingBudgetTokens ? Number(config.actModeThinkingBudgetTokens) : undefined,
actModeReasoningEffort: config.actModeReasoningEffort,
actModeVscodeLmModelSelector: config.actModeVsCodeLmModelSelector
@@ -126,6 +140,22 @@ export function convertApiConfigurationToProtoApiConfiguration(config: ApiConfig
actModeTogetherModelId: config.actModeTogetherModelId,
actModeFireworksModelId: config.actModeFireworksModelId,
actModeSapAiCoreModelId: config.actModeSapAiCoreModelId,
actModeAnthropicModelId: config.actModeAnthropicModelId,
actModeClaudeCodeModelId: config.actModeClaudeCodeModelId,
actModeAwsBedrockModelId: config.actModeAwsBedrockModelId,
actModeVertexModelId: config.actModeVertexModelId,
actModeGeminiModelId: config.actModeGeminiModelId,
actModeOpenaiNativeModelId: config.actModeOpenAiNativeModelId,
actModeDeepSeekModelId: config.actModeDeepSeekModelId,
actModeQwenModelId: config.actModeQwenModelId,
actModeDoubaoModelId: config.actModeDoubaoModelId,
actModeMistralModelId: config.actModeMistralModelId,
actModeAskSageModelId: config.actModeAskSageModelId,
actModeXaiModelId: config.actModeXaiModelId,
actModeMoonshotModelId: config.actModeMoonshotModelId,
actModeNebiusModelId: config.actModeNebiusModelId,
actModeSambanovaModelId: config.actModeSambanovaModelId,
actModeCerebrasModelId: config.actModeCerebrasModelId,
// Favorited model IDs
favoritedModelIds: config.favoritedModelIds || [],
@@ -199,7 +229,6 @@ export function convertProtoApiConfigurationToApiConfiguration(protoConfig: Prot
// Plan mode configurations
planModeApiProvider: protoConfig.planModeApiProvider as ApiProvider,
planModeApiModelId: protoConfig.planModeApiModelId,
planModeThinkingBudgetTokens: protoConfig.planModeThinkingBudgetTokens
? Number(protoConfig.planModeThinkingBudgetTokens)
: undefined,
@@ -215,10 +244,25 @@ export function convertProtoApiConfigurationToApiConfiguration(protoConfig: Prot
planModeTogetherModelId: protoConfig.planModeTogetherModelId,
planModeFireworksModelId: protoConfig.planModeFireworksModelId,
planModeSapAiCoreModelId: protoConfig.planModeSapAiCoreModelId,
planModeAnthropicModelId: protoConfig.planModeAnthropicModelId,
planModeClaudeCodeModelId: protoConfig.planModeClaudeCodeModelId,
planModeAwsBedrockModelId: protoConfig.planModeAwsBedrockModelId,
planModeVertexModelId: protoConfig.planModeVertexModelId,
planModeGeminiModelId: protoConfig.planModeGeminiModelId,
planModeOpenAiNativeModelId: protoConfig.planModeOpenaiNativeModelId,
planModeDeepSeekModelId: protoConfig.planModeDeepSeekModelId,
planModeQwenModelId: protoConfig.planModeQwenModelId,
planModeDoubaoModelId: protoConfig.planModeDoubaoModelId,
planModeMistralModelId: protoConfig.planModeMistralModelId,
planModeAskSageModelId: protoConfig.planModeAskSageModelId,
planModeXaiModelId: protoConfig.planModeXaiModelId,
planModeMoonshotModelId: protoConfig.planModeMoonshotModelId,
planModeNebiusModelId: protoConfig.planModeNebiusModelId,
planModeSambanovaModelId: protoConfig.planModeSambanovaModelId,
planModeCerebrasModelId: protoConfig.planModeCerebrasModelId,
// Act mode configurations
actModeApiProvider: protoConfig.actModeApiProvider as ApiProvider,
actModeApiModelId: protoConfig.actModeApiModelId,
actModeThinkingBudgetTokens: protoConfig.actModeThinkingBudgetTokens
? Number(protoConfig.actModeThinkingBudgetTokens)
: undefined,
@@ -234,6 +278,22 @@ export function convertProtoApiConfigurationToApiConfiguration(protoConfig: Prot
actModeTogetherModelId: protoConfig.actModeTogetherModelId,
actModeFireworksModelId: protoConfig.actModeFireworksModelId,
actModeSapAiCoreModelId: protoConfig.actModeSapAiCoreModelId,
actModeAnthropicModelId: protoConfig.actModeAnthropicModelId,
actModeClaudeCodeModelId: protoConfig.actModeClaudeCodeModelId,
actModeAwsBedrockModelId: protoConfig.actModeAwsBedrockModelId,
actModeVertexModelId: protoConfig.actModeVertexModelId,
actModeGeminiModelId: protoConfig.actModeGeminiModelId,
actModeOpenAiNativeModelId: protoConfig.actModeOpenaiNativeModelId,
actModeDeepSeekModelId: protoConfig.actModeDeepSeekModelId,
actModeQwenModelId: protoConfig.actModeQwenModelId,
actModeDoubaoModelId: protoConfig.actModeDoubaoModelId,
actModeMistralModelId: protoConfig.actModeMistralModelId,
actModeAskSageModelId: protoConfig.actModeAskSageModelId,
actModeXaiModelId: protoConfig.actModeXaiModelId,
actModeMoonshotModelId: protoConfig.actModeMoonshotModelId,
actModeNebiusModelId: protoConfig.actModeNebiusModelId,
actModeSambanovaModelId: protoConfig.actModeSambanovaModelId,
actModeCerebrasModelId: protoConfig.actModeCerebrasModelId,
// Favorited model IDs
favoritedModelIds: protoConfig.favoritedModelIds || [],
@@ -1158,7 +1158,6 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
// Function to show error message for unsupported files for drag and drop
const showUnsupportedFileErrorMessage = () => {
// Show error message for unsupported files
setShowUnsupportedFileError(true)
// Clear any existing timer
if (unsupportedFileTimerRef.current) {
@@ -3,7 +3,7 @@ import { ApiKeyField } from "../common/ApiKeyField"
import { BaseUrlField } from "../common/BaseUrlField"
import { ModelSelector } from "../common/ModelSelector"
import { ModelInfoView } from "../common/ModelInfoView"
import { getModeSpecificFields, normalizeApiConfiguration } from "../utils/providerUtils"
import { normalizeApiConfiguration } from "../utils/providerUtils"
import ThinkingBudgetSlider from "../ThinkingBudgetSlider"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { useApiConfigurationHandlers } from "../utils/useApiConfigurationHandlers"
@@ -58,7 +58,7 @@ export const AnthropicProvider = ({ showModelOptions, isPopup, currentMode }: An
selectedModelId={selectedModelId}
onChange={(e) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeAnthropicModelId", act: "actModeAnthropicModelId" },
e.target.value,
currentMode,
)
@@ -52,7 +52,7 @@ export const AskSageProvider = ({ showModelOptions, isPopup, currentMode }: AskS
selectedModelId={selectedModelId}
onChange={(e) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeAskSageModelId", act: "actModeAskSageModelId" },
e.target.value,
currentMode,
)
@@ -216,7 +216,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
handleModeFieldsChange(
{
apiModelId: { plan: "planModeApiModelId", act: "actModeApiModelId" },
awsBedrockModelId: { plan: "planModeAwsBedrockModelId", act: "actModeAwsBedrockModelId" },
awsBedrockCustomSelected: {
plan: "planModeAwsBedrockCustomSelected",
act: "actModeAwsBedrockCustomSelected",
@@ -227,7 +227,7 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
},
},
{
apiModelId: isCustom ? "" : e.target.value,
awsBedrockModelId: isCustom ? "" : e.target.value,
awsBedrockCustomSelected: isCustom,
awsBedrockCustomModelBaseId: bedrockDefaultModelId,
},
@@ -265,10 +265,10 @@ export const BedrockProvider = ({ showModelOptions, isPopup, currentMode }: Bedr
</p>
<DebouncedTextField
id="bedrock-model-input"
initialValue={modeFields.apiModelId || ""}
initialValue={modeFields.awsBedrockModelId || ""}
onChange={(value) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeAwsBedrockModelId", act: "actModeAwsBedrockModelId" },
value,
currentMode,
)
@@ -42,7 +42,7 @@ export const CerebrasProvider = ({ showModelOptions, isPopup, currentMode }: Cer
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeCerebrasModelId", act: "actModeCerebrasModelId" },
e.target.value,
currentMode,
)
@@ -55,7 +55,7 @@ export const ClaudeCodeProvider = ({ showModelOptions, isPopup, currentMode }: C
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeClaudeCodeModelId", act: "actModeClaudeCodeModelId" },
e.target.value,
currentMode,
)
@@ -42,7 +42,7 @@ export const DeepSeekProvider = ({ showModelOptions, isPopup, currentMode }: Dee
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeDeepSeekModelId", act: "actModeDeepSeekModelId" },
e.target.value,
currentMode,
)
@@ -42,7 +42,7 @@ export const DoubaoProvider = ({ showModelOptions, isPopup, currentMode }: Douba
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeDoubaoModelId", act: "actModeDoubaoModelId" },
e.target.value,
currentMode,
)
@@ -54,7 +54,7 @@ export const GeminiProvider = ({ showModelOptions, isPopup, currentMode }: Gemin
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeGeminiModelId", act: "actModeGeminiModelId" },
e.target.value,
currentMode,
)
@@ -42,7 +42,7 @@ export const MistralProvider = ({ showModelOptions, isPopup, currentMode }: Mist
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeMistralModelId", act: "actModeMistralModelId" },
e.target.value,
currentMode,
)
@@ -61,7 +61,7 @@ export const MoonshotProvider = ({ showModelOptions, isPopup, currentMode }: Moo
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeMoonshotModelId", act: "actModeMoonshotModelId" },
e.target.value,
currentMode,
)
@@ -42,7 +42,7 @@ export const NebiusProvider = ({ showModelOptions, isPopup, currentMode }: Nebiu
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeNebiusModelId", act: "actModeNebiusModelId" },
e.target.value,
currentMode,
)
@@ -42,7 +42,7 @@ export const OpenAINativeProvider = ({ showModelOptions, isPopup, currentMode }:
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeOpenAiNativeModelId", act: "actModeOpenAiNativeModelId" },
e.target.value,
currentMode,
)
@@ -87,7 +87,7 @@ export const QwenProvider = ({ showModelOptions, isPopup, currentMode }: QwenPro
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeQwenModelId", act: "actModeQwenModelId" },
e.target.value,
currentMode,
)
@@ -42,7 +42,7 @@ export const SambanovaProvider = ({ showModelOptions, isPopup, currentMode }: Sa
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeSambanovaModelId", act: "actModeSambanovaModelId" },
e.target.value,
currentMode,
)
@@ -101,7 +101,7 @@ export const SapAiCoreProvider = ({ showModelOptions, isPopup, currentMode }: Sa
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeSapAiCoreModelId", act: "actModeSapAiCoreModelId" },
e.target.value,
currentMode,
)
@@ -102,7 +102,7 @@ export const VertexProvider = ({ showModelOptions, isPopup, currentMode }: Verte
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeVertexModelId", act: "actModeVertexModelId" },
e.target.value,
currentMode,
)
@@ -60,7 +60,7 @@ export const XaiProvider = ({ showModelOptions, isPopup, currentMode }: XaiProvi
selectedModelId={selectedModelId}
onChange={(e: any) =>
handleModeFieldChange(
{ plan: "planModeApiModelId", act: "actModeApiModelId" },
{ plan: "planModeXaiModelId", act: "actModeXaiModelId" },
e.target.value,
currentMode,
)
@@ -69,9 +69,8 @@ export function normalizeApiConfiguration(
): NormalizedApiConfig {
const provider =
(currentMode === "plan" ? apiConfiguration?.planModeApiProvider : apiConfiguration?.actModeApiProvider) || "anthropic"
const modelId = currentMode === "plan" ? apiConfiguration?.planModeApiModelId : apiConfiguration?.actModeApiModelId
const getProviderData = (models: Record<string, ModelInfo>, defaultId: string) => {
const getProviderData = (models: Record<string, ModelInfo>, defaultId: string, modelId?: string) => {
let selectedModelId: string
let selectedModelInfo: ModelInfo
if (modelId && modelId in models) {
@@ -90,14 +89,20 @@ export function normalizeApiConfiguration(
switch (provider) {
case "anthropic":
return getProviderData(anthropicModels, anthropicDefaultModelId)
const anthropicModelId =
currentMode === "plan" ? apiConfiguration?.planModeAnthropicModelId : apiConfiguration?.actModeAnthropicModelId
return getProviderData(anthropicModels, anthropicDefaultModelId, anthropicModelId)
case "claude-code":
return getProviderData(claudeCodeModels, claudeCodeDefaultModelId)
const claudeCodeModelId =
currentMode === "plan" ? apiConfiguration?.planModeClaudeCodeModelId : apiConfiguration?.actModeClaudeCodeModelId
return getProviderData(claudeCodeModels, claudeCodeDefaultModelId, claudeCodeModelId)
case "bedrock":
const awsBedrockCustomSelected =
currentMode === "plan"
? apiConfiguration?.planModeAwsBedrockCustomSelected
: apiConfiguration?.actModeAwsBedrockCustomSelected
const bedrockModelId =
currentMode === "plan" ? apiConfiguration?.planModeAwsBedrockModelId : apiConfiguration?.actModeAwsBedrockModelId
if (awsBedrockCustomSelected) {
const baseModelId =
currentMode === "plan"
@@ -105,30 +110,48 @@ export function normalizeApiConfiguration(
: apiConfiguration?.actModeAwsBedrockCustomModelBaseId
return {
selectedProvider: provider,
selectedModelId: modelId || bedrockDefaultModelId,
selectedModelId: bedrockModelId || bedrockDefaultModelId,
selectedModelInfo: (baseModelId && bedrockModels[baseModelId]) || bedrockModels[bedrockDefaultModelId],
}
}
return getProviderData(bedrockModels, bedrockDefaultModelId)
return getProviderData(bedrockModels, bedrockDefaultModelId, bedrockModelId)
case "vertex":
return getProviderData(vertexModels, vertexDefaultModelId)
const vertexModelId =
currentMode === "plan" ? apiConfiguration?.planModeVertexModelId : apiConfiguration?.actModeVertexModelId
return getProviderData(vertexModels, vertexDefaultModelId, vertexModelId)
case "gemini":
return getProviderData(geminiModels, geminiDefaultModelId)
const geminiModelId =
currentMode === "plan" ? apiConfiguration?.planModeGeminiModelId : apiConfiguration?.actModeGeminiModelId
return getProviderData(geminiModels, geminiDefaultModelId, geminiModelId)
case "openai-native":
return getProviderData(openAiNativeModels, openAiNativeDefaultModelId)
const openAiNativeModelId =
currentMode === "plan"
? apiConfiguration?.planModeOpenAiNativeModelId
: apiConfiguration?.actModeOpenAiNativeModelId
return getProviderData(openAiNativeModels, openAiNativeDefaultModelId, openAiNativeModelId)
case "deepseek":
return getProviderData(deepSeekModels, deepSeekDefaultModelId)
const deepSeekModelId =
currentMode === "plan" ? apiConfiguration?.planModeDeepSeekModelId : apiConfiguration?.actModeDeepSeekModelId
return getProviderData(deepSeekModels, deepSeekDefaultModelId, deepSeekModelId)
case "qwen":
const qwenModels = apiConfiguration?.qwenApiLine === "china" ? mainlandQwenModels : internationalQwenModels
const qwenDefaultId =
apiConfiguration?.qwenApiLine === "china" ? mainlandQwenDefaultModelId : internationalQwenDefaultModelId
return getProviderData(qwenModels, qwenDefaultId)
const qwenModelId =
currentMode === "plan" ? apiConfiguration?.planModeQwenModelId : apiConfiguration?.actModeQwenModelId
return getProviderData(qwenModels, qwenDefaultId, qwenModelId)
case "doubao":
return getProviderData(doubaoModels, doubaoDefaultModelId)
const doubaoModelId =
currentMode === "plan" ? apiConfiguration?.planModeDoubaoModelId : apiConfiguration?.actModeDoubaoModelId
return getProviderData(doubaoModels, doubaoDefaultModelId, doubaoModelId)
case "mistral":
return getProviderData(mistralModels, mistralDefaultModelId)
const mistralModelId =
currentMode === "plan" ? apiConfiguration?.planModeMistralModelId : apiConfiguration?.actModeMistralModelId
return getProviderData(mistralModels, mistralDefaultModelId, mistralModelId)
case "asksage":
return getProviderData(askSageModels, askSageDefaultModelId)
const askSageModelId =
currentMode === "plan" ? apiConfiguration?.planModeAskSageModelId : apiConfiguration?.actModeAskSageModelId
return getProviderData(askSageModels, askSageDefaultModelId, askSageModelId)
case "openrouter":
const openRouterModelId =
currentMode === "plan" ? apiConfiguration?.planModeOpenRouterModelId : apiConfiguration?.actModeOpenRouterModelId
@@ -215,9 +238,12 @@ export function normalizeApiConfiguration(
selectedModelInfo: liteLlmModelInfo || liteLlmModelInfoSaneDefaults,
}
case "xai":
return getProviderData(xaiModels, xaiDefaultModelId)
const xaiModelId = currentMode === "plan" ? apiConfiguration?.planModeXaiModelId : apiConfiguration?.actModeXaiModelId
return getProviderData(xaiModels, xaiDefaultModelId, xaiModelId)
case "moonshot":
return getProviderData(moonshotModels, moonshotDefaultModelId)
const moonshotModelId =
currentMode === "plan" ? apiConfiguration?.planModeMoonshotModelId : apiConfiguration?.actModeMoonshotModelId
return getProviderData(moonshotModels, moonshotDefaultModelId, moonshotModelId)
case "huggingface":
const huggingFaceModelId =
currentMode === "plan"
@@ -233,11 +259,17 @@ export function normalizeApiConfiguration(
selectedModelInfo: huggingFaceModelInfo || huggingFaceModels[huggingFaceDefaultModelId],
}
case "nebius":
return getProviderData(nebiusModels, nebiusDefaultModelId)
const nebiusModelId =
currentMode === "plan" ? apiConfiguration?.planModeNebiusModelId : apiConfiguration?.actModeNebiusModelId
return getProviderData(nebiusModels, nebiusDefaultModelId, nebiusModelId)
case "sambanova":
return getProviderData(sambanovaModels, sambanovaDefaultModelId)
const sambanovaModelId =
currentMode === "plan" ? apiConfiguration?.planModeSambanovaModelId : apiConfiguration?.actModeSambanovaModelId
return getProviderData(sambanovaModels, sambanovaDefaultModelId, sambanovaModelId)
case "cerebras":
return getProviderData(cerebrasModels, cerebrasDefaultModelId)
const cerebrasModelId =
currentMode === "plan" ? apiConfiguration?.planModeCerebrasModelId : apiConfiguration?.actModeCerebrasModelId
return getProviderData(cerebrasModels, cerebrasDefaultModelId, cerebrasModelId)
case "groq":
const groqModelId =
currentMode === "plan" ? apiConfiguration?.planModeGroqModelId : apiConfiguration?.actModeGroqModelId
@@ -249,9 +281,13 @@ export function normalizeApiConfiguration(
selectedModelInfo: groqModelInfo || groqModels[groqDefaultModelId],
}
case "sapaicore":
return getProviderData(sapAiCoreModels, sapAiCoreDefaultModelId)
const sapAiCoreModelId =
currentMode === "plan" ? apiConfiguration?.planModeSapAiCoreModelId : apiConfiguration?.actModeSapAiCoreModelId
return getProviderData(sapAiCoreModels, sapAiCoreDefaultModelId, sapAiCoreModelId)
default:
return getProviderData(anthropicModels, anthropicDefaultModelId)
const defaultModelId =
currentMode === "plan" ? apiConfiguration?.planModeAnthropicModelId : apiConfiguration?.actModeAnthropicModelId
return getProviderData(anthropicModels, anthropicDefaultModelId, defaultModelId)
}
}
@@ -266,9 +302,25 @@ export function getModeSpecificFields(apiConfiguration: ApiConfiguration | undef
return {
// Core fields
apiProvider: undefined,
apiModelId: undefined,
// Provider-specific model IDs
anthropicModelId: undefined,
claudeCodeModelId: undefined,
awsBedrockModelId: undefined,
vertexModelId: undefined,
geminiModelId: undefined,
openAiNativeModelId: undefined,
deepSeekModelId: undefined,
qwenModelId: undefined,
doubaoModelId: undefined,
mistralModelId: undefined,
askSageModelId: undefined,
xaiModelId: undefined,
moonshotModelId: undefined,
nebiusModelId: undefined,
sambanovaModelId: undefined,
cerebrasModelId: undefined,
sapAiCoreModelId: undefined,
togetherModelId: undefined,
fireworksModelId: undefined,
lmStudioModelId: undefined,
@@ -302,9 +354,28 @@ export function getModeSpecificFields(apiConfiguration: ApiConfiguration | undef
return {
// Core fields
apiProvider: mode === "plan" ? apiConfiguration.planModeApiProvider : apiConfiguration.actModeApiProvider,
apiModelId: mode === "plan" ? apiConfiguration.planModeApiModelId : apiConfiguration.actModeApiModelId,
// Provider-specific model IDs
anthropicModelId: mode === "plan" ? apiConfiguration.planModeAnthropicModelId : apiConfiguration.actModeAnthropicModelId,
claudeCodeModelId:
mode === "plan" ? apiConfiguration.planModeClaudeCodeModelId : apiConfiguration.actModeClaudeCodeModelId,
awsBedrockModelId:
mode === "plan" ? apiConfiguration.planModeAwsBedrockModelId : apiConfiguration.actModeAwsBedrockModelId,
vertexModelId: mode === "plan" ? apiConfiguration.planModeVertexModelId : apiConfiguration.actModeVertexModelId,
geminiModelId: mode === "plan" ? apiConfiguration.planModeGeminiModelId : apiConfiguration.actModeGeminiModelId,
openAiNativeModelId:
mode === "plan" ? apiConfiguration.planModeOpenAiNativeModelId : apiConfiguration.actModeOpenAiNativeModelId,
deepSeekModelId: mode === "plan" ? apiConfiguration.planModeDeepSeekModelId : apiConfiguration.actModeDeepSeekModelId,
qwenModelId: mode === "plan" ? apiConfiguration.planModeQwenModelId : apiConfiguration.actModeQwenModelId,
doubaoModelId: mode === "plan" ? apiConfiguration.planModeDoubaoModelId : apiConfiguration.actModeDoubaoModelId,
mistralModelId: mode === "plan" ? apiConfiguration.planModeMistralModelId : apiConfiguration.actModeMistralModelId,
askSageModelId: mode === "plan" ? apiConfiguration.planModeAskSageModelId : apiConfiguration.actModeAskSageModelId,
xaiModelId: mode === "plan" ? apiConfiguration.planModeXaiModelId : apiConfiguration.actModeXaiModelId,
moonshotModelId: mode === "plan" ? apiConfiguration.planModeMoonshotModelId : apiConfiguration.actModeMoonshotModelId,
nebiusModelId: mode === "plan" ? apiConfiguration.planModeNebiusModelId : apiConfiguration.actModeNebiusModelId,
sambanovaModelId: mode === "plan" ? apiConfiguration.planModeSambanovaModelId : apiConfiguration.actModeSambanovaModelId,
cerebrasModelId: mode === "plan" ? apiConfiguration.planModeCerebrasModelId : apiConfiguration.actModeCerebrasModelId,
sapAiCoreModelId: mode === "plan" ? apiConfiguration.planModeSapAiCoreModelId : apiConfiguration.actModeSapAiCoreModelId,
togetherModelId: mode === "plan" ? apiConfiguration.planModeTogetherModelId : apiConfiguration.actModeTogetherModelId,
fireworksModelId: mode === "plan" ? apiConfiguration.planModeFireworksModelId : apiConfiguration.actModeFireworksModelId,
lmStudioModelId: mode === "plan" ? apiConfiguration.planModeLmStudioModelId : apiConfiguration.actModeLmStudioModelId,
@@ -446,33 +517,98 @@ export async function syncModeConfigurations(
break
case "bedrock":
updates.planModeApiModelId = sourceFields.apiModelId
updates.actModeApiModelId = sourceFields.apiModelId
updates.planModeAwsBedrockModelId = sourceFields.awsBedrockModelId
updates.actModeAwsBedrockModelId = sourceFields.awsBedrockModelId
updates.planModeAwsBedrockCustomSelected = sourceFields.awsBedrockCustomSelected
updates.actModeAwsBedrockCustomSelected = sourceFields.awsBedrockCustomSelected
updates.planModeAwsBedrockCustomModelBaseId = sourceFields.awsBedrockCustomModelBaseId
updates.actModeAwsBedrockCustomModelBaseId = sourceFields.awsBedrockCustomModelBaseId
break
// Providers that use apiProvider + apiModelId fields
case "anthropic":
updates.planModeAnthropicModelId = sourceFields.anthropicModelId
updates.actModeAnthropicModelId = sourceFields.anthropicModelId
break
case "claude-code":
updates.planModeClaudeCodeModelId = sourceFields.claudeCodeModelId
updates.actModeClaudeCodeModelId = sourceFields.claudeCodeModelId
break
case "vertex":
updates.planModeVertexModelId = sourceFields.vertexModelId
updates.actModeVertexModelId = sourceFields.vertexModelId
break
case "gemini":
updates.planModeGeminiModelId = sourceFields.geminiModelId
updates.actModeGeminiModelId = sourceFields.geminiModelId
break
case "openai-native":
updates.planModeOpenAiNativeModelId = sourceFields.openAiNativeModelId
updates.actModeOpenAiNativeModelId = sourceFields.openAiNativeModelId
break
case "deepseek":
updates.planModeDeepSeekModelId = sourceFields.deepSeekModelId
updates.actModeDeepSeekModelId = sourceFields.deepSeekModelId
break
case "qwen":
updates.planModeQwenModelId = sourceFields.qwenModelId
updates.actModeQwenModelId = sourceFields.qwenModelId
break
case "doubao":
updates.planModeDoubaoModelId = sourceFields.doubaoModelId
updates.actModeDoubaoModelId = sourceFields.doubaoModelId
break
case "mistral":
updates.planModeMistralModelId = sourceFields.mistralModelId
updates.actModeMistralModelId = sourceFields.mistralModelId
break
case "asksage":
updates.planModeAskSageModelId = sourceFields.askSageModelId
updates.actModeAskSageModelId = sourceFields.askSageModelId
break
case "xai":
updates.planModeXaiModelId = sourceFields.xaiModelId
updates.actModeXaiModelId = sourceFields.xaiModelId
break
case "moonshot":
updates.planModeMoonshotModelId = sourceFields.moonshotModelId
updates.actModeMoonshotModelId = sourceFields.moonshotModelId
break
case "nebius":
updates.planModeNebiusModelId = sourceFields.nebiusModelId
updates.actModeNebiusModelId = sourceFields.nebiusModelId
break
case "sambanova":
updates.planModeSambanovaModelId = sourceFields.sambanovaModelId
updates.actModeSambanovaModelId = sourceFields.sambanovaModelId
break
case "cerebras":
updates.planModeCerebrasModelId = sourceFields.cerebrasModelId
updates.actModeCerebrasModelId = sourceFields.cerebrasModelId
break
case "sapaicore":
updates.planModeSapAiCoreModelId = sourceFields.sapAiCoreModelId
updates.actModeSapAiCoreModelId = sourceFields.sapAiCoreModelId
break
default:
updates.planModeApiModelId = sourceFields.apiModelId
updates.actModeApiModelId = sourceFields.apiModelId
// Default to anthropic
updates.planModeAnthropicModelId = sourceFields.anthropicModelId
updates.actModeAnthropicModelId = sourceFields.anthropicModelId
break
}