mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
feat: add update functionality for Gmail drafts
- Introduced a new tool to update existing Gmail drafts, allowing users to modify draft content, recipients, and subject lines. - Updated the Gmail tools registry to include the new update_gmail_draft tool. - Enhanced the GmailKBSyncService to support draft ID handling during synchronization. - Added UI components for the update draft functionality in the web application, improving user interaction with Gmail drafts.
This commit is contained in:
parent
5e23949af6
commit
85462675a0
9 changed files with 1092 additions and 10 deletions
|
|
@ -31,6 +31,7 @@ class GmailKBSyncService:
|
|||
connector_id: int,
|
||||
search_space_id: int,
|
||||
user_id: str,
|
||||
draft_id: str | None = None,
|
||||
) -> dict:
|
||||
from app.tasks.connector_indexers.base import (
|
||||
check_document_by_unique_identifier,
|
||||
|
|
@ -103,18 +104,22 @@ class GmailKBSyncService:
|
|||
chunks = await create_document_chunks(indexable_content)
|
||||
now_str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
doc_metadata = {
|
||||
"message_id": message_id,
|
||||
"thread_id": thread_id,
|
||||
"subject": subject,
|
||||
"sender": sender,
|
||||
"date": date_str,
|
||||
"connector_id": connector_id,
|
||||
"indexed_at": now_str,
|
||||
}
|
||||
if draft_id:
|
||||
doc_metadata["draft_id"] = draft_id
|
||||
|
||||
document = Document(
|
||||
title=subject,
|
||||
document_type=DocumentType.GOOGLE_GMAIL_CONNECTOR,
|
||||
document_metadata={
|
||||
"message_id": message_id,
|
||||
"thread_id": thread_id,
|
||||
"subject": subject,
|
||||
"sender": sender,
|
||||
"date": date_str,
|
||||
"connector_id": connector_id,
|
||||
"indexed_at": now_str,
|
||||
},
|
||||
document_metadata=doc_metadata,
|
||||
content=summary_content,
|
||||
content_hash=content_hash,
|
||||
unique_identifier_hash=unique_hash,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue