RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix chat and thumbnail bug (#2803)
chongchuanbing2a86472b88a7
diff --git a/api/apps/document_app.py b/api/apps/document_app.pyindex 450b9ae936..68e05dcf9c 100644--- a/api/apps/document_app.py+++ b/api/apps/document_app.py@@ -238,6 +238,11 @@ def thumbnails():try:docs = DocumentService.get_thumbnails(doc_ids)++ for doc_item in docs:+ if doc_item['thumbnail'] and not doc_item['thumbnail'].startswith(IMG_BASE64_PREFIX):+ doc_item['thumbnail'] = f"/v1/document/image/{doc_item['kb_id']}-{doc_item['thumbnail']}"+return get_json_result(data={d["id"]: d["thumbnail"] for d in docs})except Exception as e:return server_error_response(e)diff --git a/api/db/services/document_service.py b/api/db/services/document_service.pyindex 5d28ecd644..f60e760f8c 100644--- a/api/db/services/document_service.py+++ b/api/db/services/document_service.py@@ -268,7 +268,7 @@ class DocumentService(CommonService):@classmethod@DB.connection_context()def get_thumbnails(cls, docids):- fields = [cls.model.id, cls.model.thumbnail]+ fields = [cls.model.id, cls.model.kb_id, cls.model.thumbnail]return list(cls.model.select(*fields).where(cls.model.id.in_(docids)).dicts())diff --git a/api/db/services/file_service.py b/api/db/services/file_service.pyindex a63643e13c..587e517bd9 100644--- a/api/db/services/file_service.py+++ b/api/db/services/file_service.py@@ -358,8 +358,10 @@ class FileService(CommonService):doc_id = get_uuid()img = thumbnail_img(filename, blob)- thumbnail_location = f'thumbnail_{doc_id}.png'- STORAGE_IMPL.put(kb.id, thumbnail_location, img)+ thumbnail_location = ''+ if img is not None:+ thumbnail_location = f'thumbnail_{doc_id}.png'+ STORAGE_IMPL.put(kb.id, thumbnail_location, img)doc = {"id": doc_id,diff --git a/web/src/pages/chat/markdown-content/index.tsx b/web/src/pages/chat/markdown-content/index.tsxindex 12cc3d0057..db3d1504e6 100644--- a/web/src/pages/chat/markdown-content/index.tsx+++ b/web/src/pages/chat/markdown-content/index.tsx@@ -45,7 +45,7 @@ const MarkdownContent = ({}, [content, loading, t]);useEffect(() => {- setDocumentIds(reference?.doc_aggs.map((x) => x.doc_id) ?? []);+ setDocumentIds(reference?.doc_aggs?.map((x) => x.doc_id) ?? []);}, [reference, setDocumentIds]);const handleDocumentButtonClick = useCallback(