feat(bot): add topic history-aware assistant replies

This commit is contained in:
2026-03-12 19:06:51 +04:00
parent 5ebae7714c
commit 23faeef738
19 changed files with 4274 additions and 28 deletions

View File

@@ -66,3 +66,9 @@ export {
type TelegramPendingActionRepository,
type TelegramPendingActionType
} from './telegram-pending-actions'
export type {
ListRecentChatTopicMessagesInput,
ListRecentThreadTopicMessagesInput,
TopicMessageHistoryRecord,
TopicMessageHistoryRepository
} from './topic-message-history'

View File

@@ -0,0 +1,38 @@
import type { Instant } from '@household/domain'
export interface TopicMessageHistoryRecord {
householdId: string
telegramChatId: string
telegramThreadId: string | null
telegramMessageId: string | null
telegramUpdateId: string | null
senderTelegramUserId: string | null
senderDisplayName: string | null
isBot: boolean
rawText: string
messageSentAt: Instant | null
}
export interface ListRecentThreadTopicMessagesInput {
householdId: string
telegramChatId: string
telegramThreadId: string
limit: number
}
export interface ListRecentChatTopicMessagesInput {
householdId: string
telegramChatId: string
sentAtOrAfter: Instant
limit: number
}
export interface TopicMessageHistoryRepository {
saveMessage(input: TopicMessageHistoryRecord): Promise<void>
listRecentThreadMessages(
input: ListRecentThreadTopicMessagesInput
): Promise<readonly TopicMessageHistoryRecord[]>
listRecentChatMessages(
input: ListRecentChatTopicMessagesInput
): Promise<readonly TopicMessageHistoryRecord[]>
}