feat: add retry(10) on all network requests
- New src/retry.py with configurable retry decorator - Applied @retry() to fetch_unseen_emails, mark_as_seen, summarize_email, and send_message - No backoff delay between retries
This commit is contained in:
@@ -2,6 +2,7 @@ import json
|
||||
from typing import Any
|
||||
import requests
|
||||
from src.config import AIConfig
|
||||
from src.retry import retry
|
||||
|
||||
SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以 JSON 格式返回结构化摘要。
|
||||
|
||||
@@ -19,6 +20,7 @@ SYSTEM_PROMPT = """你是一个邮件摘要助手。请分析邮件内容并以
|
||||
只返回 JSON,不要包含任何其他文字。"""
|
||||
|
||||
|
||||
@retry()
|
||||
def summarize_email(ai_cfg: AIConfig, subject: str, sender: str, body: str) -> dict[str, Any]:
|
||||
content = f"发件人: {sender}\n主题: {subject}\n正文:\n{body[:4000]}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user