mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 13:00:22 +00:00
fix: stabilize character eval and Qwen model routing
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user