mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 12:04:02 +00:00
feat(bot): add topic history-aware assistant replies
This commit is contained in:
@@ -66,3 +66,9 @@ export {
|
||||
type TelegramPendingActionRepository,
|
||||
type TelegramPendingActionType
|
||||
} from './telegram-pending-actions'
|
||||
export type {
|
||||
ListRecentChatTopicMessagesInput,
|
||||
ListRecentThreadTopicMessagesInput,
|
||||
TopicMessageHistoryRecord,
|
||||
TopicMessageHistoryRepository
|
||||
} from './topic-message-history'
|
||||
|
||||
38
packages/ports/src/topic-message-history.ts
Normal file
38
packages/ports/src/topic-message-history.ts
Normal 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[]>
|
||||
}
|
||||
Reference in New Issue
Block a user