浏览代码

refac/enh: start.sh additional args support

Timothy Jaeryang Baek 1 周之前
父节点
当前提交
6ff392edc0
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14 1
      backend/start.sh

+ 14 - 1
backend/start.sh

@@ -70,5 +70,18 @@ if [ -n "$SPACE_ID" ]; then
 fi
 
 PYTHON_CMD=$(command -v python3 || command -v python)
+UVICORN_WORKERS="${UVICORN_WORKERS:-1}"
 
-WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" exec "$PYTHON_CMD" -m uvicorn open_webui.main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' --workers "${UVICORN_WORKERS:-1}"
+# If script is called with arguments, use them; otherwise use default workers
+if [ "$#" -gt 0 ]; then
+    ARGS=("$@")
+else
+    ARGS=(--workers "$UVICORN_WORKERS")
+fi
+
+# Run uvicorn
+exec "$PYTHON_CMD" -m uvicorn open_webui.main:app \
+    --host "$HOST" \
+    --port "$PORT" \
+    --forwarded-allow-ips '*' \
+    "${ARGS[@]}"