feat(bot): add conversational DM assistant flow

This commit is contained in:
2026-03-11 01:41:58 +04:00
parent a63c702037
commit 714d2a985d
15 changed files with 1560 additions and 8 deletions

View File

@@ -13,6 +13,10 @@ function parsePendingActionType(raw: string): TelegramPendingActionType {
return raw
}
if (raw === 'assistant_payment_confirmation') {
return raw
}
throw new Error(`Unexpected telegram pending action type: ${raw}`)
}

View File

@@ -36,3 +36,7 @@ export {
type PaymentConfirmationService,
type PaymentConfirmationSubmitResult
} from './payment-confirmation-service'
export {
parsePaymentConfirmationMessage,
type ParsedPaymentConfirmation
} from './payment-confirmation-parser'

View File

@@ -33,6 +33,13 @@ const server = {
OPENAI_API_KEY: z.string().min(1).optional(),
PARSER_MODEL: z.string().min(1).default('gpt-4.1-mini'),
PURCHASE_PARSER_MODEL: z.string().min(1).default('gpt-5-mini'),
ASSISTANT_MODEL: z.string().min(1).default('gpt-5-mini'),
ASSISTANT_TIMEOUT_MS: z.coerce.number().int().positive().default(15000),
ASSISTANT_MEMORY_MAX_TURNS: z.coerce.number().int().positive().default(12),
ASSISTANT_RATE_LIMIT_BURST: z.coerce.number().int().positive().default(5),
ASSISTANT_RATE_LIMIT_BURST_WINDOW_MS: z.coerce.number().int().positive().default(60000),
ASSISTANT_RATE_LIMIT_ROLLING: z.coerce.number().int().positive().default(50),
ASSISTANT_RATE_LIMIT_ROLLING_WINDOW_MS: z.coerce.number().int().positive().default(86400000),
SCHEDULER_SHARED_SECRET: z.string().min(1).optional()
}

View File

@@ -1,6 +1,9 @@
import type { Instant } from '@household/domain'
export const TELEGRAM_PENDING_ACTION_TYPES = ['anonymous_feedback'] as const
export const TELEGRAM_PENDING_ACTION_TYPES = [
'anonymous_feedback',
'assistant_payment_confirmation'
] as const
export type TelegramPendingActionType = (typeof TELEGRAM_PENDING_ACTION_TYPES)[number]