fix: stabilize character eval and Qwen model routing

This commit is contained in:
Peter Steinberger
2026-04-09 01:04:00 +01:00
parent dc2a0f5b8a
commit 39cc6b7dc7
24 changed files with 748 additions and 101 deletions

View File

@@ -143,7 +143,7 @@ export async function loadModelCatalog(params?: {
if (!provider) {
continue;
}
if (shouldSuppressBuiltInModel({ provider, id })) {
if (shouldSuppressBuiltInModel({ provider, id, config: cfg })) {
continue;
}
const name = normalizeOptionalString(String(entry?.name ?? id)) || id;

View File

@@ -1,19 +1,28 @@
import type { OpenClawConfig } from "../config/config.js";
import { resolveProviderBuiltInModelSuppression } from "../plugins/provider-runtime.js";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
import { normalizeProviderId } from "./provider-id.js";
function resolveBuiltInModelSuppression(params: { provider?: string | null; id?: string | null }) {
function resolveBuiltInModelSuppression(params: {
provider?: string | null;
id?: string | null;
baseUrl?: string | null;
config?: OpenClawConfig;
}) {
const provider = normalizeProviderId(params.provider ?? "");
const modelId = normalizeLowercaseStringOrEmpty(params.id);
if (!provider || !modelId) {
return undefined;
}
return resolveProviderBuiltInModelSuppression({
...(params.config ? { config: params.config } : {}),
env: process.env,
context: {
...(params.config ? { config: params.config } : {}),
env: process.env,
provider,
modelId,
...(params.baseUrl ? { baseUrl: params.baseUrl } : {}),
},
});
}
@@ -21,6 +30,8 @@ function resolveBuiltInModelSuppression(params: { provider?: string | null; id?:
export function shouldSuppressBuiltInModel(params: {
provider?: string | null;
id?: string | null;
baseUrl?: string | null;
config?: OpenClawConfig;
}) {
return resolveBuiltInModelSuppression(params)?.suppress ?? false;
}
@@ -28,6 +39,8 @@ export function shouldSuppressBuiltInModel(params: {
export function buildSuppressedBuiltInModelError(params: {
provider?: string | null;
id?: string | null;
baseUrl?: string | null;
config?: OpenClawConfig;
}): string | undefined {
return resolveBuiltInModelSuppression(params)?.errorMessage;
}

View File

@@ -349,10 +349,17 @@ function resolveExplicitModelWithRegistry(params: {
runtimeHooks?: ProviderRuntimeHooks;
}): { kind: "resolved"; model: Model<Api> } | { kind: "suppressed" } | undefined {
const { provider, modelId, modelRegistry, cfg, agentDir, runtimeHooks } = params;
if (shouldSuppressBuiltInModel({ provider, id: modelId })) {
const providerConfig = resolveConfiguredProviderConfig(cfg, provider);
if (
shouldSuppressBuiltInModel({
provider,
id: modelId,
baseUrl: providerConfig?.baseUrl,
config: cfg,
})
) {
return { kind: "suppressed" };
}
const providerConfig = resolveConfiguredProviderConfig(cfg, provider);
const inlineMatch = findInlineModelMatch({
providers: cfg?.models?.providers ?? {},
provider,