@economic/agents 2.10.3 → 2.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.mjs +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -264,7 +264,7 @@ The `Assistant` keeps the chat list in its own SQLite (a `chats` table, created
|
|
|
264
264
|
| `deleteChat(id)` | `void` | Deletes a chat facet and its record. |
|
|
265
265
|
| `renameChat(id)` | `void` | Renames a registered chat. |
|
|
266
266
|
|
|
267
|
-
- **Titles and summaries** — generated with `fastModel` after each turn (on the first turn, then refreshed as the chat grows).
|
|
267
|
+
- **Titles and summaries** — generated with `fastModel` after each turn (on the first turn, then refreshed as the chat grows). Written in the language of the conversation, following the user's most recent messages when a chat mixes languages.
|
|
268
268
|
- **Empty chat cleanup** — a newly created facet is scheduled for deletion after one day. Its first completed turn replaces that schedule with the normal sliding retention period.
|
|
269
269
|
- **Retention** — inactive chats are deleted after 90 days, via a Durable Object alarm.
|
|
270
270
|
|
package/dist/index.mjs
CHANGED
|
@@ -1547,7 +1547,10 @@ async function summariseChatWithAI(sql, durableObjectName, messages, model) {
|
|
|
1547
1547
|
You will be given a list of messages and you need to generate a title and summary for the chat.
|
|
1548
1548
|
The title should be a short title for the chat, max 8-10 words.
|
|
1549
1549
|
The summary should be a short 1-2 sentence summary of the chat.
|
|
1550
|
-
The summary should reflect the direction of the chat
|
|
1550
|
+
The summary should reflect the direction of the chat.
|
|
1551
|
+
Write the title and the summary in the same language as the conversation, never
|
|
1552
|
+
translating them to English. If the conversation mixes languages, follow the
|
|
1553
|
+
language of the user's most recent messages.`;
|
|
1551
1554
|
if (chat) systemPrompt += `\n\nThe previous summary: ${chat.summary}`;
|
|
1552
1555
|
try {
|
|
1553
1556
|
const { output: { title, summary } } = await generateText({
|
|
@@ -1978,10 +1981,12 @@ var Assistant = class extends Agent$1 {
|
|
|
1978
1981
|
//#endregion
|
|
1979
1982
|
//#region src/server/features/messages.ts
|
|
1980
1983
|
const COMPACTION_TOKEN_THRESHOLD = 1e5;
|
|
1984
|
+
const COMPACTION_MAX_OUTPUT_TOKENS = 2e3;
|
|
1981
1985
|
const createCompactFn = (model) => createCompactFunction({ summarize: (prompt) => generateText({
|
|
1982
1986
|
model,
|
|
1983
|
-
prompt
|
|
1984
|
-
|
|
1987
|
+
prompt,
|
|
1988
|
+
maxOutputTokens: COMPACTION_MAX_OUTPUT_TOKENS
|
|
1989
|
+
}).then((result) => result.text) });
|
|
1985
1990
|
/**
|
|
1986
1991
|
* Ensures that the feedback table exists.
|
|
1987
1992
|
* @param sql - The SQL function to use to execute the query.
|