Disable document deletion when LLM cache for extraction is off
This commit is contained in:
parent
1973c80dca
commit
c18065a912
2 changed files with 15 additions and 1 deletions
|
|
@ -355,7 +355,13 @@ def create_app(args):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add routes
|
# 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_query_routes(rag, api_key, args.top_k))
|
||||||
app.include_router(create_graph_routes(rag, api_key))
|
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,
|
Deletes a specific document and all its associated data, including its status,
|
||||||
text chunks, vector embeddings, and any related graph data.
|
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.
|
This operation is irreversible and will interact with the pipeline status.
|
||||||
|
|
||||||
|
|
@ -1399,6 +1400,13 @@ def create_document_routes(
|
||||||
HTTPException:
|
HTTPException:
|
||||||
- 500: If an unexpected internal error occurs.
|
- 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 (
|
from lightrag.kg.shared_storage import (
|
||||||
get_namespace_data,
|
get_namespace_data,
|
||||||
get_pipeline_status_lock,
|
get_pipeline_status_lock,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue