Zichao Lin earthjasonlin
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 22:19:43 +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
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 22:09:06 +08:00
c6180834bc chore: remove old YAML config files, keep config.example.json
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 22:06:57 +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
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 21:05:06 +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.
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.
1d70fe2491 fix: pass links/is_promotion to _summary_keyboard in cancel and send_reply handlers
Compare 3 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 20:49:51 +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
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 20:36:15 +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
84f2428aeb fix: send AI suggestion as MarkdownV2 code block for copy-on-tap
Compare 2 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 20:24:24 +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
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
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.
Compare 3 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 20:05:08 +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.
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 19:54:49 +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
131e440d6b style: simplify media accumulation - silent accumulate, immediate send on text
Compare 2 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 19:40:00 +08:00
4002dec33c fix: add missing account_idx to save_email_context in tg_send_and_mark
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-17 19:26:04 +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)
d05277581c fix: save_conversation in CALLBACK_HINT, move AI hint to thread pool
fe24a07d15 fix: parse_mode always MarkdownV2, add MEMORY.md with project rules
0abb7de5d3 fix: move regenerate to AI thread pool, fix parse_mode None error
Compare 4 commits »
earthjasonlin pushed to main at earthjasonlin/mailova 2026-07-15 19:23:50 +08:00
05168fb1ca fix(postcard): remove auto option from status dropdown, auto-select silently by date
5ec21f0e3f feat(postcard): allow manual status override in new-sent form (auto/pending/sent/delivered)
de29f5445e feat(postcard): split create into sent/received, add pending status and mark-sent flow
d79aaea4ae fix(web): correct country_to form parameter name mismatch in create and edit routes
3323523e8e fix(dashboard): put time in its own column on the right side
Compare 17 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 19:21:17 +08:00
5ca739456d perf: reduce poll timeout to 1s and wait to 50ms for faster button response
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 19:16:04 +08:00
c26d8aa294 fix: reduce long-poll timeout to 2s, make mark_as_seen async to unblock TG sender
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 19:10:07 +08:00
c940a456bc fix: clear all database tables on startup
b226f0b597 fix: clear processed_emails on startup to avoid stale state
Compare 2 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 19:03:55 +08:00
687e60ede4 fix: add error logging for send_thinking failures in email poller
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 18:51:20 +08:00
da1b266350 fix: increase Telegram long-poll timeout to 5s and HTTP timeout to 15s
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 18:40:12 +08:00
dcdfba11fa feat: show email subject and sender in all status messages
2822075f2f refactor: split TG worker into poller (callbacks) and sender (email summaries) threads
2744d9dd77 fix: process one queued email per poll cycle to keep callbacks responsive
Compare 3 commits »
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 18:26:09 +08:00
17514302f9 fix: import is_uid_processed instead of is_uids_processed
earthjasonlin pushed to main at earthjasonlin/ai-mail-bot 2026-07-15 18:23:56 +08:00
d42022cc2e fix: ensure data directory exists before DB connection in all threads