Merge PR #582: feat(proxy) — add model name prefix stripping option (by @jay77721, closes #568)

This commit is contained in:
diegosouzapw
2026-03-24 13:27:59 -03:00
2 changed files with 15 additions and 0 deletions

View File

@@ -42,6 +42,8 @@ export const updateSettingsSchema = z.object({
a2aEnabled: z.boolean().optional(),
// CLI Fingerprint compatibility (per-provider)
cliCompatProviders: z.array(z.string().max(100)).optional(),
// Strip provider/model prefix at proxy layer (e.g. "openai/gpt-4" → "gpt-4")
stripModelPrefix: z.boolean().optional(),
// Custom CLI agent definitions for ACP
customAgents: z
.array(

View File

@@ -1,5 +1,6 @@
// Re-export from open-sse with localDb integration
import { getModelAliases, getComboByName, getProviderNodes, getCustomModels } from "@/lib/localDb";
import { getSettings } from "@/lib/localDb";
import {
parseModel,
resolveModelAliasFromMap,
@@ -77,6 +78,18 @@ export async function getModelInfo(modelStr) {
...(apiFormat && { apiFormat }),
};
}
// stripModelPrefix: if enabled, strip provider prefix and re-resolve
// the bare model name using existing heuristics (claude-* → anthropic, etc.)
try {
const settings = await getSettings();
if (settings.stripModelPrefix === true) {
const strippedResult = await getModelInfoCore(parsed.model, getModelAliases);
return { ...strippedResult, extendedContext };
}
} catch {
// If settings read fails, fall through to normal resolution
}
}
if (!parsed.isAlias) {