diff --git a/lightrag/api/config.py b/lightrag/api/config.py index 2e15fd3a4da871b7ce8866ecf5b071944b25c8ac..ad0e670bdac67e1a4ac151f86cab49f93b68fd85 100644 --- a/lightrag/api/config.py +++ b/lightrag/api/config.py @@ -244,6 +244,9 @@ def parse_args() -> argparse.Namespace: # Get MAX_PARALLEL_INSERT from environment args.max_parallel_insert = get_env_value("MAX_PARALLEL_INSERT", 2, int) + # Get MAX_GRAPH_NODES from environment + args.max_graph_nodes = get_env_value("MAX_GRAPH_NODES", 1000, 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 7a34ab5c4e50d248830479113c8bf3900e9775e2..cd87af22f4c4079548daa5eac1b4d1bcbdd464bf 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -326,6 +326,7 @@ def create_app(args): enable_llm_cache=args.enable_llm_cache, auto_manage_storages_states=False, max_parallel_insert=args.max_parallel_insert, + max_graph_nodes=args.max_graph_nodes, addon_params={"language": args.summary_language}, ) else: # azure_openai @@ -353,6 +354,7 @@ def create_app(args): enable_llm_cache=args.enable_llm_cache, auto_manage_storages_states=False, max_parallel_insert=args.max_parallel_insert, + max_graph_nodes=args.max_graph_nodes, addon_params={"language": args.summary_language}, ) @@ -475,7 +477,7 @@ def create_app(args): "enable_llm_cache_for_extract": args.enable_llm_cache_for_extract, "enable_llm_cache": args.enable_llm_cache, "workspace": args.workspace, - "max_graph_nodes": os.getenv("MAX_GRAPH_NODES"), + "max_graph_nodes": args.max_graph_nodes, }, "auth_mode": auth_mode, "pipeline_busy": pipeline_status.get("busy", False), diff --git a/lightrag/api/webui/assets/_basePickBy-BSdLglB8.js b/lightrag/api/webui/assets/_basePickBy-BVZSZRdU.js similarity index 95% rename from lightrag/api/webui/assets/_basePickBy-BSdLglB8.js rename to lightrag/api/webui/assets/_basePickBy-BVZSZRdU.js index 82e45b0d5a67aa8ec23bb1edea16daf5792507b5..16c3a2a61542c8b11439554abc8aa46fc6847532 100644 Binary files a/lightrag/api/webui/assets/_basePickBy-BSdLglB8.js and b/lightrag/api/webui/assets/_basePickBy-BVZSZRdU.js differ diff --git a/lightrag/api/webui/assets/_baseUniq-UvGlUd6J.js b/lightrag/api/webui/assets/_baseUniq-CoKY6BVy.js similarity index 98% rename from lightrag/api/webui/assets/_baseUniq-UvGlUd6J.js rename to lightrag/api/webui/assets/_baseUniq-CoKY6BVy.js index a93129c9504ffa701135205951b065b3eec3559f..1378c5cdc6c064d38211bdaf4d38ee447818e72b 100644 Binary files a/lightrag/api/webui/assets/_baseUniq-UvGlUd6J.js and b/lightrag/api/webui/assets/_baseUniq-CoKY6BVy.js differ diff --git a/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-BniHOq-e.js b/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-vef8RqWB.js similarity index 99% rename from lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-BniHOq-e.js rename to lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-vef8RqWB.js index d25c1526b080de75d28eabea4f556fe95e40f818..e1202dbb8a961fb615cebc1360c3adbd4707e777 100644 Binary files a/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-BniHOq-e.js and b/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-vef8RqWB.js differ diff --git a/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-DIN2mi-0.js b/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CbrB0eRz.js similarity index 99% rename from lightrag/api/webui/assets/blockDiagram-JOT3LUYC-DIN2mi-0.js rename to lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CbrB0eRz.js index 84f64223f7e8aab756f2624b21ac397a80be2918..29588baaa3532503cec73933ce60b61d145c7813 100644 Binary files a/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-DIN2mi-0.js and b/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CbrB0eRz.js differ diff --git a/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-BJN20C_B.js b/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-1eEG1RbS.js similarity index 99% rename from lightrag/api/webui/assets/c4Diagram-VJAJSXHY-BJN20C_B.js rename to lightrag/api/webui/assets/c4Diagram-VJAJSXHY-1eEG1RbS.js index 1bff779a978d17c32f4935d48cccfdf56e810f24..4a0a194ebf818a7ee8aee5dceb8b7df6d4e51bb3 100644 Binary files a/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-BJN20C_B.js and b/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-1eEG1RbS.js differ diff --git a/lightrag/api/webui/assets/chunk-4BMEZGHF-B1TxGISA.js b/lightrag/api/webui/assets/chunk-4BMEZGHF-BqribV_z.js similarity index 78% rename from lightrag/api/webui/assets/chunk-4BMEZGHF-B1TxGISA.js rename to lightrag/api/webui/assets/chunk-4BMEZGHF-BqribV_z.js index 34e3ccb13daee3b962a0fc719f88515bc3a001e7..a74d0312ace7b227fd13c9d69cf624326cacf70c 100644 Binary files a/lightrag/api/webui/assets/chunk-4BMEZGHF-B1TxGISA.js and b/lightrag/api/webui/assets/chunk-4BMEZGHF-BqribV_z.js differ diff --git a/lightrag/api/webui/assets/chunk-A2AXSNBT-9BBpDWtu.js b/lightrag/api/webui/assets/chunk-A2AXSNBT-79sAOFxS.js similarity index 99% rename from lightrag/api/webui/assets/chunk-A2AXSNBT-9BBpDWtu.js rename to lightrag/api/webui/assets/chunk-A2AXSNBT-79sAOFxS.js index e5d752b2de33005c0a44659b58647aef19923fc3..d5c1d3847f25bb5430fe58c48f51773c92a5f950 100644 Binary files a/lightrag/api/webui/assets/chunk-A2AXSNBT-9BBpDWtu.js and b/lightrag/api/webui/assets/chunk-A2AXSNBT-79sAOFxS.js differ diff --git a/lightrag/api/webui/assets/chunk-AEK57VVT-CXtM_4Od.js b/lightrag/api/webui/assets/chunk-AEK57VVT-C_8ebDHI.js similarity index 99% rename from lightrag/api/webui/assets/chunk-AEK57VVT-CXtM_4Od.js rename to lightrag/api/webui/assets/chunk-AEK57VVT-C_8ebDHI.js index ffced50b8521aada9ffe224ce12603722eed0a9e..8b62e3518e1e18798b8dfb18f5a9319604d4aaef 100644 Binary files a/lightrag/api/webui/assets/chunk-AEK57VVT-CXtM_4Od.js and b/lightrag/api/webui/assets/chunk-AEK57VVT-C_8ebDHI.js differ diff --git a/lightrag/api/webui/assets/chunk-D6G4REZN-CxUcE0YF.js b/lightrag/api/webui/assets/chunk-D6G4REZN-DYSFhgH1.js similarity index 95% rename from lightrag/api/webui/assets/chunk-D6G4REZN-CxUcE0YF.js rename to lightrag/api/webui/assets/chunk-D6G4REZN-DYSFhgH1.js index 2a6304cacb7c17f6ef56c72f39ae90f27c7f31f1..95004ab2cc15be9e225527e7b1eca448d3064271 100644 Binary files a/lightrag/api/webui/assets/chunk-D6G4REZN-CxUcE0YF.js and b/lightrag/api/webui/assets/chunk-D6G4REZN-DYSFhgH1.js differ diff --git a/lightrag/api/webui/assets/chunk-RZ5BOZE2-Du3GUvfy.js b/lightrag/api/webui/assets/chunk-RZ5BOZE2-PbmQbmec.js similarity index 81% rename from lightrag/api/webui/assets/chunk-RZ5BOZE2-Du3GUvfy.js rename to lightrag/api/webui/assets/chunk-RZ5BOZE2-PbmQbmec.js index c87a9bd242f5c47ee61a0402a58d573eeb93e073..a9cd68174ff2a59e2e96fe0c3573d2ad6b65da8d 100644 Binary files a/lightrag/api/webui/assets/chunk-RZ5BOZE2-Du3GUvfy.js and b/lightrag/api/webui/assets/chunk-RZ5BOZE2-PbmQbmec.js differ diff --git a/lightrag/api/webui/assets/chunk-XZIHB7SX-HOIwmCiB.js b/lightrag/api/webui/assets/chunk-XZIHB7SX-UCc0agNy.js similarity index 67% rename from lightrag/api/webui/assets/chunk-XZIHB7SX-HOIwmCiB.js rename to lightrag/api/webui/assets/chunk-XZIHB7SX-UCc0agNy.js index 7062482254815dbd68024e4d3529764b8a53091f..db7265e9ae62fd41aa0f45ef1345492107434382 100644 Binary files a/lightrag/api/webui/assets/chunk-XZIHB7SX-HOIwmCiB.js and b/lightrag/api/webui/assets/chunk-XZIHB7SX-UCc0agNy.js differ diff --git a/lightrag/api/webui/assets/classDiagram-GIVACNV2-f9sRw-GR.js b/lightrag/api/webui/assets/classDiagram-GIVACNV2-CtQONuGk.js similarity index 61% rename from lightrag/api/webui/assets/classDiagram-GIVACNV2-f9sRw-GR.js rename to lightrag/api/webui/assets/classDiagram-GIVACNV2-CtQONuGk.js index b335b4d5f992057b57ae7d2939904d5fa5c6fffc..8c8238eac7191c0b0223674f65bab0a36d87d394 100644 Binary files a/lightrag/api/webui/assets/classDiagram-GIVACNV2-f9sRw-GR.js and b/lightrag/api/webui/assets/classDiagram-GIVACNV2-CtQONuGk.js differ diff --git a/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-f9sRw-GR.js b/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-CtQONuGk.js similarity index 61% rename from lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-f9sRw-GR.js rename to lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-CtQONuGk.js index b335b4d5f992057b57ae7d2939904d5fa5c6fffc..8c8238eac7191c0b0223674f65bab0a36d87d394 100644 Binary files a/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-f9sRw-GR.js and b/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-CtQONuGk.js differ diff --git a/lightrag/api/webui/assets/clone-JfI4KmSh.js b/lightrag/api/webui/assets/clone-JfI4KmSh.js deleted file mode 100644 index 68f1c746dc4bc5189eabd31d633c9179d413781b..0000000000000000000000000000000000000000 Binary files a/lightrag/api/webui/assets/clone-JfI4KmSh.js and /dev/null differ diff --git a/lightrag/api/webui/assets/clone-UTZGcTvC.js b/lightrag/api/webui/assets/clone-UTZGcTvC.js new file mode 100644 index 0000000000000000000000000000000000000000..9e8db024cf58cdb27def748a31e92da56eb03205 Binary files /dev/null and b/lightrag/api/webui/assets/clone-UTZGcTvC.js differ diff --git a/lightrag/api/webui/assets/dagre-OKDRZEBW-BfLyJCXh.js b/lightrag/api/webui/assets/dagre-OKDRZEBW-B2QKcgt1.js similarity index 97% rename from lightrag/api/webui/assets/dagre-OKDRZEBW-BfLyJCXh.js rename to lightrag/api/webui/assets/dagre-OKDRZEBW-B2QKcgt1.js index cf95c7bcfc42e2caf67baab20b23a3b8879cc91e..882945118ec0da6b4e7deb23ba17472d6a617844 100644 Binary files a/lightrag/api/webui/assets/dagre-OKDRZEBW-BfLyJCXh.js and b/lightrag/api/webui/assets/dagre-OKDRZEBW-B2QKcgt1.js differ diff --git a/lightrag/api/webui/assets/diagram-SSKATNLV-BPBm_HA_.js b/lightrag/api/webui/assets/diagram-SSKATNLV-C9gAoCDH.js similarity index 93% rename from lightrag/api/webui/assets/diagram-SSKATNLV-BPBm_HA_.js rename to lightrag/api/webui/assets/diagram-SSKATNLV-C9gAoCDH.js index caf246c631f0a34af680672346a061b99cfc4d65..e9d1b64d25f7467311f50552211dc91013febdd5 100644 Binary files a/lightrag/api/webui/assets/diagram-SSKATNLV-BPBm_HA_.js and b/lightrag/api/webui/assets/diagram-SSKATNLV-C9gAoCDH.js differ diff --git a/lightrag/api/webui/assets/diagram-VNBRO52H-B3H-hAHN.js b/lightrag/api/webui/assets/diagram-VNBRO52H-YHo3tP1S.js similarity index 90% rename from lightrag/api/webui/assets/diagram-VNBRO52H-B3H-hAHN.js rename to lightrag/api/webui/assets/diagram-VNBRO52H-YHo3tP1S.js index 29c6300e6b9c09b861d7df5e2df12a2fba2a444c..a3e66eb7b1dbdf507f0a5c0f0dce6e520f2edc3b 100644 Binary files a/lightrag/api/webui/assets/diagram-VNBRO52H-B3H-hAHN.js and b/lightrag/api/webui/assets/diagram-VNBRO52H-YHo3tP1S.js differ diff --git a/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-B0M4Dgpb.js b/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-BZdHFlc9.js similarity index 99% rename from lightrag/api/webui/assets/erDiagram-Q7BY3M3F-B0M4Dgpb.js rename to lightrag/api/webui/assets/erDiagram-Q7BY3M3F-BZdHFlc9.js index eb98a356d2909e5e3b2e2749c901770e1a24d1e2..1b255041c8ad831be3abbe4f92b8398cbee01853 100644 Binary files a/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-B0M4Dgpb.js and b/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-BZdHFlc9.js differ diff --git a/lightrag/api/webui/assets/feature-documents-DYAipKCP.js b/lightrag/api/webui/assets/feature-documents-CSExwz2a.js similarity index 99% rename from lightrag/api/webui/assets/feature-documents-DYAipKCP.js rename to lightrag/api/webui/assets/feature-documents-CSExwz2a.js index 2739291dfa60eb14969fa3be2fe48d1ec7edc2df..3b5563f0dc2915780a64842d4bc97a3f6aed5874 100644 Binary files a/lightrag/api/webui/assets/feature-documents-DYAipKCP.js and b/lightrag/api/webui/assets/feature-documents-CSExwz2a.js differ diff --git a/lightrag/api/webui/assets/feature-graph-D-mwOi0p.js b/lightrag/api/webui/assets/feature-graph-D-mwOi0p.js new file mode 100644 index 0000000000000000000000000000000000000000..e11568773fc8c90f8e677d500d838f25a6c8434b Binary files /dev/null and b/lightrag/api/webui/assets/feature-graph-D-mwOi0p.js differ diff --git a/lightrag/api/webui/assets/feature-graph-yCDRht5b.js b/lightrag/api/webui/assets/feature-graph-yCDRht5b.js deleted file mode 100644 index c687afd64233d44cc27ba444ef12b1629768e57c..0000000000000000000000000000000000000000 Binary files a/lightrag/api/webui/assets/feature-graph-yCDRht5b.js and /dev/null differ diff --git a/lightrag/api/webui/assets/feature-retrieval-DRE_iZah.js b/lightrag/api/webui/assets/feature-retrieval-BhEQ7fz5.js similarity index 99% rename from lightrag/api/webui/assets/feature-retrieval-DRE_iZah.js rename to lightrag/api/webui/assets/feature-retrieval-BhEQ7fz5.js index b7fc4eda2aa6e03e653e255dd352bdd04a393d70..a9edd19e8b420e1a97d2caa95b56cdba2c199788 100644 Binary files a/lightrag/api/webui/assets/feature-retrieval-DRE_iZah.js and b/lightrag/api/webui/assets/feature-retrieval-BhEQ7fz5.js differ diff --git a/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-0O9i7rCc.js b/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-Cyoqee_Z.js similarity index 99% rename from lightrag/api/webui/assets/flowDiagram-4HSFHLVR-0O9i7rCc.js rename to lightrag/api/webui/assets/flowDiagram-4HSFHLVR-Cyoqee_Z.js index c93ec36f69dd8b1b8bfc3d17832f495e2b8f681b..106d00c9775bfb39a29fd4735c1379635e8ff473 100644 Binary files a/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-0O9i7rCc.js and b/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-Cyoqee_Z.js differ diff --git a/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-r6T2Qk9A.js b/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-8xxuNmi-.js similarity index 99% rename from lightrag/api/webui/assets/ganttDiagram-APWFNJXF-r6T2Qk9A.js rename to lightrag/api/webui/assets/ganttDiagram-APWFNJXF-8xxuNmi-.js index 33767b82e5661fa1bfd898e02df95f4796546ee1..b042010c1c76aacc9294870e735ee0980b062a7d 100644 Binary files a/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-r6T2Qk9A.js and b/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-8xxuNmi-.js differ diff --git a/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-Bu88rIEh.js b/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C00chpNw.js similarity index 98% rename from lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-Bu88rIEh.js rename to lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C00chpNw.js index b8b1d28d586cdaa7bbd26c9d7f065e7b9d240bac..2b32a678c599f96d0c5ff7e8b43c329662390dc3 100644 Binary files a/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-Bu88rIEh.js and b/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C00chpNw.js differ diff --git a/lightrag/api/webui/assets/graph-BA-Xpc80.js b/lightrag/api/webui/assets/graph-gg_UPtwE.js similarity index 97% rename from lightrag/api/webui/assets/graph-BA-Xpc80.js rename to lightrag/api/webui/assets/graph-gg_UPtwE.js index 5337dca6b9b9b0be08f2deaa3484e50bc8598da8..43f325ff48828f4777d37e231e058a7906b4d00d 100644 Binary files a/lightrag/api/webui/assets/graph-BA-Xpc80.js and b/lightrag/api/webui/assets/graph-gg_UPtwE.js differ diff --git a/lightrag/api/webui/assets/index-BlAjHenV.js b/lightrag/api/webui/assets/index-CZQXgxUO.js similarity index 99% rename from lightrag/api/webui/assets/index-BlAjHenV.js rename to lightrag/api/webui/assets/index-CZQXgxUO.js index cee1a59cf48ddc5395bb061022d64b37f553dd62..9ebb2e9c8b5a937f3ab356e107afebc03448daf9 100644 Binary files a/lightrag/api/webui/assets/index-BlAjHenV.js and b/lightrag/api/webui/assets/index-CZQXgxUO.js differ diff --git a/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-Ccvh5jh9.js b/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-DKUJQA1J.js similarity index 61% rename from lightrag/api/webui/assets/infoDiagram-PH2N3AL5-Ccvh5jh9.js rename to lightrag/api/webui/assets/infoDiagram-PH2N3AL5-DKUJQA1J.js index e9fe825fdf7fe09f2b0f5025bf681afd85223580..1c1c8eab0c8937e7afb68fa773c1496622020bdc 100644 Binary files a/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-Ccvh5jh9.js and b/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-DKUJQA1J.js differ diff --git a/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-Bjko5wAq.js b/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-C9ZzbUpH.js similarity index 99% rename from lightrag/api/webui/assets/journeyDiagram-U35MCT3I-Bjko5wAq.js rename to lightrag/api/webui/assets/journeyDiagram-U35MCT3I-C9ZzbUpH.js index ce09e62d3e3d563ecc763032a2271fa128f2a3f5..8d5cbd3bfedee8660907434f17e662b5db79d86a 100644 Binary files a/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-Bjko5wAq.js and b/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-C9ZzbUpH.js differ diff --git a/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-CI4n-C9D.js b/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-BMGhZtt7.js similarity index 99% rename from lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-CI4n-C9D.js rename to lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-BMGhZtt7.js index 80ec463a8a47777c2a1760e11e65cb89826a3b1e..7a5138228745279955f716e7307e437038e67ee1 100644 Binary files a/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-CI4n-C9D.js and b/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-BMGhZtt7.js differ diff --git a/lightrag/api/webui/assets/layout-DVOtj2IM.js b/lightrag/api/webui/assets/layout-DgVd6nly.js similarity index 99% rename from lightrag/api/webui/assets/layout-DVOtj2IM.js rename to lightrag/api/webui/assets/layout-DgVd6nly.js index d52c1c29d01ee9bbd3b1c1fe084d3cb2e1b4f868..76893b93d0653b432f3d975282f008255d8c5204 100644 Binary files a/lightrag/api/webui/assets/layout-DVOtj2IM.js and b/lightrag/api/webui/assets/layout-DgVd6nly.js differ diff --git a/lightrag/api/webui/assets/mermaid-vendor-DnUYjsdS.js b/lightrag/api/webui/assets/mermaid-vendor-BVBgFwCv.js similarity index 99% rename from lightrag/api/webui/assets/mermaid-vendor-DnUYjsdS.js rename to lightrag/api/webui/assets/mermaid-vendor-BVBgFwCv.js index 8f7bd754fc6763d932fe8feb7902f2bc150acb0b..aee1a4428e189de60a316e09c34b1acae41a8bd3 100644 Binary files a/lightrag/api/webui/assets/mermaid-vendor-DnUYjsdS.js and b/lightrag/api/webui/assets/mermaid-vendor-BVBgFwCv.js differ diff --git a/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-C4YiM3o9.js b/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-Dy7fqjSb.js similarity index 99% rename from lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-C4YiM3o9.js rename to lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-Dy7fqjSb.js index 9e62ed4afe43db084368ed9b4c66d854bf1ed1b9..1afafcb9657f8d663ebc8c071c26e2277fb20853 100644 Binary files a/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-C4YiM3o9.js and b/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-Dy7fqjSb.js differ diff --git a/lightrag/api/webui/assets/pieDiagram-IB7DONF6-Riizpkaf.js b/lightrag/api/webui/assets/pieDiagram-IB7DONF6-DDY8pHxZ.js similarity index 91% rename from lightrag/api/webui/assets/pieDiagram-IB7DONF6-Riizpkaf.js rename to lightrag/api/webui/assets/pieDiagram-IB7DONF6-DDY8pHxZ.js index c62d51e16ba7bff0da1ddad29d6243ac8753576f..f2712162fc14682af2df7652f199362b55469836 100644 Binary files a/lightrag/api/webui/assets/pieDiagram-IB7DONF6-Riizpkaf.js and b/lightrag/api/webui/assets/pieDiagram-IB7DONF6-DDY8pHxZ.js differ diff --git a/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-CzGAtLV_.js b/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-9aLJ3TJw.js similarity index 99% rename from lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-CzGAtLV_.js rename to lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-9aLJ3TJw.js index 102df13a68eb164dd0bcb5138fe679320a7348c3..6abb91f74cad683b7f89c8ffe30b10ed19d35504 100644 Binary files a/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-CzGAtLV_.js and b/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-9aLJ3TJw.js differ diff --git a/lightrag/api/webui/assets/radar-MK3ICKWK-CpuAiCbQ.js b/lightrag/api/webui/assets/radar-MK3ICKWK-B0N6XiM2.js similarity index 99% rename from lightrag/api/webui/assets/radar-MK3ICKWK-CpuAiCbQ.js rename to lightrag/api/webui/assets/radar-MK3ICKWK-B0N6XiM2.js index 04bf59519a4b692eb3644554cee33075d7ce015b..266f93d7013f57c7161aacc72c3cfd284a79ab9a 100644 Binary files a/lightrag/api/webui/assets/radar-MK3ICKWK-CpuAiCbQ.js and b/lightrag/api/webui/assets/radar-MK3ICKWK-B0N6XiM2.js differ diff --git a/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-CgGQX3wU.js b/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-DqX-DNvM.js similarity index 99% rename from lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-CgGQX3wU.js rename to lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-DqX-DNvM.js index ae3d1eacbe2a78418fca5562a6d8dac832ebe93c..e2977516ace47a43459a2d571b2037e232de8b28 100644 Binary files a/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-CgGQX3wU.js and b/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-DqX-DNvM.js differ diff --git a/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DqnzGw22.js b/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-BrbjIPio.js similarity index 99% rename from lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DqnzGw22.js rename to lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-BrbjIPio.js index d3372dd82bac985113d81d30f62726b7c6889a65..7ef17c838dcf22b28edb4e664ab62f95eb1c303c 100644 Binary files a/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DqnzGw22.js and b/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-BrbjIPio.js differ diff --git a/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-YUSWxee1.js b/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-wqcg8nnG.js similarity index 99% rename from lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-YUSWxee1.js rename to lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-wqcg8nnG.js index 06fe50496272119f4409390d220763d947f3c1c1..2b1f7acd6040c7820eadbd196f8bca8e4e1b1d67 100644 Binary files a/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-YUSWxee1.js and b/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-wqcg8nnG.js differ diff --git a/lightrag/api/webui/assets/stateDiagram-DGXRK772-DZnU_4RL.js b/lightrag/api/webui/assets/stateDiagram-DGXRK772-CGL2vL66.js similarity index 96% rename from lightrag/api/webui/assets/stateDiagram-DGXRK772-DZnU_4RL.js rename to lightrag/api/webui/assets/stateDiagram-DGXRK772-CGL2vL66.js index 0b787f3959448ac846ebb44f2b39419c233b6e84..4b8cae845868de86acee61c9d17b6068d1c60e6b 100644 Binary files a/lightrag/api/webui/assets/stateDiagram-DGXRK772-DZnU_4RL.js and b/lightrag/api/webui/assets/stateDiagram-DGXRK772-CGL2vL66.js differ diff --git a/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-ZS0tnvcs.js b/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-DIpE_gWh.js similarity index 61% rename from lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-ZS0tnvcs.js rename to lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-DIpE_gWh.js index 67ee3fd4ed03d233a09afeacb737084588695465..9ee064090a0dd51fb5c4f731de323fb8238bacc7 100644 Binary files a/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-ZS0tnvcs.js and b/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-DIpE_gWh.js differ diff --git a/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-Cl68_gMM.js b/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CwuNSBuu.js similarity index 99% rename from lightrag/api/webui/assets/timeline-definition-BDJGKUSR-Cl68_gMM.js rename to lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CwuNSBuu.js index 97e6c0601632e2d09be6cbd7c7384e6fe12d6ffe..29e7401e08817483fc3db8f6c2cd486fca0c0e5f 100644 Binary files a/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-Cl68_gMM.js and b/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CwuNSBuu.js differ diff --git a/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-Bc_rddYS.js b/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-B1xgKNPc.js similarity index 99% rename from lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-Bc_rddYS.js rename to lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-B1xgKNPc.js index 0ddbc20489bdd759a3b1e7b58b975680b9ff5ad5..4092209cb8496b0a4bce73f07c7e63fad5d77b31 100644 Binary files a/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-Bc_rddYS.js and b/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-B1xgKNPc.js differ diff --git a/lightrag/api/webui/index.html b/lightrag/api/webui/index.html index d156be81c227a21b21bde3beea74f07089c27725..5064f712fcc98b3ada6db795a9c83a3d5c33fadc 100644 Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ diff --git a/lightrag/kg/mongo_impl.py b/lightrag/kg/mongo_impl.py index ace28432bf7d025be0b7bbccc143926f6cfed6d3..dcf993271a23f67b211457f97e682a95bc300245 100644 --- a/lightrag/kg/mongo_impl.py +++ b/lightrag/kg/mongo_impl.py @@ -34,8 +34,6 @@ from pymongo.errors import PyMongoError # type: ignore config = configparser.ConfigParser() config.read("config.ini", "utf-8") -# Get maximum number of graph nodes from environment variable, default is 1000 -MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000)) GRAPH_BFS_MODE = os.getenv("MONGO_GRAPH_BFS_MODE", "bidirectional") @@ -883,7 +881,7 @@ class MongoGraphStorage(BaseGraphStorage): ) async def get_knowledge_graph_all_by_degree( - self, max_depth: int = 3, max_nodes: int = MAX_GRAPH_NODES + self, max_depth: int, max_nodes: int ) -> KnowledgeGraph: """ It's possible that the node with one or multiple relationships is retrieved, @@ -961,9 +959,9 @@ class MongoGraphStorage(BaseGraphStorage): node_labels: list[str], seen_nodes: set[str], result: KnowledgeGraph, - depth: int = 0, - max_depth: int = 3, - max_nodes: int = MAX_GRAPH_NODES, + depth: int, + max_depth: int, + max_nodes: int, ) -> KnowledgeGraph: if depth > max_depth or len(result.nodes) > max_nodes: return result @@ -1006,9 +1004,9 @@ class MongoGraphStorage(BaseGraphStorage): async def get_knowledge_subgraph_bidirectional_bfs( self, node_label: str, - depth=0, - max_depth: int = 3, - max_nodes: int = MAX_GRAPH_NODES, + depth: int, + max_depth: int, + max_nodes: int, ) -> KnowledgeGraph: seen_nodes = set() seen_edges = set() @@ -1038,7 +1036,7 @@ class MongoGraphStorage(BaseGraphStorage): return result async def get_knowledge_subgraph_in_out_bound_bfs( - self, node_label: str, max_depth: int = 3, max_nodes: int = MAX_GRAPH_NODES + self, node_label: str, max_depth: int, max_nodes: int ) -> KnowledgeGraph: seen_nodes = set() seen_edges = set() @@ -1152,7 +1150,7 @@ class MongoGraphStorage(BaseGraphStorage): self, node_label: str, max_depth: int = 3, - max_nodes: int = MAX_GRAPH_NODES, + max_nodes: int = None, ) -> KnowledgeGraph: """ Retrieve a connected subgraph of nodes where the label includes the specified `node_label`. @@ -1160,7 +1158,7 @@ class MongoGraphStorage(BaseGraphStorage): Args: node_label: Label of the starting node, * means all nodes max_depth: Maximum depth of the subgraph, Defaults to 3 - max_nodes: Maxiumu nodes to return, Defaults to 1000 + max_nodes: Maximum nodes to return, Defaults to global_config max_graph_nodes Returns: KnowledgeGraph object containing nodes and edges, with an is_truncated flag @@ -1184,6 +1182,13 @@ class MongoGraphStorage(BaseGraphStorage): C → B C → D """ + # Use global_config max_graph_nodes as default if max_nodes is None + if max_nodes is None: + max_nodes = self.global_config.get("max_graph_nodes", 1000) + else: + # Limit max_nodes to not exceed global_config max_graph_nodes + max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000)) + result = KnowledgeGraph() start = time.perf_counter() diff --git a/lightrag/kg/neo4j_impl.py b/lightrag/kg/neo4j_impl.py index 63a3300a511b178bdb958e3bc9bf48cf8b09bf04..b0efc4b56817f324ec2afd64bfe207ff89ebb60f 100644 --- a/lightrag/kg/neo4j_impl.py +++ b/lightrag/kg/neo4j_impl.py @@ -36,9 +36,6 @@ from dotenv import load_dotenv # the OS environment variables take precedence over the .env file load_dotenv(dotenv_path=".env", override=False) -# Get maximum number of graph nodes from environment variable, default is 1000 -MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000)) - config = configparser.ConfigParser() config.read("config.ini", "utf-8") @@ -902,7 +899,7 @@ class Neo4JStorage(BaseGraphStorage): self, node_label: str, max_depth: int = 3, - max_nodes: int = MAX_GRAPH_NODES, + max_nodes: int = None, ) -> KnowledgeGraph: """ Retrieve a connected subgraph of nodes where the label includes the specified `node_label`. @@ -916,6 +913,13 @@ class Neo4JStorage(BaseGraphStorage): KnowledgeGraph object containing nodes and edges, with an is_truncated flag indicating whether the graph was truncated due to max_nodes limit """ + # Get max_nodes from global_config if not provided + if max_nodes is None: + max_nodes = self.global_config.get("max_graph_nodes", 1000) + else: + # Limit max_nodes to not exceed global_config max_graph_nodes + max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000)) + workspace_label = self._get_workspace_label() result = KnowledgeGraph() seen_nodes = set() diff --git a/lightrag/kg/networkx_impl.py b/lightrag/kg/networkx_impl.py index faff6a964c3323eb977c46f880b25ed232d62f42..01b345662523ad46d69edd2e9957d5b9f9d338f8 100644 --- a/lightrag/kg/networkx_impl.py +++ b/lightrag/kg/networkx_impl.py @@ -26,8 +26,6 @@ from dotenv import load_dotenv # the OS environment variables take precedence over the .env file load_dotenv(dotenv_path=".env", override=False) -MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000)) - @final @dataclass @@ -218,7 +216,7 @@ class NetworkXStorage(BaseGraphStorage): self, node_label: str, max_depth: int = 3, - max_nodes: int = MAX_GRAPH_NODES, + max_nodes: int = None, ) -> KnowledgeGraph: """ Retrieve a connected subgraph of nodes where the label includes the specified `node_label`. @@ -232,6 +230,13 @@ class NetworkXStorage(BaseGraphStorage): KnowledgeGraph object containing nodes and edges, with an is_truncated flag indicating whether the graph was truncated due to max_nodes limit """ + # Get max_nodes from global_config if not provided + if max_nodes is None: + max_nodes = self.global_config.get("max_graph_nodes", 1000) + else: + # Limit max_nodes to not exceed global_config max_graph_nodes + max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000)) + graph = await self._get_graph() result = KnowledgeGraph() diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index 5750fd6e712a7f7a0daf6fc56d0ba6e7eae9efd7..7e696c77ee068672ba35d832141b655600c8ea2f 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -45,9 +45,6 @@ from dotenv import load_dotenv # the OS environment variables take precedence over the .env file load_dotenv(dotenv_path=".env", override=False) -# Get maximum number of graph nodes from environment variable, default is 1000 -MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000)) - class PostgreSQLDB: def __init__(self, config: dict[str, Any], **kwargs: Any): @@ -2819,7 +2816,7 @@ class PGGraphStorage(BaseGraphStorage): self, node_label: str, max_depth: int = 3, - max_nodes: int = MAX_GRAPH_NODES, + max_nodes: int = None, ) -> KnowledgeGraph: """ Retrieve a connected subgraph of nodes where the label includes the specified `node_label`. @@ -2827,12 +2824,18 @@ class PGGraphStorage(BaseGraphStorage): Args: node_label: Label of the starting node, * means all nodes max_depth: Maximum depth of the subgraph, Defaults to 3 - max_nodes: Maxiumu nodes to return, Defaults to 1000 + max_nodes: Maximum nodes to return, Defaults to global_config max_graph_nodes Returns: KnowledgeGraph object containing nodes and edges, with an is_truncated flag indicating whether the graph was truncated due to max_nodes limit """ + # Use global_config max_graph_nodes as default if max_nodes is None + if max_nodes is None: + max_nodes = self.global_config.get("max_graph_nodes", 1000) + else: + # Limit max_nodes to not exceed global_config max_graph_nodes + max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000)) kg = KnowledgeGraph() # Handle wildcard query - get all nodes diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 5d96aebaf32611f44edcdc270cd0c66a318547e1..cbb5e2a89a18353d8083bb57686476247a9b3188 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -258,6 +258,9 @@ class LightRAG: max_parallel_insert: int = field(default=int(os.getenv("MAX_PARALLEL_INSERT", 2))) """Maximum number of parallel insert operations.""" + max_graph_nodes: int = field(default=get_env_value("MAX_GRAPH_NODES", 1000, int)) + """Maximum number of graph nodes to return in knowledge graph queries.""" + addon_params: dict[str, Any] = field( default_factory=lambda: { "language": get_env_value("SUMMARY_LANGUAGE", "English", str) @@ -526,18 +529,24 @@ class LightRAG: self, node_label: str, max_depth: int = 3, - max_nodes: int = 1000, + max_nodes: int = None, ) -> KnowledgeGraph: """Get knowledge graph for a given label Args: node_label (str): Label to get knowledge graph for max_depth (int): Maximum depth of graph - max_nodes (int, optional): Maximum number of nodes to return. Defaults to 1000. + max_nodes (int, optional): Maximum number of nodes to return. Defaults to self.max_graph_nodes. Returns: KnowledgeGraph: Knowledge graph containing nodes and edges """ + # Use self.max_graph_nodes as default if max_nodes is None + if max_nodes is None: + max_nodes = self.max_graph_nodes + else: + # Limit max_nodes to not exceed self.max_graph_nodes + max_nodes = min(max_nodes, self.max_graph_nodes) return await self.chunk_entity_relation_graph.get_knowledge_graph( node_label, max_depth, max_nodes diff --git a/lightrag_webui/src/components/graph/Settings.tsx b/lightrag_webui/src/components/graph/Settings.tsx index 758f6d58d96f9f92babadd53290611720b592042..37a36305b1e20cb1e65435a4e5c67f760d37c505 100644 --- a/lightrag_webui/src/components/graph/Settings.tsx +++ b/lightrag_webui/src/components/graph/Settings.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback} from 'react' +import { useState, useCallback, useEffect} from 'react' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/Popover' import Checkbox from '@/components/ui/Checkbox' import Button from '@/components/ui/Button' @@ -62,6 +62,10 @@ const LabeledNumberInput = ({ // Create unique ID using the label text converted to lowercase with spaces removed const id = `input-${label.toLowerCase().replace(/\s+/g, '-')}`; + useEffect(() => { + setCurrentValue(value) + }, [value]) + const onValueChange = useCallback( (e: React.ChangeEvent) => { const text = e.target.value.trim() @@ -154,6 +158,7 @@ export default function Settings() { const maxEdgeSize = useSettingsStore.use.maxEdgeSize() const graphQueryMaxDepth = useSettingsStore.use.graphQueryMaxDepth() const graphMaxNodes = useSettingsStore.use.graphMaxNodes() + const backendMaxGraphNodes = useSettingsStore.use.backendMaxGraphNodes() const graphLayoutMaxIterations = useSettingsStore.use.graphLayoutMaxIterations() const enableHealthCheck = useSettingsStore.use.enableHealthCheck() @@ -213,14 +218,10 @@ export default function Settings() { }, []) const setGraphMaxNodes = useCallback((nodes: number) => { - if (nodes < 1 || nodes > 1000) return - useSettingsStore.setState({ graphMaxNodes: nodes }) - const currentLabel = useSettingsStore.getState().queryLabel - useSettingsStore.getState().setQueryLabel('') - setTimeout(() => { - useSettingsStore.getState().setQueryLabel(currentLabel) - }, 300) - }, []) + const maxLimit = backendMaxGraphNodes || 1000 + if (nodes < 1 || nodes > maxLimit) return + useSettingsStore.getState().setGraphMaxNodes(nodes, true) + }, [backendMaxGraphNodes]) const setGraphLayoutMaxIterations = useCallback((iterations: number) => { if (iterations < 1) return @@ -360,11 +361,11 @@ export default function Settings() { onEditFinished={setGraphQueryMaxDepth} /> void graphMaxNodes: number - setGraphMaxNodes: (nodes: number) => void + setGraphMaxNodes: (nodes: number, triggerRefresh?: boolean) => void + + backendMaxGraphNodes: number | null + setBackendMaxGraphNodes: (maxNodes: number | null) => void graphLayoutMaxIterations: number setGraphLayoutMaxIterations: (iterations: number) => void @@ -90,6 +93,7 @@ const useSettingsStoreBase = create()( graphQueryMaxDepth: 3, graphMaxNodes: 1000, + backendMaxGraphNodes: null, graphLayoutMaxIterations: 15, queryLabel: defaultQueryLabel, @@ -143,7 +147,27 @@ const useSettingsStoreBase = create()( setGraphQueryMaxDepth: (depth: number) => set({ graphQueryMaxDepth: depth }), - setGraphMaxNodes: (nodes: number) => set({ graphMaxNodes: nodes }), + setGraphMaxNodes: (nodes: number, triggerRefresh: boolean = false) => { + const state = useSettingsStore.getState(); + if (state.graphMaxNodes === nodes) { + return; + } + + if (triggerRefresh) { + const currentLabel = state.queryLabel; + // Atomically update both the node count and the query label to trigger a refresh. + set({ graphMaxNodes: nodes, queryLabel: '' }); + + // Restore the label after a short delay. + setTimeout(() => { + set({ queryLabel: currentLabel }); + }, 300); + } else { + set({ graphMaxNodes: nodes }); + } + }, + + setBackendMaxGraphNodes: (maxNodes: number | null) => set({ backendMaxGraphNodes: maxNodes }), setMinEdgeSize: (size: number) => set({ minEdgeSize: size }), @@ -168,7 +192,7 @@ const useSettingsStoreBase = create()( { name: 'settings-storage', storage: createJSONStorage(() => localStorage), - version: 13, + version: 14, migrate: (state: any, version: number) => { if (version < 2) { state.showEdgeLabel = false @@ -232,6 +256,10 @@ const useSettingsStoreBase = create()( state.querySettings.user_prompt = '' } } + if (version < 14) { + // Add backendMaxGraphNodes field for older versions + state.backendMaxGraphNodes = null + } return state } } diff --git a/lightrag_webui/src/stores/state.ts b/lightrag_webui/src/stores/state.ts index 3bc4560e989b938445d7afb6d1b9088118178c35..c73b3bcd77e0af084f2b1549962f5a992b94fa70 100644 --- a/lightrag_webui/src/stores/state.ts +++ b/lightrag_webui/src/stores/state.ts @@ -1,6 +1,7 @@ import { create } from 'zustand' import { createSelectors } from '@/lib/utils' import { checkHealth, LightragStatus } from '@/api/lightrag' +import { useSettingsStore } from './settings' interface BackendState { health: boolean @@ -58,6 +59,25 @@ const useBackendStateStoreBase = create()((set) => ({ ); } + // Extract and store backend max graph nodes limit + if (health.configuration?.max_graph_nodes) { + const maxNodes = parseInt(health.configuration.max_graph_nodes, 10) + if (!isNaN(maxNodes) && maxNodes > 0) { + const currentBackendMaxNodes = useSettingsStore.getState().backendMaxGraphNodes + + // Only update if the backend limit has actually changed + if (currentBackendMaxNodes !== maxNodes) { + useSettingsStore.getState().setBackendMaxGraphNodes(maxNodes) + + // Auto-adjust current graphMaxNodes if it exceeds the new backend limit + const currentMaxNodes = useSettingsStore.getState().graphMaxNodes + if (currentMaxNodes > maxNodes) { + useSettingsStore.getState().setGraphMaxNodes(maxNodes, true) + } + } + } + } + set({ health: true, message: null,