fixed summary creation
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user