feat: IMAP mail sync with thread-to-contact matching (PRD §6.1)
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
This commit is contained in:
1 parent
7acc0c5451
commit
e45b68bb8b
1089 files changed
+260614
No files matched your search
Executable
+40
@@ -0,0 +1,40 @@
|
||||
# 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:
|
||||
|
||||
1. **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.
|
||||
2. **keywords** — 2-4 Chinese keywords. Keep well-known English acronyms as-is.
|
||||
3. **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:
|
||||
|
||||
```json
|
||||
{
|
||||
"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.
|
||||
Reference in new issue
Block a user