fixed summary creation

This commit is contained in:
Storme-bit
2026-04-19 17:35:44 -07:00
parent 98b89d44a5
commit 395c06137c

View File

@@ -14,13 +14,13 @@ function buildSummaryPrompt(episodes, existingSummary = null) {
.join('\n\n');
const instruction = existingSummary
? `You have a previous summary of this conversation. Update it to include the new exchanges below. Keep it concise — plain prose, no markdown, no headers, third person, max 200 words.
? `Update this summary to include the new conversation exchanges below. Output only the updated summary — do not continue the conversation.
Previous summary:
${existingSummary}
New exchanges to incorporate:`
: `Summarise this conversation. Be concise — plain prose, no markdown, no headers, third person, max 200 words. Preserve key decisions, facts, named entities, and unresolved questions.
: `Summarise this conversation. Output only the summary — do not continue the conversation or give recommendations.
Conversation:`;
@@ -88,8 +88,12 @@ async function maybeSummarize(session, allEpisodes) {
const totalEpisodeTokens = allEpisodes.reduce((sum, ep) => sum + (ep.token_count || 0), 0);
// 5. Generate summary — pass existing content if updating
const episodesToSummarize = latest
? allEpisodes.filter(ep => ep.id > lastCoveredId)
: allEpisodes;
const content = await generateSummary(
allEpisodes,
episodesToSummarize,
latest && latest.content.length < MAX_SUMMARY_TOKENS ? latest.content : null
// if existing summary is already large, treat as fresh rather than appending to a huge blob
);