This commit is contained in:
@@ -192,6 +192,45 @@ class ContactAPIClient:
|
||||
"suggestion": "是否添加这些联系人?"
|
||||
}
|
||||
|
||||
# 公共方法
|
||||
def list_contacts(self, user_id: str = "default") -> List[Contact]:
|
||||
"""查询联系人列表"""
|
||||
return self.list_contacts_mock(user_id)
|
||||
|
||||
def add_contact(self, user_id: str, contact: Contact) -> bool:
|
||||
"""添加联系人"""
|
||||
return self.save_contact_mock(user_id, contact)
|
||||
|
||||
def list_emails(self, user_id: str = "default") -> List[Email]:
|
||||
"""查询邮件列表"""
|
||||
return self.list_emails_mock()
|
||||
|
||||
def generate_email_draft(self, query: str) -> Dict[str, str]:
|
||||
"""生成邮件草稿"""
|
||||
return self.generate_email_draft_mock(query)
|
||||
|
||||
def send_email(self, user_id: str, recipient: str, subject: str, body: str) -> bool:
|
||||
"""发送邮件"""
|
||||
result = self.send_email_mock(recipient, subject, body)
|
||||
return result.get("success", False)
|
||||
|
||||
def sniff_contacts(self, query: str) -> List[Contact]:
|
||||
"""智能嗅探联系人"""
|
||||
result = self.sniff_contacts_mock(query)
|
||||
contact_dicts = result.get("contacts", [])
|
||||
return [
|
||||
Contact(
|
||||
id=str(i+1),
|
||||
name=c.get("name", ""),
|
||||
phone=c.get("phone", ""),
|
||||
email=c.get("email", ""),
|
||||
company="",
|
||||
position="",
|
||||
created_at=datetime.now().isoformat()
|
||||
)
|
||||
for i, c in enumerate(contact_dicts)
|
||||
]
|
||||
|
||||
|
||||
# 单例实例
|
||||
contact_api = ContactAPIClient()
|
||||
|
||||
Reference in New Issue
Block a user