From 489d7f6c12b1b07141e33f68cc1d0074362645b7 Mon Sep 17 00:00:00 2001 From: ArnoChen Date: Sun, 9 Feb 2025 23:16:11 +0800 Subject: [PATCH] mount graph viewer webui in /webui endpoint --- lightrag/api/lightrag_server.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index 9374153d..b7fffd15 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -123,6 +123,7 @@ if mongo_uri: rag_storage_config.DOC_STATUS_STORAGE = "MongoKVStorage" + def get_default_host(binding_type: str) -> str: default_hosts = { "ollama": os.getenv("LLM_BINDING_HOST", "http://localhost:11434"), @@ -1451,14 +1452,13 @@ def create_app(args): }, } - # webui mount /webui/index.html - # app.mount( - # "/webui", - # StaticFiles( - # directory=Path(__file__).resolve().parent / "webui" / "static", html=True - # ), - # name="webui_static", - # ) + # Webui mount graph_viewer_webui/dist/index.html + webui_dir = Path(__file__).parent / "graph_viewer_webui" / "dist" + app.mount( + "/webui", + StaticFiles(directory=webui_dir, html=True), + name="webui_static", + ) # Serve the static files static_dir = Path(__file__).parent / "static"