Fix vercel gateway thinking and model list (#7196)

This commit is contained in:
Saoud Rizwan authored and GitHub committed 2025-11-05 12:43:44 -08:00
1 parent aaa3846b82
commit 515b4e5d6a
16 files changed
+97 -304

No files matched your search

-11
View File
@@ -764,17 +764,6 @@ export class Controller {
return undefined
}
// Read Vercel AI Gateway models from disk cache
async readVercelAiGatewayModels(): Promise<Record<string, ModelInfo> | undefined> {
const vercelAiGatewayModelsFilePath = path.join(await ensureCacheDirectoryExists(), GlobalFileNames.vercelAiGatewayModels)
const fileExists = await fileExistsAtPath(vercelAiGatewayModelsFilePath)
if (fileExists) {
const fileContents = await fs.readFile(vercelAiGatewayModelsFilePath, "utf8")
return JSON.parse(fileContents)
}
return undefined
}
// Task history
async getTaskWithId(id: string): Promise<{
@@ -9,7 +9,6 @@ import { refreshBasetenModels } from "../models/refreshBasetenModels"
import { refreshGroqModels } from "../models/refreshGroqModels"
import { refreshHicapModels } from "../models/refreshHicapModels"
import { refreshOpenRouterModels } from "../models/refreshOpenRouterModels"
import { refreshVercelAiGatewayModels } from "../models/refreshVercelAiGatewayModels"
import { sendOpenRouterModelsEvent } from "../models/subscribeToOpenRouterModels"
/**
@@ -152,51 +151,6 @@ export async function initializeWebview(controller: Controller, _request: EmptyR
}
})
// Refresh Vercel AI Gateway models from API
refreshVercelAiGatewayModels(controller).then(async (models) => {
if (models && Object.keys(models).length > 0) {
// Update model info in state for Vercel AI Gateway (this needs to be done here since we don't want to update state while settings is open, and we may refresh models there)
const apiConfiguration = controller.stateManager.getApiConfiguration()
const planActSeparateModelsSetting = controller.stateManager.getGlobalSettingsKey("planActSeparateModelsSetting")
const currentMode = controller.stateManager.getGlobalSettingsKey("mode")
if (planActSeparateModelsSetting) {
// Separate models: update only current mode
const modelIdField =
currentMode === "plan" ? "planModeVercelAiGatewayModelId" : "actModeVercelAiGatewayModelId"
const modelInfoField =
currentMode === "plan" ? "planModeVercelAiGatewayModelInfo" : "actModeVercelAiGatewayModelInfo"
const modelId = apiConfiguration[modelIdField]
if (modelId && models[modelId]) {
controller.stateManager.setGlobalState(modelInfoField, models[modelId])
await controller.postStateToWebview()
}
} else {
// Shared models: update both plan and act modes
const planModelId = apiConfiguration.planModeVercelAiGatewayModelId
const actModelId = apiConfiguration.actModeVercelAiGatewayModelId
const updates: Partial<GlobalStateAndSettings> = {}
// Update plan mode model info if we have a model ID
if (planModelId && models[planModelId]) {
updates.planModeVercelAiGatewayModelInfo = models[planModelId]
}
// Update act mode model info if we have a model ID
if (actModelId && models[actModelId]) {
updates.actModeVercelAiGatewayModelInfo = models[actModelId]
}
// Post state update if we updated any model info
if (Object.keys(updates).length > 0) {
controller.stateManager.setGlobalStateBatch(updates)
await controller.postStateToWebview()
}
}
}
})
// Refresh Hicap models from API
refreshHicapModels(controller, EmptyRequest.create()).then(async (response) => {
if (response && response.models) {