mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
bump copilot plugin, give better error message for copilot (#4678)
This commit is contained in:
parent
b9b071c744
commit
ac1e2bfd49
4 changed files with 13 additions and 3 deletions
|
|
@ -30,7 +30,7 @@ await Promise.all([
|
|||
fs.mkdir(Global.Path.bin, { recursive: true }),
|
||||
])
|
||||
|
||||
const CACHE_VERSION = "10"
|
||||
const CACHE_VERSION = "11"
|
||||
|
||||
const version = await Bun.file(path.join(Global.Path.cache, "version"))
|
||||
.text()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export namespace Plugin {
|
|||
}
|
||||
const plugins = [...(config.plugin ?? [])]
|
||||
if (!Flag.OPENCODE_DISABLE_DEFAULT_PLUGINS) {
|
||||
plugins.push("opencode-copilot-auth@0.0.5")
|
||||
plugins.push("opencode-copilot-auth@0.0.7")
|
||||
plugins.push("opencode-anthropic-auth@0.0.2")
|
||||
}
|
||||
for (let plugin of plugins) {
|
||||
|
|
|
|||
|
|
@ -272,4 +272,12 @@ export namespace ProviderTransform {
|
|||
|
||||
return schema
|
||||
}
|
||||
|
||||
export function error(providerID: string, message: string) {
|
||||
if (providerID === "github-copilot" && message.includes("The requested model is not supported")) {
|
||||
message +=
|
||||
"\n\nMake sure the model is enabled in your copilot settings: https://github.com/settings/copilot/features"
|
||||
}
|
||||
return message
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { LSP } from "../lsp"
|
|||
import { Snapshot } from "@/snapshot"
|
||||
import { fn } from "@/util/fn"
|
||||
import { Storage } from "@/storage/storage"
|
||||
import { ProviderTransform } from "@/provider/transform"
|
||||
|
||||
export namespace MessageV2 {
|
||||
export const OutputLengthError = NamedError.create("MessageOutputLengthError", z.object({}))
|
||||
|
|
@ -737,9 +738,10 @@ export namespace MessageV2 {
|
|||
{ cause: e },
|
||||
).toObject()
|
||||
case APICallError.isInstance(e):
|
||||
const message = ProviderTransform.error(ctx.providerID, e.message)
|
||||
return new MessageV2.APIError(
|
||||
{
|
||||
message: e.message,
|
||||
message,
|
||||
statusCode: e.statusCode,
|
||||
isRetryable: e.isRetryable,
|
||||
responseHeaders: e.responseHeaders,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue