From 49a485b4143e800116ba7805673c44d3e8fd92c2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Nov 2025 12:13:56 +0000 Subject: [PATCH] Add gleaning configuration display to frontend status - Backend: Add MAX_GLEANING env var support in config.py - Backend: Pass entity_extract_max_gleaning to LightRAG initialization - Backend: Include gleaning config in /health status API response - Frontend: Add gleaning to LightragStatus TypeScript type - Frontend: Display gleaning rounds in StatusCard with quality/speed tradeoff info - i18n: Add English and Chinese translations for gleaning UI - Config: Document MAX_GLEANING parameter in env.example This allows users to see their current gleaning configuration (0=disabled for 2x speed, 1=enabled for higher quality) in the frontend status display. --- env.example | 3 +++ lightrag/api/config.py | 3 +++ lightrag/api/lightrag_server.py | 2 ++ lightrag_webui/src/api/lightrag.ts | 1 + lightrag_webui/src/components/status/StatusCard.tsx | 7 +++++++ lightrag_webui/src/locales/en.json | 3 +++ lightrag_webui/src/locales/zh.json | 3 +++ 7 files changed, 22 insertions(+) diff --git a/env.example b/env.example index 26b4f56e..fd86285f 100644 --- a/env.example +++ b/env.example @@ -167,6 +167,9 @@ MAX_PARALLEL_INSERT=2 # EMBEDDING_FUNC_MAX_ASYNC=8 ### Num of chunks send to Embedding in single request # EMBEDDING_BATCH_NUM=10 +### Entity extraction gleaning rounds (0=disabled for 2x speedup, 1=enabled for higher quality) +### Recommended: 0 for self-hosted models or speed priority, 1 for cloud APIs with quality priority +MAX_GLEANING=1 ########################################################################### ### LLM Configuration diff --git a/lightrag/api/config.py b/lightrag/api/config.py index 4f59d3c1..8d9cab69 100644 --- a/lightrag/api/config.py +++ b/lightrag/api/config.py @@ -346,6 +346,9 @@ def parse_args() -> argparse.Namespace: # Get MAX_GRAPH_NODES from environment args.max_graph_nodes = get_env_value("MAX_GRAPH_NODES", 1000, int) + # Get ENTITY_EXTRACT_MAX_GLEANING from environment + args.entity_extract_max_gleaning = get_env_value("MAX_GLEANING", 1, int) + # Handle openai-ollama special case if args.llm_binding == "openai-ollama": args.llm_binding = "openai" diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index b29e39b2..c10da0b1 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -1021,6 +1021,7 @@ def create_app(args): rerank_model_func=rerank_model_func, max_parallel_insert=args.max_parallel_insert, max_graph_nodes=args.max_graph_nodes, + entity_extract_max_gleaning=args.entity_extract_max_gleaning, addon_params={ "language": args.summary_language, "entity_types": args.entity_types, @@ -1195,6 +1196,7 @@ def create_app(args): "max_async": args.max_async, "embedding_func_max_async": args.embedding_func_max_async, "embedding_batch_num": args.embedding_batch_num, + "entity_extract_max_gleaning": args.entity_extract_max_gleaning, }, "auth_mode": auth_mode, "pipeline_busy": pipeline_status.get("busy", False), diff --git a/lightrag_webui/src/api/lightrag.ts b/lightrag_webui/src/api/lightrag.ts index 7cf1aec6..85cb5d9f 100644 --- a/lightrag_webui/src/api/lightrag.ts +++ b/lightrag_webui/src/api/lightrag.ts @@ -54,6 +54,7 @@ export type LightragStatus = { cosine_threshold: number min_rerank_score: number related_chunk_number: number + entity_extract_max_gleaning: number } update_status?: Record core_version?: string diff --git a/lightrag_webui/src/components/status/StatusCard.tsx b/lightrag_webui/src/components/status/StatusCard.tsx index 8eeaaf70..1655b4bf 100644 --- a/lightrag_webui/src/components/status/StatusCard.tsx +++ b/lightrag_webui/src/components/status/StatusCard.tsx @@ -22,6 +22,13 @@ const StatusCard = ({ status }: { status: LightragStatus | null }) => { cosine {status.configuration.cosine_threshold} / rerank_score {status.configuration.min_rerank_score} / max_related {status.configuration.related_chunk_number} {t('graphPanel.statusCard.maxParallelInsert')}: {status.configuration.max_parallel_insert} + {t('graphPanel.statusCard.entityExtractGleaning')}: + + {status.configuration.entity_extract_max_gleaning === 0 + ? t('graphPanel.statusCard.gleaningDisabled') + : `${status.configuration.entity_extract_max_gleaning} ${t('graphPanel.statusCard.gleaningRounds')}` + } + diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json index ebbba0a7..559cb20a 100644 --- a/lightrag_webui/src/locales/en.json +++ b/lightrag_webui/src/locales/en.json @@ -278,6 +278,9 @@ "workingDirectory": "Working Directory", "inputDirectory": "Input Directory", "maxParallelInsert": "Concurrent Doc Processing", + "entityExtractGleaning": "Gleaning (Entity Extraction)", + "gleaningDisabled": "Disabled (2x faster)", + "gleaningRounds": "rounds (higher quality)", "summarySettings": "Summary Settings", "llmConfig": "LLM Configuration", "llmBinding": "LLM Binding", diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index 8bbca7bb..d92aa4ef 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -278,6 +278,9 @@ "workingDirectory": "工作目录", "inputDirectory": "输入目录", "maxParallelInsert": "并行处理文档", + "entityExtractGleaning": "Gleaning(实体提取拾遗)", + "gleaningDisabled": "已禁用(速度快2倍)", + "gleaningRounds": "轮(质量更高)", "summarySettings": "摘要设置", "llmConfig": "LLM配置", "llmBinding": "LLM绑定",