doc title fix
This commit is contained in:
parent
4fb6106ca0
commit
8f0ebbb968
2 changed files with 4 additions and 3 deletions
|
|
@ -46,7 +46,8 @@ class ConnectorService:
|
||||||
result = await doc_service.process_file_common(
|
result = await doc_service.process_file_common(
|
||||||
file_path=tmp_file.name,
|
file_path=tmp_file.name,
|
||||||
file_hash=document.id, # Use connector document ID as hash
|
file_hash=document.id, # Use connector document ID as hash
|
||||||
owner_user_id=owner_user_id
|
owner_user_id=owner_user_id,
|
||||||
|
original_filename=document.filename # Pass the original Google Doc title
|
||||||
)
|
)
|
||||||
|
|
||||||
# If successfully indexed, update the indexed documents with connector metadata
|
# If successfully indexed, update the indexed documents with connector metadata
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class DocumentService:
|
||||||
def __init__(self, process_pool=None):
|
def __init__(self, process_pool=None):
|
||||||
self.process_pool = process_pool
|
self.process_pool = process_pool
|
||||||
|
|
||||||
async def process_file_common(self, file_path: str, file_hash: str = None, owner_user_id: str = None):
|
async def process_file_common(self, file_path: str, file_hash: str = None, owner_user_id: str = None, original_filename: str = None):
|
||||||
"""
|
"""
|
||||||
Common processing logic for both upload and upload_path.
|
Common processing logic for both upload and upload_path.
|
||||||
1. Optionally compute SHA256 hash if not provided.
|
1. Optionally compute SHA256 hash if not provided.
|
||||||
|
|
@ -121,7 +121,7 @@ class DocumentService:
|
||||||
for i, (chunk, vect) in enumerate(zip(slim_doc["chunks"], embeddings)):
|
for i, (chunk, vect) in enumerate(zip(slim_doc["chunks"], embeddings)):
|
||||||
chunk_doc = {
|
chunk_doc = {
|
||||||
"document_id": file_hash,
|
"document_id": file_hash,
|
||||||
"filename": slim_doc["filename"],
|
"filename": original_filename if original_filename else slim_doc["filename"],
|
||||||
"mimetype": slim_doc["mimetype"],
|
"mimetype": slim_doc["mimetype"],
|
||||||
"page": chunk["page"],
|
"page": chunk["page"],
|
||||||
"text": chunk["text"],
|
"text": chunk["text"],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue