Explorar el Código

Merge pull request #1368 from Patrice-Gaudicheau/fix/data-dir-handling

Update of main.py
Timothy Jaeryang Baek hace 1 año
padre
commit
7563619e26
Se han modificado 2 ficheros con 10 adiciones y 5 borrados
  1. 2 0
      Makefile
  2. 8 5
      backend/main.py

+ 2 - 0
Makefile

@@ -8,6 +8,8 @@ remove:
 
 start:
 	@docker-compose start
+startAndBuild: 
+	docker-compose up -d --build
 
 stop:
 	@docker-compose stop

+ 8 - 5
backend/main.py

@@ -164,15 +164,18 @@ 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")
+
+    # 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 "ui" in CONFIG_DATA and "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,