mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
Improve before_compact hook: add messagesToKeep, replace apiKey with resolveApiKey
This commit is contained in:
parent
e4283294c8
commit
d9a542763a
8 changed files with 51 additions and 24 deletions
|
|
@ -15,17 +15,19 @@ describe("Documentation example", () => {
|
|||
|
||||
// After narrowing, these should all be accessible
|
||||
const messages = event.messagesToSummarize;
|
||||
const messagesToKeep = event.messagesToKeep;
|
||||
const cutPoint = event.cutPoint;
|
||||
const tokensBefore = event.tokensBefore;
|
||||
const model = event.model;
|
||||
const apiKey = event.apiKey;
|
||||
const resolveApiKey = event.resolveApiKey;
|
||||
|
||||
// Verify types
|
||||
expect(Array.isArray(messages)).toBe(true);
|
||||
expect(Array.isArray(messagesToKeep)).toBe(true);
|
||||
expect(typeof cutPoint.firstKeptEntryIndex).toBe("number");
|
||||
expect(typeof tokensBefore).toBe("number");
|
||||
expect(model).toBeDefined();
|
||||
expect(typeof apiKey).toBe("string");
|
||||
expect(typeof resolveApiKey).toBe("function");
|
||||
|
||||
const summary = messages
|
||||
.filter((m) => m.role === "user")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue