Add webui title to api server

This commit is contained in:
yangdx
2025-04-04 21:43:52 +08:00
parent caac0479d3
commit d5da79892f
2 changed files with 19 additions and 5 deletions

View File

@@ -4,10 +4,9 @@
# HOST=0.0.0.0 # HOST=0.0.0.0
# PORT=9621 # PORT=9621
# WORKERS=2 # WORKERS=2
### separating data from difference Lightrag instances
### Max nodes return from grap retrieval
# MAX_GRAPH_NODES=1000
# CORS_ORIGINS=http://localhost:3000,http://localhost:8080 # CORS_ORIGINS=http://localhost:3000,http://localhost:8080
# WEBUI_TITLE='My Best RAG System'
# WEBUI_DESCRIPTION="My Knowledge System Based on LightRAG"
### Optional SSL Configuration ### Optional SSL Configuration
# SSL=true # SSL=true
@@ -21,6 +20,9 @@
### Ollama Emulating Model Tag ### Ollama Emulating Model Tag
# OLLAMA_EMULATING_MODEL_TAG=latest # OLLAMA_EMULATING_MODEL_TAG=latest
### Max nodes return from grap retrieval
# MAX_GRAPH_NODES=1000
### Logging level ### Logging level
# LOG_LEVEL=INFO # LOG_LEVEL=INFO
# VERBOSE=False # VERBOSE=False

View File

@@ -55,6 +55,10 @@ from lightrag.api.auth import auth_handler
# the OS environment variables take precedence over the .env file # the OS environment variables take precedence over the .env file
load_dotenv(dotenv_path=".env", override=False) load_dotenv(dotenv_path=".env", override=False)
webui_title = os.getenv("WEBUI_TITLE")
webui_description = os.getenv("WEBUI_DESCRIPTION")
# Initialize config parser # Initialize config parser
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read("config.ini") config.read("config.ini")
@@ -386,6 +390,8 @@ def create_app(args):
"message": "Authentication is disabled. Using guest access.", "message": "Authentication is disabled. Using guest access.",
"core_version": core_version, "core_version": core_version,
"api_version": __api_version__, "api_version": __api_version__,
"webui_title": webui_title,
"webui_description": webui_description,
} }
return { return {
@@ -393,6 +399,8 @@ def create_app(args):
"auth_mode": "enabled", "auth_mode": "enabled",
"core_version": core_version, "core_version": core_version,
"api_version": __api_version__, "api_version": __api_version__,
"webui_title": webui_title,
"webui_description": webui_description,
} }
@app.post("/login") @app.post("/login")
@@ -409,6 +417,8 @@ def create_app(args):
"message": "Authentication is disabled. Using guest access.", "message": "Authentication is disabled. Using guest access.",
"core_version": core_version, "core_version": core_version,
"api_version": __api_version__, "api_version": __api_version__,
"webui_title": webui_title,
"webui_description": webui_description,
} }
username = form_data.username username = form_data.username
if auth_handler.accounts.get(username) != form_data.password: if auth_handler.accounts.get(username) != form_data.password:
@@ -459,10 +469,12 @@ def create_app(args):
"vector_storage": args.vector_storage, "vector_storage": args.vector_storage,
"enable_llm_cache_for_extract": args.enable_llm_cache_for_extract, "enable_llm_cache_for_extract": args.enable_llm_cache_for_extract,
}, },
"core_version": core_version,
"api_version": __api_version__,
"auth_mode": auth_mode, "auth_mode": auth_mode,
"pipeline_busy": pipeline_status.get("busy", False), "pipeline_busy": pipeline_status.get("busy", False),
"core_version": core_version,
"api_version": __api_version__,
"webui_title": webui_title,
"webui_description": webui_description,
} }
except Exception as e: except Exception as e:
logger.error(f"Error getting health status: {str(e)}") logger.error(f"Error getting health status: {str(e)}")