mirror of https://github.com/openclaw/openclaw.git
Merge c9e6535b01 into 392ddb56e2
This commit is contained in:
commit
ca83854290
|
|
@ -0,0 +1,36 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { AgentEntrySchema } from "./zod-schema.agent-runtime.js";
|
||||
|
||||
describe("AgentEntrySchema params field", () => {
|
||||
it("accepts agents.list[].params with cacheRetention", () => {
|
||||
const result = AgentEntrySchema.safeParse({
|
||||
id: "main",
|
||||
params: { cacheRetention: "none" },
|
||||
});
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.data.params).toEqual({ cacheRetention: "none" });
|
||||
}
|
||||
});
|
||||
|
||||
it("accepts agents.list[].params with arbitrary model overrides", () => {
|
||||
const result = AgentEntrySchema.safeParse({
|
||||
id: "main",
|
||||
params: { temperature: 0.7, maxTokens: 4096 },
|
||||
});
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.data.params).toEqual({ temperature: 0.7, maxTokens: 4096 });
|
||||
}
|
||||
});
|
||||
|
||||
it("accepts agents.list[] without params (optional)", () => {
|
||||
const result = AgentEntrySchema.safeParse({
|
||||
id: "main",
|
||||
});
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.data.params).toBeUndefined();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -751,6 +751,8 @@ export const AgentEntrySchema = z
|
|||
heartbeat: HeartbeatSchema,
|
||||
identity: IdentitySchema,
|
||||
groupChat: GroupChatSchema,
|
||||
/** Per-agent model params (e.g. cacheRetention, temperature). Merged on top of agents.defaults.models[...].params. */
|
||||
params: z.record(z.string(), z.unknown()).optional(),
|
||||
subagents: z
|
||||
.object({
|
||||
allowAgents: z.array(z.string()).optional(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue