Fix: KeyError 'history_messages' in apipeline_process_enqueue_documents

This commit is contained in:
NazimRiyadh 2025-12-14 16:23:59 +06:00
parent 9562a974d2
commit 310f8eef69

View file

@ -1650,8 +1650,11 @@ class LightRAG:
"latest_message": "",
}
)
# Cleaning history_messages without breaking it as a shared list object
del pipeline_status["history_messages"][:]
#Fix: Check if key exists before deleting to prevent KeyError
if "history_messages" in pipeline_status:
del pipeline_status["history_messages"][:]
else:
pipeline_status["history_messages"] = []
else:
# Another process is busy, just set request flag and return
pipeline_status["request_pending"] = True