mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-12-24 05:12:16 +00:00
Disable document deletion when LLM cache for extraction is off
This commit is contained in:
parent
1973c80dca
commit
c18065a912
@ -355,7 +355,13 @@ def create_app(args):
|
||||
)
|
||||
|
||||
# Add routes
|
||||
app.include_router(create_document_routes(rag, doc_manager, api_key))
|
||||
app.include_router(
|
||||
create_document_routes(
|
||||
rag,
|
||||
doc_manager,
|
||||
api_key,
|
||||
)
|
||||
)
|
||||
app.include_router(create_query_routes(rag, api_key, args.top_k))
|
||||
app.include_router(create_graph_routes(rag, api_key))
|
||||
|
||||
|
||||
@ -1382,6 +1382,7 @@ def create_document_routes(
|
||||
"""
|
||||
Deletes a specific document and all its associated data, including its status,
|
||||
text chunks, vector embeddings, and any related graph data.
|
||||
It is disabled when llm cache for entity extraction is disabled.
|
||||
|
||||
This operation is irreversible and will interact with the pipeline status.
|
||||
|
||||
@ -1399,6 +1400,13 @@ def create_document_routes(
|
||||
HTTPException:
|
||||
- 500: If an unexpected internal error occurs.
|
||||
"""
|
||||
# The rag object is initialized from the server startup args,
|
||||
# so we can access its properties here.
|
||||
if not rag.enable_llm_cache_for_entity_extract:
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
detail="Operation not allowed when LLM cache for entity extraction is disabled.",
|
||||
)
|
||||
from lightrag.kg.shared_storage import (
|
||||
get_namespace_data,
|
||||
get_pipeline_status_lock,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user