Commit 0e9a2f017acc

Vincent Demeester <vincent@sbr.pm>
2026-02-05 23:24:04
fix(ai-storage): handle messages with undefined content
Added filter to skip messages with undefined content when building the conversation text for summarization.
1 parent 4eb0968
Changed files (1)
dots
pi
agent
extensions
ai-storage
dots/pi/agent/extensions/ai-storage/summarizer.ts
@@ -51,6 +51,7 @@ function notify(title: string, body: string) {
 function summarizeWithPi(transcript: Transcript): string | null {
 	const conversationText = transcript.messages
 		.slice(0, 50) // Limit to first 50 messages to avoid token limits
+		.filter((m) => m.content) // Skip messages with undefined content
 		.map((m) => `${m.role.toUpperCase()}: ${m.content.slice(0, 2000)}`) // Truncate long messages
 		.join("\n\n---\n\n");