mirror of https://github.com/openclaw/openclaw.git
fix: align thinking defaults and plugin sdk exports
This commit is contained in:
parent
1ffe8fde84
commit
fe4368cbca
|
|
@ -1,4 +1,4 @@
|
|||
import { resolveThinkingDefaultForModel } from "../auto-reply/thinking.js";
|
||||
import { resolveThinkingDefaultForModel } from "../auto-reply/thinking.shared.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
resolveAgentModelFallbackValues,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ export type ThinkingCatalogEntry = {
|
|||
};
|
||||
|
||||
const BASE_THINKING_LEVELS: ThinkLevel[] = ["off", "minimal", "low", "medium", "high", "adaptive"];
|
||||
const ANTHROPIC_CLAUDE_46_MODEL_RE = /^claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
|
||||
const AMAZON_BEDROCK_CLAUDE_46_MODEL_RE = /claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
|
||||
|
||||
export function normalizeProviderId(provider?: string | null): string {
|
||||
if (!provider) {
|
||||
|
|
@ -101,6 +103,14 @@ export function resolveThinkingDefaultForModel(params: {
|
|||
model: string;
|
||||
catalog?: ThinkingCatalogEntry[];
|
||||
}): ThinkLevel {
|
||||
const normalizedProvider = normalizeProviderId(params.provider);
|
||||
const modelId = params.model.trim();
|
||||
if (normalizedProvider === "anthropic" && ANTHROPIC_CLAUDE_46_MODEL_RE.test(modelId)) {
|
||||
return "adaptive";
|
||||
}
|
||||
if (normalizedProvider === "amazon-bedrock" && AMAZON_BEDROCK_CLAUDE_46_MODEL_RE.test(modelId)) {
|
||||
return "adaptive";
|
||||
}
|
||||
const candidate = params.catalog?.find(
|
||||
(entry) => entry.provider === params.provider && entry.id === params.model,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import os from "node:os";
|
|||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseModelRef } from "../agents/model-selection.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { clearRuntimeConfigSnapshot, loadConfig } from "../config/config.js";
|
||||
import { isTruthyEnvValue } from "../infra/env.js";
|
||||
import { getFreePortBlockWithPermissionFallback } from "../test-utils/ports.js";
|
||||
import { GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
|
||||
|
|
@ -166,6 +166,7 @@ async function connectClient(params: { url: string; token: string }) {
|
|||
|
||||
describeLive("gateway live (cli backend)", () => {
|
||||
it("runs the agent pipeline against the local CLI backend", async () => {
|
||||
clearRuntimeConfigSnapshot();
|
||||
const previous = {
|
||||
configPath: process.env.OPENCLAW_CONFIG_PATH,
|
||||
token: process.env.OPENCLAW_GATEWAY_TOKEN,
|
||||
|
|
@ -384,6 +385,7 @@ describeLive("gateway live (cli backend)", () => {
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
clearRuntimeConfigSnapshot();
|
||||
client.stop();
|
||||
await server.close();
|
||||
await fs.rm(tempDir, { recursive: true, force: true });
|
||||
|
|
|
|||
|
|
@ -797,21 +797,21 @@ export {
|
|||
SELF_HOSTED_DEFAULT_CONTEXT_WINDOW,
|
||||
SELF_HOSTED_DEFAULT_COST,
|
||||
SELF_HOSTED_DEFAULT_MAX_TOKENS,
|
||||
} from "../commands/self-hosted-provider-setup.js";
|
||||
} from "../commands/self-hosted-provider-setup.ts";
|
||||
export {
|
||||
OLLAMA_DEFAULT_BASE_URL,
|
||||
OLLAMA_DEFAULT_MODEL,
|
||||
configureOllamaNonInteractive,
|
||||
ensureOllamaModelPulled,
|
||||
promptAndConfigureOllama,
|
||||
} from "../commands/ollama-setup.js";
|
||||
} from "../commands/ollama-setup.ts";
|
||||
export {
|
||||
VLLM_DEFAULT_BASE_URL,
|
||||
VLLM_DEFAULT_CONTEXT_WINDOW,
|
||||
VLLM_DEFAULT_COST,
|
||||
VLLM_DEFAULT_MAX_TOKENS,
|
||||
promptAndConfigureVllm,
|
||||
} from "../commands/vllm-setup.js";
|
||||
} from "../commands/vllm-setup.ts";
|
||||
export {
|
||||
buildOllamaProvider,
|
||||
buildSglangProvider,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ export {
|
|||
configureOllamaNonInteractive,
|
||||
ensureOllamaModelPulled,
|
||||
promptAndConfigureOllama,
|
||||
} from "../commands/ollama-setup.js";
|
||||
} from "../commands/ollama-setup.ts";
|
||||
|
||||
export { buildOllamaProvider } from "../agents/models-config.providers.discovery.js";
|
||||
|
|
|
|||
|
|
@ -15,21 +15,21 @@ export {
|
|||
SELF_HOSTED_DEFAULT_CONTEXT_WINDOW,
|
||||
SELF_HOSTED_DEFAULT_COST,
|
||||
SELF_HOSTED_DEFAULT_MAX_TOKENS,
|
||||
} from "../commands/self-hosted-provider-setup.js";
|
||||
} from "../commands/self-hosted-provider-setup.ts";
|
||||
export {
|
||||
OLLAMA_DEFAULT_BASE_URL,
|
||||
OLLAMA_DEFAULT_MODEL,
|
||||
configureOllamaNonInteractive,
|
||||
ensureOllamaModelPulled,
|
||||
promptAndConfigureOllama,
|
||||
} from "../commands/ollama-setup.js";
|
||||
} from "../commands/ollama-setup.ts";
|
||||
export {
|
||||
VLLM_DEFAULT_BASE_URL,
|
||||
VLLM_DEFAULT_CONTEXT_WINDOW,
|
||||
VLLM_DEFAULT_COST,
|
||||
VLLM_DEFAULT_MAX_TOKENS,
|
||||
promptAndConfigureVllm,
|
||||
} from "../commands/vllm-setup.js";
|
||||
} from "../commands/vllm-setup.ts";
|
||||
export {
|
||||
buildOllamaProvider,
|
||||
buildSglangProvider,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export {
|
|||
SELF_HOSTED_DEFAULT_CONTEXT_WINDOW,
|
||||
SELF_HOSTED_DEFAULT_COST,
|
||||
SELF_HOSTED_DEFAULT_MAX_TOKENS,
|
||||
} from "../commands/self-hosted-provider-setup.js";
|
||||
} from "../commands/self-hosted-provider-setup.ts";
|
||||
|
||||
export {
|
||||
buildSglangProvider,
|
||||
|
|
|
|||
Loading…
Reference in New Issue