mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 04:00:10 +00:00
feat(mom): backfill missed messages on startup using conversations.history API
- Add getLastTimestamp() to ChannelStore to read last ts from log.jsonl - Add backfillChannel() to fetch up to 3 pages (3000 messages) per channel - Add backfillAllChannels() called in start() before socket connection - Include mom's own messages (as bot) and user messages, exclude other bots - Process attachments from backfilled messages - Add logging: logBackfillStart, logBackfillChannel, logBackfillComplete - Warn if attachment missing name instead of failing fixes #103
This commit is contained in:
parent
1517e64869
commit
f02194296d
4 changed files with 164 additions and 3 deletions
|
|
@ -242,3 +242,17 @@ export function logConnected(): void {
|
|||
export function logDisconnected(): void {
|
||||
console.log("Mom bot disconnected.");
|
||||
}
|
||||
|
||||
// Backfill
|
||||
export function logBackfillStart(channelCount: number): void {
|
||||
console.log(chalk.blue(`${timestamp()} [system] Backfilling ${channelCount} channels...`));
|
||||
}
|
||||
|
||||
export function logBackfillChannel(channelName: string, messageCount: number): void {
|
||||
console.log(chalk.blue(`${timestamp()} [system] #${channelName}: ${messageCount} messages`));
|
||||
}
|
||||
|
||||
export function logBackfillComplete(totalMessages: number, durationMs: number): void {
|
||||
const duration = (durationMs / 1000).toFixed(1);
|
||||
console.log(chalk.blue(`${timestamp()} [system] Backfill complete: ${totalMessages} messages in ${duration}s`));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue