From ee38b3c84d09ea727c3daed6d39262a8cb305454 Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Sun, 31 Mar 2024 20:06:15 +0200 Subject: [PATCH 1/4] Enhance DATA_DIR handling in main.py and docker-compose configuration --- backend/main.py | 19 ++++++++++++------- docker-compose.yaml | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/backend/main.py b/backend/main.py index fa35e55a9..8f35962dc 100644 --- a/backend/main.py +++ b/backend/main.py @@ -161,24 +161,29 @@ app.mount("/images/api/v1", images_app) 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 { diff --git a/docker-compose.yaml b/docker-compose.yaml index f69084b8a..54b72f526 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 From 68cfdd89c401b51da2ddd51f2da2f9dde456b57b Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Sun, 31 Mar 2024 22:35:44 +0200 Subject: [PATCH 2/4] Small simplification --- Makefile | 2 ++ docker-compose.yaml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cbcc41d92..9784eacbd 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ remove: start: @docker-compose start +startanbuild: + docker-compose up -d --build stop: @docker-compose stop diff --git a/docker-compose.yaml b/docker-compose.yaml index 54b72f526..f69084b8a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -27,7 +27,6 @@ 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 From cef676429f71aab41508f574a71e50ea73fc40c5 Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Sun, 31 Mar 2024 22:50:17 +0200 Subject: [PATCH 3/4] Spellchecking --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9784eacbd..1ec170a25 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ remove: start: @docker-compose start -startanbuild: +startAndBuild: docker-compose up -d --build stop: From 1b5c92d66c5321b32fc3712ae61e48af5658e270 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 31 Mar 2024 13:59:39 -0700 Subject: [PATCH 4/4] revert: prompt suggestion change --- backend/main.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/main.py b/backend/main.py index 8f35962dc..8cc704a26 100644 --- a/backend/main.py +++ b/backend/main.py @@ -161,15 +161,14 @@ app.mount("/images/api/v1", images_app) 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 + + default_locale = "en-US" 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 { @@ -179,11 +178,10 @@ async def get_app_config(): "default_locale": default_locale, "images": images_app.state.ENABLED, "default_models": webui_app.state.DEFAULT_MODELS, - "default_prompt_suggestions": default_prompt_suggestions, + "default_prompt_suggestions": webui_app.state.DEFAULT_PROMPT_SUGGESTIONS, } - @app.get("/api/config/model/filter") async def get_model_filter_config(user=Depends(get_admin_user)): return {