Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

Fix webui.sh port check breaking on paths with spaces

tailieu2212d4f5e969342e
diff --git a/webui.sh b/webui.sh
old mode 100644
new mode 100755
index 27027c45..8a3377b1
--- a/webui.sh
+++ b/webui.sh
@@ -17,15 +17,15 @@ MPT_WEBUI_HOST="${MPT_WEBUI_HOST:-127.0.0.1}"
MPT_WEBUI_PORT="${MPT_WEBUI_PORT:-8501}"
if [ -x "$CURRENT_DIR/.venv/bin/python" ]; then
- PORT_CHECK_CMD="$CURRENT_DIR/.venv/bin/python"
set -- "$CURRENT_DIR/.venv/bin/python" -m streamlit
+ find_port() { find_available_port "$CURRENT_DIR/.venv/bin/python"; }
elif command -v uv >/dev/null 2>&1; then
- PORT_CHECK_CMD="uv run python"
set -- uv run streamlit
+ find_port() { find_available_port uv run python; }
elif command -v streamlit >/dev/null 2>&1; then
echo "***** Warning: using streamlit from PATH. If dependencies fail, run 'uv sync --frozen' first. *****"
- PORT_CHECK_CMD="python3"
set -- streamlit
+ find_port() { find_available_port python3; }
else
echo "***** Neither project Python, uv, nor streamlit was found. Please install dependencies first. *****"
exit 1
@@ -55,8 +55,7 @@ PY
}
# 用 Python 做端口探测,避免依赖 lsof/nc 在不同 macOS/Linux 发行版上的差异。
-# shellcheck disable=SC2086
-SELECTED_WEBUI_PORT=$(find_available_port $PORT_CHECK_CMD)
+SELECTED_WEBUI_PORT=$(find_port)
if [ -z "$SELECTED_WEBUI_PORT" ]; then
echo "***** No available WebUI port found in 8501-8599 for $MPT_WEBUI_HOST. *****"