c28825ec87
fix: use find_user_by_chat_id for expand_promo_detail AI config
main
Zichao Lin2026-07-23 11:28:28 +08:00
a517768083
feat: AI hint supports multi-turn conversation with context - hint_history list stored in conversation, accumulates across rounds - Each new hint appended, full history passed to AI as combined prompt - Format: 'hint1 → hint2 → hint3' so AI understands the conversation flow
Zichao Lin2026-07-22 13:32:09 +08:00
e0c2110c09
fix: use original email subject for reply, not AI-extracted title Reply emails should use the original subject from IMAP header (e.g. 'Re: [original]'), not the AI-generated Chinese summary title.
Zichao Lin2026-07-22 13:28:36 +08:00
b18dcb0527
fix: wrap original text in code block to avoid MarkdownV2 parse errors Email bodies contain *, _, etc. that break MarkdownV2 entity parsing. Wrapping in backtick code block prevents Telegram from parsing internals.
Zichao Lin2026-07-19 05:54:20 +08:00
9adb32cb0c
feat: cleanup reply flow messages + AI comparison explanation - Track extra_msg_ids in conversation for code block messages - _cleanup_conv_messages: delete all intermediate messages on cancel/send - Cancel/send/edit all clean up extra messages before restoring summary view - AI prompts now return 'comparison' field with Chinese explanation of differences - _show_ai_suggestions displays comparison text above button list - generate_more_replies returns {suggestions, comparison}
Zichao Lin2026-07-19 01:28:05 +08:00
beaa3f146e
feat: show full recipient and CC in email summary - Email class: add cc field - fetch_unseen_emails: parse Cc header - _format_normal: display full recipient, add CC line if present - send_summary/ai_process: pass cc through to email_context - save_email_context: store cc for callback use
Zichao Lin2026-07-18 20:07:21 +08:00
7a01b29655
fix: update email_client and smtp_client for new config structure - email_client: use account.imap.server/port/ssl/starttls instead of flat fields - smtp_client: use s.ssl/starttls instead of s.use_ssl/use_starttls - tg_bot: fix _do_send_reply to use find_user_by_chat_id for email_accounts
Zichao Lin2026-07-17 22:19:20 +08:00
f2b3793d4c
feat: multi-user support - Config format: JSON with bot_token (global), users array - Each user has chat_id, AI config, email_accounts - Each email account has separate IMAP/SMTP with ssl/starttls - Config module: new dataclasses (UserConfig, ImapConfig, SmtpConfig) - find_user_by_chat_id() for callback dispatch - Main: email poller iterates all users, queues carry user object - Summarizer: accepts UserConfig, uses user-specific AI and chat_id - TG bot: all functions use bot_token string instead of TelegramConfig - Callback/message handlers look up user by chat_id - AI regen/hint threads use find_user_by_chat_id for AI config - Config example: config.example.json - Tests: 3/3 passing
Zichao Lin2026-07-17 22:05:59 +08:00
9906f1675f
chore: remove reply_suggestions from email summarization prompt AI reply suggestions are now generated on-demand when user clicks full/short reply buttons, using style-specific prompts.
Zichao Lin2026-07-17 21:02:50 +08:00
8386ab3c89
fix: always regenerate AI replies when selecting style, ignore summary cache The cached reply_suggestions from summarization use a generic prompt, not matching full/short style. Now always triggers fresh generation.
Zichao Lin2026-07-17 21:01:03 +08:00
1d70fe2491
fix: pass links/is_promotion to _summary_keyboard in cancel and send_reply handlers
Zichao Lin2026-07-17 20:56:59 +08:00
bedf5b887c
feat: 2-col reply buttons, direct send, language-matched prompts - Buttons: [回复N 直接发送] [回复N 编辑] in 2-column layout - CALLBACK_SEND_REPLY: send immediately without editing - Prompts enforce matching email language (no Chinese forced on English) - Full mode: greeting + comma only, no [Your Name] placeholder - Tests: 5/5 passing
Zichao Lin2026-07-17 20:49:11 +08:00
6ce9a806ea
fix: clear reply suggestions cache on cancel, regenerate when switching styles - Cancel now clears reply_suggestions from email_context - Selecting style with empty cache triggers fresh AI generation - Selecting style with cache uses cached suggestions - Tests: 3/3 passing
Zichao Lin2026-07-17 20:33:09 +08:00
84f2428aeb
fix: send AI suggestion as MarkdownV2 code block for copy-on-tap
Zichao Lin2026-07-17 20:28:46 +08:00
51064e48aa
feat: AI reply suggestions show as copyable code block, user edits before sending - Click suggestion -> show text in backtick code block (tap to copy) - Enter awaiting_reply state so user can edit/send like normal reply - No direct email sending on selection anymore - Tests: 3/3 passing
Zichao Lin2026-07-17 20:23:59 +08:00
ab2bf7facb
feat: AI reply modes - full (formal email) and short (concise) - Split 'AI回复' button into 'AI完整回复' and 'AI简洁回复' - Full mode: complete email format with greeting/signature, 300 char limit - Short mode: brief text message style, 50 char limit - Style persists in conversation state for regen/hint consistency - Tests: 6/6 passing
Zichao Lin2026-07-17 20:14:48 +08:00
2a9be9896f
fix: restore links when returning to summary view _summary_keyboard was called without links param in VIEW_SUMM handler, causing extracted links to disappear after viewing original text.
Zichao Lin2026-07-17 20:10:18 +08:00
2f29e03cec
fix: read Telegram caption field for media messages Telegram sends text in 'caption' field (not 'text') when message has media. Handle both cases: text or caption, with text taking priority.
Zichao Lin2026-07-17 20:04:27 +08:00
b2e219ece5
fix: send reply immediately on media-only message, no accumulation - Remove accumulation logic: media-only now sends as reply directly - All 3 cases (text-only, media-only, text+media) send immediately - Tests: 4/4 passing
Zichao Lin2026-07-17 19:53:38 +08:00
131e440d6b
style: simplify media accumulation - silent accumulate, immediate send on text
Zichao Lin2026-07-17 19:52:08 +08:00
4002dec33c
fix: add missing account_idx to save_email_context in tg_send_and_mark
Zichao Lin2026-07-17 19:36:50 +08:00
d76a119190
feat: support attachments in manual reply (photo/video/document/voice) - Add _extract_media: extract media info from Telegram messages - Add _download_tg_file: download files from Telegram API - Modify _handle_message: accumulate attachments in awaiting_reply, send with text - Modify _handle_update: process messages without text (media-only) - Modify smtp_client.send_reply: support MIME multipart with attachments - Add comprehensive tests (11 tests, all passing)
Zichao Lin2026-07-17 19:04:27 +08:00
d05277581c
fix: save_conversation in CALLBACK_HINT, move AI hint to thread pool
Zichao Lin2026-07-17 18:45:40 +08:00