fix(agent): Reading of docx multimodal files; Multimodal attachment history record

This commit is contained in:
Timebomb2018
2026-03-18 22:29:10 +08:00
parent 0fccc91dac
commit f6efa0d711
3 changed files with 116 additions and 51 deletions

View File

@@ -41,7 +41,8 @@ TEXT_MIME = ['text/plain', 'text/x-markdown']
PDF_MIME = ['application/pdf']
DOC_MIME = [
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip'
]
XLSX_MIME = [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
@@ -590,7 +591,7 @@ class MultimodalService:
return file_content.decode("utf-8")
elif file_mime_type in PDF_MIME:
return await self._extract_pdf_text(file_content)
elif file_mime_type in DOC_MIME:
elif file_mime_type in DOC_MIME and file.file_type.endswith(('docx', 'doc')):
return await self._extract_word_text(file_content)
elif file_mime_type in XLSX_MIME and file.file_type.endswith(("xlsx", "xls")):
return await self._extract_xlsx_text(file_content)