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
This commit is contained in:
18
main.py
18
main.py
@@ -4,6 +4,7 @@ import sys
|
||||
import time
|
||||
from src.config import load_config
|
||||
from src.summarizer import process_all
|
||||
from src.tg_bot import poll_telegram
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
@@ -30,17 +31,22 @@ def main():
|
||||
cfg = load_config(cfg_path)
|
||||
logger.info(f"AI邮件摘要机器人已启动,轮询间隔: {cfg.polling.interval_seconds}s")
|
||||
|
||||
last_check = 0.0
|
||||
last_update_id = 0
|
||||
|
||||
while _running:
|
||||
try:
|
||||
process_all(cfg)
|
||||
now = time.time()
|
||||
if now - last_check >= cfg.polling.interval_seconds:
|
||||
process_all(cfg)
|
||||
last_check = now
|
||||
|
||||
last_update_id = poll_telegram(cfg.telegram, cfg, last_update_id)
|
||||
except Exception as e:
|
||||
logger.error(f"轮询出错: {e}", exc_info=True)
|
||||
logger.error(f"主循环出错: {e}", exc_info=True)
|
||||
|
||||
if _running:
|
||||
for _ in range(cfg.polling.interval_seconds):
|
||||
if not _running:
|
||||
break
|
||||
time.sleep(1)
|
||||
time.sleep(1)
|
||||
|
||||
logger.info("机器人已停止")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user