Commit Graph

21 Commits

Author SHA1 Message Date
687e60ede4 fix: add error logging for send_thinking failures in email poller 2026-07-15 19:02:59 +08:00
dcdfba11fa feat: show email subject and sender in all status messages 2026-07-15 18:39:58 +08:00
2822075f2f refactor: split TG worker into poller (callbacks) and sender (email summaries) threads 2026-07-15 18:35:01 +08:00
2744d9dd77 fix: process one queued email per poll cycle to keep callbacks responsive 2026-07-15 18:32:42 +08:00
17514302f9 fix: import is_uid_processed instead of is_uids_processed 2026-07-15 18:25:57 +08:00
54c4bf00fb refactor: replace all in-memory state with SQLite database 2026-07-14 14:49:23 +08:00
8b885f1c4c fix: use threading.Event for immediate shutdown instead of sleep loops 2026-07-13 08:34:02 +08:00
01504e6295 feat: three-stage status: 获取邮件中 -> 等待处理 -> AI思考中 2026-07-13 08:19:36 +08:00
0ec2048bc5 fix: never discard from _processing_uids to prevent re-fetching 2026-07-13 07:49:09 +08:00
155a6dfc53 fix: skip already-processing UIDs at FETCH level to avoid downloading email content 2026-07-13 07:35:28 +08:00
02cf4b88b6 fix: add _processing_uids to prevent re-fetching emails being processed 2026-07-13 07:12:43 +08:00
bbc43f8972 fix: keep pending_uids until TG send completes to prevent duplicate processing 2026-07-12 23:51:45 +08:00
ea6358019d chore: AI并行workers 5→10 2026-07-06 20:13:15 +08:00
d70b817fd4 feat: AI并行处理 + 修复邮件丢失
- _ai_processor 改用 ThreadPoolExecutor(5 workers) 并行调用AI
- _tg_worker 每轮排空所有待发TG消息(原来每轮只取1条)
- fetch_unseen_emails 单封FETCH失败不再丢弃整个批次,跳过继续
2026-07-06 20:12:24 +08:00
0c1ccdfc79 fix: 修复 _email_poller 线程静默死亡问题
- IMAP 连接加 30s socket timeout,防止 _send_id_command 等操作永久阻塞
- _email_poller 加顶层 try/except,异常后 sleep 5s 继续循环
- @retry() 加指数退避延迟(1s,2s,4s...),避免重试风暴
2026-07-06 19:54:23 +08:00
d334b6f3eb feat: enhance logging detail across all modules
- email_client: log IMAP connection, login, UNSEEN count, each email
  details (subject/sender/body size), mark-as-seen progress
- ai_client: log AI request params, timing, token usage, response size
- smtp_client: log SMTP connect, login, send details
- tg_bot: log all callback actions with subject context, message states
- main: periodic queue depth report (email_queue/tg_queue/pending_uids)
2026-07-02 21:00:40 +08:00
934d6a7545 fix: thread-safe logging with QueueHandler + QueueListener
- Replace logging.basicConfig with QueueHandler/QueueListener
  so all log output writes from a single thread
- Add %(threadName)s to format for thread identification
2026-07-02 20:57:33 +08:00
ded61e25c1 refactor: split AI processor and TG worker into separate threads
- Three independent threads: email poller, AI processor, TG worker
- Two queues: _email_queue (raw emails→AI), _tg_queue (AI results→TG)
- summarizer.py split: ai_process() (AI only) + tg_send_and_mark() (TG only)
- AI retries no longer affect TG polling or email polling
2026-07-02 20:52:34 +08:00
1be3aadb08 refactor: separate email poll, email process, TG poll into threads
- main.py spawns 3 daemon threads: email poller, email processor, TG poller
- Each thread runs independently so retries don't block other operations
- _pending_uids set + lock prevents duplicate queueing across poll cycles
- summarizer.py split into poll_accounts() (generator) and process_email()
- Graceful shutdown via shared _running flag
2026-07-02 20:48:05 +08:00
0dbc7ee661 feat: interactive inline buttons, SMTP reply, AI reply suggestions
- Inline keyboard: view original / back to summary toggle per message
- SMTP config per account for sending replies
- Reply button: click, type message, auto-send via SMTP
- AI Reply button: generates 3 suggestions via DeepSeek
  - Simple replies (OK, Got it) send immediately on tap
  - Substantive replies require confirm before send
  - Hides AI Reply button when AI determines reply unnecessary
- Telegram long polling integrated into main loop for real-time interaction
2026-07-02 20:21:06 +08:00
e2826a3e3b feat: init AI email summarization bot
- Multi-account IMAP email polling with UID tracking
- DeepSeek API integration with JSON Mode structured output
- Telegram notification with formatted MarkdownV2 message
- YAML config with dataclass-based type validation
- Graceful shutdown on SIGINT/SIGTERM
- 60s default polling interval
2026-07-02 19:45:34 +08:00