Skip to content

Commit

Permalink
Enhance DATA_DIR handling in main.py and docker-compose configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrice-Gaudicheau committed Mar 31, 2024
1 parent 3b0cb79 commit ee38b3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
19 changes: 12 additions & 7 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,29 @@ async def on_startup():
app.mount("/audio/api/v1", audio_app)
app.mount("/rag/api/v1", rag_app)


@app.get("/api/config")
async def get_app_config():
# Checking and Handling the Absence of 'ui' in CONFIG_DATA
if "ui" in CONFIG_DATA:
default_locale = CONFIG_DATA["ui"].get("default_locale", "en-US")
default_prompt_suggestions = CONFIG_DATA["ui"].get("prompt_suggestions", [])
else:
default_locale = "en-US"
default_prompt_suggestions = []

# The Rest of the Function Now Uses the Variables Defined Above
return {
"status": True,
"name": WEBUI_NAME,
"version": VERSION,
"default_locale": (
CONFIG_DATA["ui"]["default_locale"]
if "default_locale" in CONFIG_DATA["ui"]
else "en-US"
),
"default_locale": default_locale,
"images": images_app.state.ENABLED,
"default_models": webui_app.state.DEFAULT_MODELS,
"default_prompt_suggestions": webui_app.state.DEFAULT_PROMPT_SUGGESTIONS,
"default_prompt_suggestions": default_prompt_suggestions,
}



@app.get("/api/config/model/filter")
async def get_model_filter_config(user=Depends(get_admin_user)):
return {
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ services:
environment:
- 'OLLAMA_BASE_URL=http://ollama:11434'
- 'WEBUI_SECRET_KEY='
- 'DATA_DIR=/app/backend/data'
extra_hosts:
- host.docker.internal:host-gateway
restart: unless-stopped
Expand Down

0 comments on commit ee38b3c

Please sign in to comment.