chore: cleanup provider code to assign copilot sdk earlier in flow

This commit is contained in:
Aiden Cline
2026-01-19 00:07:07 -06:00
parent 6f847a794b
commit 86df915df0

View File

@@ -601,7 +601,10 @@ export namespace Provider {
api: { api: {
id: model.id, id: model.id,
url: provider.api!, url: provider.api!,
npm: model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible", npm: iife(() => {
if (provider.id.startsWith("github-copilot")) return "@ai-sdk/github-copilot"
return model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible"
}),
}, },
status: model.status ?? "active", status: model.status ?? "active",
headers: model.headers ?? {}, headers: model.headers ?? {},
@@ -908,16 +911,6 @@ export namespace Provider {
continue continue
} }
if (providerID === "github-copilot" || providerID === "github-copilot-enterprise") {
provider.models = mapValues(provider.models, (model) => ({
...model,
api: {
...model.api,
npm: "@ai-sdk/github-copilot",
},
}))
}
const configProvider = config.provider?.[providerID] const configProvider = config.provider?.[providerID]
for (const [modelID, model] of Object.entries(provider.models)) { for (const [modelID, model] of Object.entries(provider.models)) {