mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-04 14:22:09 +03:00
fix(plugin): auto-prefix providerId with 'opencode-' for OC 1.17.8+ native gate (#4527)
Integrated into release/v3.8.34 (supersedes #4445)
This commit is contained in:
committed by
GitHub
parent
b04eac3b8d
commit
5887bc3d6a
@@ -240,10 +240,18 @@ export function resolveOmniRoutePluginOptions(
|
||||
opts?: OmniRoutePluginOptions
|
||||
): Required<Pick<OmniRoutePluginOptions, "providerId" | "displayName" | "modelCacheTtl">> &
|
||||
Pick<OmniRoutePluginOptions, "baseURL" | "features"> {
|
||||
const providerId = opts?.providerId ?? OMNIROUTE_PROVIDER_KEY;
|
||||
const rawProviderId = opts?.providerId ?? OMNIROUTE_PROVIDER_KEY;
|
||||
// OC 1.17.8+ native-adapter gate rejects providerID not in
|
||||
// {openai, anthropic, opencode*}. Silently prefix so existing
|
||||
// configs (providerId: "omniroute") keep working.
|
||||
const providerId = rawProviderId.startsWith("opencode-")
|
||||
? rawProviderId
|
||||
: `opencode-${rawProviderId}`;
|
||||
const displayName =
|
||||
opts?.displayName ??
|
||||
(providerId === OMNIROUTE_PROVIDER_KEY ? "OmniRoute" : `OmniRoute (${providerId})`);
|
||||
(providerId === `opencode-${OMNIROUTE_PROVIDER_KEY}`
|
||||
? "OmniRoute"
|
||||
: `OmniRoute (${providerId})`);
|
||||
const modelCacheTtl =
|
||||
typeof opts?.modelCacheTtl === "number" && opts.modelCacheTtl > 0
|
||||
? opts.modelCacheTtl
|
||||
|
||||
Reference in New Issue
Block a user