@@ -8,7 +8,7 @@ import * as path from "path"
88import * as vscode from "vscode"
99import simpleGit from "simple-git"
1010
11- import { ApiConfiguration , ApiProvider , ModelInfo } from "../../shared/api"
11+ import { ApiConfiguration , ApiProvider , ModelInfo , API_CONFIG_KEYS } from "../../shared/api"
1212import { findLast } from "../../shared/array"
1313import { CustomSupportPrompts , supportPrompt } from "../../shared/support-prompt"
1414import { GlobalFileNames } from "../../shared/globalFileNames"
@@ -2114,47 +2114,19 @@ export class ClineProvider implements vscode.WebviewViewProvider {
21142114 }
21152115
21162116 // Build the apiConfiguration object combining state values and secrets
2117+ // Using the dynamic approach with API_CONFIG_KEYS
21172118 const apiConfiguration : ApiConfiguration = {
2118- apiProvider,
2119- apiModelId : stateValues . apiModelId ,
2120- glamaModelId : stateValues . glamaModelId ,
2121- glamaModelInfo : stateValues . glamaModelInfo ,
2122- awsRegion : stateValues . awsRegion ,
2123- awsUseCrossRegionInference : stateValues . awsUseCrossRegionInference ,
2124- awsProfile : stateValues . awsProfile ,
2125- awsUseProfile : stateValues . awsUseProfile ,
2126- vertexProjectId : stateValues . vertexProjectId ,
2127- vertexRegion : stateValues . vertexRegion ,
2128- openAiBaseUrl : stateValues . openAiBaseUrl ,
2129- openAiModelId : stateValues . openAiModelId ,
2130- openAiCustomModelInfo : stateValues . openAiCustomModelInfo ,
2131- openAiUseAzure : stateValues . openAiUseAzure ,
2132- ollamaModelId : stateValues . ollamaModelId ,
2133- ollamaBaseUrl : stateValues . ollamaBaseUrl ,
2134- lmStudioModelId : stateValues . lmStudioModelId ,
2135- lmStudioBaseUrl : stateValues . lmStudioBaseUrl ,
2136- anthropicBaseUrl : stateValues . anthropicBaseUrl ,
2137- modelMaxThinkingTokens : stateValues . modelMaxThinkingTokens ,
2138- mistralCodestralUrl : stateValues . mistralCodestralUrl ,
2139- azureApiVersion : stateValues . azureApiVersion ,
2140- openAiStreamingEnabled : stateValues . openAiStreamingEnabled ,
2141- openRouterModelId : stateValues . openRouterModelId ,
2142- openRouterModelInfo : stateValues . openRouterModelInfo ,
2143- openRouterBaseUrl : stateValues . openRouterBaseUrl ,
2144- openRouterUseMiddleOutTransform : stateValues . openRouterUseMiddleOutTransform ,
2145- vsCodeLmModelSelector : stateValues . vsCodeLmModelSelector ,
2146- unboundModelId : stateValues . unboundModelId ,
2147- unboundModelInfo : stateValues . unboundModelInfo ,
2148- requestyModelId : stateValues . requestyModelId ,
2149- requestyModelInfo : stateValues . requestyModelInfo ,
2150- modelTemperature : stateValues . modelTemperature ,
2151- modelMaxTokens : stateValues . modelMaxTokens ,
2152- lmStudioSpeculativeDecodingEnabled : stateValues . lmStudioSpeculativeDecodingEnabled ,
2153- lmStudioDraftModelId : stateValues . lmStudioDraftModelId ,
2119+ // Dynamically add all API-related keys from stateValues
2120+ ...Object . fromEntries ( API_CONFIG_KEYS . map ( ( key ) => [ key , stateValues [ key ] ] ) ) ,
21542121 // Add all secrets
21552122 ...secretValues ,
21562123 }
21572124
2125+ // Ensure apiProvider is set properly if not already in state
2126+ if ( ! apiConfiguration . apiProvider ) {
2127+ apiConfiguration . apiProvider = apiProvider
2128+ }
2129+
21582130 // Return the same structure as before
21592131 return {
21602132 apiConfiguration,
0 commit comments