fix: undo change that used anthropic messages endpoint for anthropic models on copilot due to ratelimiting issues, go back to completions endpoint instead
This commit is contained in:
@@ -40,22 +40,25 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: re-enable once messages api has higher rate limits
|
||||||
// TODO: move some of this hacky-ness to models.dev presets once we have better grasp of things here...
|
// TODO: move some of this hacky-ness to models.dev presets once we have better grasp of things here...
|
||||||
const base = baseURL ?? model.api.url
|
// const base = baseURL ?? model.api.url
|
||||||
const claude = model.id.includes("claude")
|
// const claude = model.id.includes("claude")
|
||||||
const url = iife(() => {
|
// const url = iife(() => {
|
||||||
if (!claude) return base
|
// if (!claude) return base
|
||||||
if (base.endsWith("/v1")) return base
|
// if (base.endsWith("/v1")) return base
|
||||||
if (base.endsWith("/")) return `${base}v1`
|
// if (base.endsWith("/")) return `${base}v1`
|
||||||
return `${base}/v1`
|
// return `${base}/v1`
|
||||||
})
|
// })
|
||||||
|
|
||||||
model.api.url = url
|
// model.api.url = url
|
||||||
model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"
|
// model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"
|
||||||
|
model.api.npm = "@ai-sdk/github-copilot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
baseURL,
|
||||||
apiKey: "",
|
apiKey: "",
|
||||||
async fetch(request: RequestInfo | URL, init?: RequestInit) {
|
async fetch(request: RequestInfo | URL, init?: RequestInit) {
|
||||||
const info = await getAuth()
|
const info = await getAuth()
|
||||||
|
|||||||
Reference in New Issue
Block a user