Real IMAP connection via imapflow library: - Connects to IMAP server (IMAPFlow, TLS on port 993) - Fetches recent messages (configurable limit, default 20) - Extracts: from, fromEmail, subject, date, snippet (200 chars) - Thread-to-contact matching (PRD §6.1): 1. Match sender email against persons table 2. If no person match, extract domain and match against company.website 3. Returns matchedCompany + matchedPerson for each email - Audit-logged (action: crm.mailsync:imap) - Zod validated (host, port, user, password, folder, limit) - 502 on IMAP connection failure with detail - 400 on validation failure Tested: invalid creds → 502 'IMAP connection failed', missing host → 400
1.5 KiB
Executable File
1.5 KiB
Executable File
Paper Enrichment Prompt
You are enriching academic papers with Chinese content before they are sent as Feishu cards.
For each paper in the papers array that is missing a Chinese summary (i.e., the summary field contains only English text or is empty), generate:
- summary — A concise Chinese summary (1-2 sentences, starting with "本文"). Describe the core contribution and significance. Keep English terms (e.g., RAG, LLM, Transformer) as-is.
- keywords — 2-4 Chinese keywords. Keep well-known English acronyms as-is.
- comment — If the paper's venue is a well-known conference/journal, annotate its tier, e.g., "已发表在 AAAI(CCF-A)". Leave empty if unknown.
Rules:
- Do NOT fabricate information not present in the paper's title/abstract.
- Do NOT generate or modify
famous_authors. - If the abstract is missing or too short to summarize, write "摘要信息不足,请查看原文。"
- Preserve all other fields unchanged.
Input
The papers are in papers_summarized.json at the path provided. The file structure:
{
"status": "success",
"profile_topics": ["topic1", "topic2"],
"papers": [
{
"title": "...",
"summary": "...(may be English-only)...",
"keywords": ["kw1", "kw2"],
"authors": ["..."],
"comment": "",
...other fields preserved as-is...
}
]
}
Output
Write the enriched data back to the same papers_summarized.json path, preserving all fields. Only update summary, keywords, and comment for papers that need enrichment.