mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:30:44 +00:00
fix: canonicalize opencode-go base URL
This commit is contained in:
@@ -2,6 +2,7 @@ import { createOpencodeCatalogApiKeyAuthMethod } from "openclaw/plugin-sdk/openc
|
||||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { PASSTHROUGH_GEMINI_REPLAY_HOOKS } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import { applyOpencodeGoConfig, OPENCODE_GO_DEFAULT_MODEL_REF } from "./api.js";
|
||||
import { normalizeOpencodeGoBaseUrl } from "./provider-catalog.js";
|
||||
|
||||
const PROVIDER_ID = "opencode-go";
|
||||
export default definePluginEntry({
|
||||
@@ -31,6 +32,33 @@ export default definePluginEntry({
|
||||
choiceLabel: "OpenCode Go catalog",
|
||||
}),
|
||||
],
|
||||
normalizeConfig: ({ providerConfig }) => {
|
||||
const normalizedBaseUrl = normalizeOpencodeGoBaseUrl({
|
||||
api: providerConfig.api,
|
||||
baseUrl: providerConfig.baseUrl,
|
||||
});
|
||||
return normalizedBaseUrl && normalizedBaseUrl !== providerConfig.baseUrl
|
||||
? { ...providerConfig, baseUrl: normalizedBaseUrl }
|
||||
: undefined;
|
||||
},
|
||||
normalizeResolvedModel: ({ model }) => {
|
||||
const normalizedBaseUrl = normalizeOpencodeGoBaseUrl({
|
||||
api: model.api,
|
||||
baseUrl: model.baseUrl,
|
||||
});
|
||||
return normalizedBaseUrl && normalizedBaseUrl !== model.baseUrl
|
||||
? { ...model, baseUrl: normalizedBaseUrl }
|
||||
: undefined;
|
||||
},
|
||||
normalizeTransport: ({ api, baseUrl }) => {
|
||||
const normalizedBaseUrl = normalizeOpencodeGoBaseUrl({ api, baseUrl });
|
||||
return normalizedBaseUrl && normalizedBaseUrl !== baseUrl
|
||||
? {
|
||||
api,
|
||||
baseUrl: normalizedBaseUrl,
|
||||
}
|
||||
: undefined;
|
||||
},
|
||||
...PASSTHROUGH_GEMINI_REPLAY_HOOKS,
|
||||
isModernModelRef: () => true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user