Local models were burning the 8-round budget on simple event adds. Raise the limit, resolve calendars by name/default, and inject the household clock so relative dates work.
This commit is contained in:
@@ -83,6 +83,36 @@ describe("runAgentChat", () => {
|
||||
assert.equal(result.message.role, "assistant");
|
||||
assert.ok(result.message.content.length > 0);
|
||||
});
|
||||
|
||||
it("appends runtime clock context to the system prompt", async () => {
|
||||
const original = process.env.HOUSEHOLD_TIMEZONE;
|
||||
process.env.HOUSEHOLD_TIMEZONE = "America/Chicago";
|
||||
|
||||
let systemContent = "";
|
||||
const result = await runAgentChat({
|
||||
messages: [{ role: "user", content: "hello" }],
|
||||
request: new Request("http://localhost:3000/api/agent/chat"),
|
||||
systemPrompt: "You are a pirate.",
|
||||
llm: {
|
||||
async chatCompletion(request) {
|
||||
const system = request.messages.find((message) => message.role === "system");
|
||||
systemContent = typeof system?.content === "string" ? system.content : "";
|
||||
return {
|
||||
message: { role: "assistant", content: "Ahoy" },
|
||||
finishReason: "stop",
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(result.message.content, "Ahoy");
|
||||
assert.match(systemContent, /^You are a pirate\./);
|
||||
assert.match(systemContent, /Current time:/);
|
||||
assert.match(systemContent, /America\/Chicago/);
|
||||
|
||||
if (original === undefined) delete process.env.HOUSEHOLD_TIMEZONE;
|
||||
else process.env.HOUSEHOLD_TIMEZONE = original;
|
||||
});
|
||||
});
|
||||
|
||||
it("passes a model override to the OpenAI-compatible client", async () => {
|
||||
|
||||
Reference in New Issue
Block a user