mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 22:54:31 +00:00
fix(agents): fall back to agents.defaults.model when agent has no model config (#24210)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 0f272b1027
Co-authored-by: bianbiandashen <16240681+bianbiandashen@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { resolveAgentModelPrimaryValue } from "../config/model-input.js";
|
||||
import type { WizardPrompter } from "../wizard/prompts.js";
|
||||
import { applyAuthChoiceHuggingface } from "./auth-choice.apply.huggingface.js";
|
||||
import {
|
||||
@@ -87,7 +88,9 @@ describe("applyAuthChoiceHuggingface", () => {
|
||||
provider: "huggingface",
|
||||
mode: "api_key",
|
||||
});
|
||||
expect(result?.config.agents?.defaults?.model?.primary).toMatch(/^huggingface\/.+/);
|
||||
expect(resolveAgentModelPrimaryValue(result?.config.agents?.defaults?.model)).toMatch(
|
||||
/^huggingface\/.+/,
|
||||
);
|
||||
expect(text).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ message: expect.stringContaining("Hugging Face") }),
|
||||
);
|
||||
@@ -173,7 +176,9 @@ describe("applyAuthChoiceHuggingface", () => {
|
||||
});
|
||||
|
||||
expect(result).not.toBeNull();
|
||||
expect(String(result?.config.agents?.defaults?.model?.primary)).toContain(":cheapest");
|
||||
expect(String(resolveAgentModelPrimaryValue(result?.config.agents?.defaults?.model))).toContain(
|
||||
":cheapest",
|
||||
);
|
||||
expect(note).toHaveBeenCalledWith(
|
||||
"Provider locked — router will choose backend by cost or speed.",
|
||||
"Hugging Face",
|
||||
|
||||
Reference in New Issue
Block a user