mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 14:20:29 +00:00
refactor(providers): remove core default and usage bias
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Defaults for agent metadata when upstream does not supply them.
|
||||
// Model id uses pi-ai's built-in Anthropic catalog.
|
||||
export const DEFAULT_PROVIDER = "anthropic";
|
||||
export const DEFAULT_MODEL = "claude-opus-4-6";
|
||||
// Keep this aligned with the product-level latest-model baseline.
|
||||
export const DEFAULT_PROVIDER = "openai";
|
||||
export const DEFAULT_MODEL = "gpt-5.4";
|
||||
// Conservative fallback used when model metadata is unavailable.
|
||||
export const DEFAULT_CONTEXT_TOKENS = 200_000;
|
||||
|
||||
@@ -101,8 +101,8 @@ function createProviderWithModelsConfig(provider: string, models: Array<Record<s
|
||||
function resolveConfiguredRefForTest(cfg: Partial<OpenClawConfig>) {
|
||||
return resolveConfiguredModelRef({
|
||||
cfg: cfg as OpenClawConfig,
|
||||
defaultProvider: "anthropic",
|
||||
defaultModel: "claude-opus-4-6",
|
||||
defaultProvider: "openai",
|
||||
defaultModel: "gpt-5.4",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -800,7 +800,7 @@ describe("model-selection", () => {
|
||||
it("should fall back to hardcoded default when no custom providers have models", () => {
|
||||
const cfg = createProviderWithModelsConfig("empty-provider", []);
|
||||
const result = resolveConfiguredRefForTest(cfg);
|
||||
expect(result).toEqual({ provider: "anthropic", model: "claude-opus-4-6" });
|
||||
expect(result).toEqual({ provider: "openai", model: "gpt-5.4" });
|
||||
});
|
||||
|
||||
it("should warn when specified model cannot be resolved and falls back to default", () => {
|
||||
@@ -817,13 +817,13 @@ describe("model-selection", () => {
|
||||
|
||||
const result = resolveConfiguredModelRef({
|
||||
cfg: cfg as OpenClawConfig,
|
||||
defaultProvider: "anthropic",
|
||||
defaultModel: "claude-opus-4-6",
|
||||
defaultProvider: "openai",
|
||||
defaultModel: "gpt-5.4",
|
||||
});
|
||||
|
||||
expect(result).toEqual({ provider: "anthropic", model: "claude-opus-4-6" });
|
||||
expect(result).toEqual({ provider: "openai", model: "gpt-5.4" });
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Falling back to default "anthropic/claude-opus-4-6"'),
|
||||
expect.stringContaining('Falling back to default "openai/gpt-5.4"'),
|
||||
);
|
||||
} finally {
|
||||
warnSpy.mockRestore();
|
||||
@@ -889,10 +889,10 @@ describe("model-selection", () => {
|
||||
expect(resolveAnthropicOpusThinking(cfg)).toBe("adaptive");
|
||||
});
|
||||
|
||||
it("defaults Anthropic Claude 4.6 models to adaptive", () => {
|
||||
it("falls back to low when no provider thinking hook is active", () => {
|
||||
const cfg = {} as OpenClawConfig;
|
||||
|
||||
expect(resolveAnthropicOpusThinking(cfg)).toBe("adaptive");
|
||||
expect(resolveAnthropicOpusThinking(cfg)).toBe("low");
|
||||
|
||||
expect(
|
||||
resolveThinkingDefault({
|
||||
@@ -908,7 +908,7 @@ describe("model-selection", () => {
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toBe("adaptive");
|
||||
).toBe("low");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,8 +81,8 @@ describe("resolveSimpleCompletionSelectionForAgent", () => {
|
||||
const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" });
|
||||
expect(selection).toEqual(
|
||||
expect.objectContaining({
|
||||
provider: "anthropic",
|
||||
modelId: "claude-opus-4-6",
|
||||
provider: "openai",
|
||||
modelId: "gpt-5.4",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user