mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 18:51:04 +00:00
fix: preserve agent context for legacy model list
This commit is contained in:
@@ -281,6 +281,24 @@ describe("/model chat UX", () => {
|
||||
expect(reply?.text).toContain("Active: deepinfra/moonshotai/Kimi-K2.5 (runtime)");
|
||||
});
|
||||
|
||||
it("uses the active agent context for legacy /model list replies", async () => {
|
||||
const reply = await resolveModelInfoReply({
|
||||
directives: parseInlineDirectives("/model list"),
|
||||
cfg: {
|
||||
commands: { text: true },
|
||||
agents: {
|
||||
defaults: { model: { primary: "anthropic/claude-opus-4-6" } },
|
||||
list: [{ id: "support", model: "localai/ultra-chat" }],
|
||||
},
|
||||
} as unknown as OpenClawConfig,
|
||||
activeAgentId: "support",
|
||||
agentDir: TEST_AGENT_DIR,
|
||||
});
|
||||
|
||||
expect(reply?.text).toContain("Providers:");
|
||||
expect(reply?.text).toContain("localai");
|
||||
});
|
||||
|
||||
it("auto-applies closest match for typos", () => {
|
||||
const directives = parseInlineDirectives("/model anthropic/claud-opus-4-5");
|
||||
const cfg = { commands: { text: true } } as unknown as OpenClawConfig;
|
||||
|
||||
@@ -234,6 +234,11 @@ export async function maybeHandleModelDirectiveInfo(params: {
|
||||
const reply = await resolveModelsCommandReply({
|
||||
cfg: params.cfg,
|
||||
commandBodyNormalized: "/models",
|
||||
surface: params.surface,
|
||||
currentModel: `${params.provider}/${params.model}`,
|
||||
agentId: params.activeAgentId,
|
||||
agentDir: params.agentDir,
|
||||
sessionEntry: params.sessionEntry,
|
||||
});
|
||||
return reply ?? { text: "No models available." };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user