diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index edec85f1..f36f73b0 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -469,9 +469,8 @@ class LightRAG: error_msg = f"Failed to process document {doc_id}: {str(e)}\n{traceback.format_exc()}" logger.error(error_msg) continue - - finally: - # Ensure all indexes are updated after each document + else: + # Only update index when processing succeeds await self._insert_done() def insert_custom_chunks(self, full_text: str, text_chunks: list[str]): diff --git a/lightrag/utils.py b/lightrag/utils.py index ce556ab2..f36e03e2 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -479,9 +479,7 @@ async def handle_cache(hashing_kv, args_hash, prompt, mode="default"): quantized = min_val = max_val = None if is_embedding_cache_enabled: # Use embedding cache - embedding_model_func = hashing_kv.global_config[ - "embedding_func" - ].func # ["func"] + embedding_model_func = hashing_kv.global_config["embedding_func"]["func"] llm_model_func = hashing_kv.global_config.get("llm_model_func") current_embedding = await embedding_model_func([prompt])