mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 01:31:08 +00:00
perf(config): isolate model alias defaults policy
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { DEFAULT_CONTEXT_TOKENS } from "../agents/defaults.js";
|
||||
import { normalizeProviderId } from "../agents/model-selection.js";
|
||||
import { normalizeProviderSpecificConfig } from "../agents/models-config.providers.policy.js";
|
||||
import { normalizeProviderId } from "../agents/provider-id.js";
|
||||
import { applyProviderConfigDefaultsWithPlugin } from "../plugins/provider-runtime.js";
|
||||
import { DEFAULT_AGENT_MAX_CONCURRENT, DEFAULT_SUBAGENT_MAX_CONCURRENT } from "./agent-limits.js";
|
||||
import { normalizeTalkConfig } from "./talk.js";
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { DEFAULT_CONTEXT_TOKENS } from "../agents/defaults.js";
|
||||
import { applyModelDefaults } from "./defaults.js";
|
||||
import type { OpenClawConfig } from "./types.js";
|
||||
|
||||
const { normalizeProviderSpecificConfigMock } = vi.hoisted(() => ({
|
||||
normalizeProviderSpecificConfigMock: vi.fn((providerKey: string, provider: unknown) => {
|
||||
if (providerKey !== "anthropic" || !provider || typeof provider !== "object") {
|
||||
return provider;
|
||||
}
|
||||
return { ...(provider as Record<string, unknown>), api: "anthropic-messages" };
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("../agents/models-config.providers.policy.js", () => ({
|
||||
normalizeProviderSpecificConfig: normalizeProviderSpecificConfigMock,
|
||||
}));
|
||||
|
||||
describe("applyModelDefaults", () => {
|
||||
function buildProxyProviderConfig(overrides?: { contextWindow?: number; maxTokens?: number }) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user