From ca658c2006e4b1d7f2e5fe80f2c60a871fc87fdb Mon Sep 17 00:00:00 2001 From: martsforever Date: Sun, 7 Sep 2025 00:35:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=E4=B8=BA=E7=88=B6?= =?UTF-8?q?=E5=AD=90=E5=88=86=E5=9D=97=E7=84=B6=E5=90=8E=E5=B5=8C=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/LLamaIndexEmbeddings.py | 3 +++ app/utils/milvus_utils.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/utils/LLamaIndexEmbeddings.py b/app/utils/LLamaIndexEmbeddings.py index 0b0977f..79a8794 100644 --- a/app/utils/LLamaIndexEmbeddings.py +++ b/app/utils/LLamaIndexEmbeddings.py @@ -47,3 +47,6 @@ class LLamaIndexEmbeddings(BaseEmbedding): def _get_text_embedding(self, text: str) -> Embedding: return self.embed_query(text) + # 下面的方法没有用,不论如何都会走_get_text_embedding + # async def _aget_text_embedding(self, text: str) -> Embedding: + # return await self.aembed_query(text) diff --git a/app/utils/milvus_utils.py b/app/utils/milvus_utils.py index 85b7df1..9aa0be5 100644 --- a/app/utils/milvus_utils.py +++ b/app/utils/milvus_utils.py @@ -45,7 +45,7 @@ class MilvusService: ) from llama_index.core.node_parser import HierarchicalNodeParser parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128]) - nodes = parser.get_nodes_from_documents(documents) + nodes = await parser.aget_nodes_from_documents(documents) await vector_index.ainsert_nodes(nodes) return vector_index