Skip to content

Commit e6fef1b

Browse files
googs1025claude
andcommitted
install: 配完每个 model 立刻探测一次,让用户即时看到 provider 是否可用
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent d2ccc47 commit e6fef1b

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

scripts/install.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,16 @@ ROUTING_BASE_URL=$(prompt_default " Base URL (OpenAI-compatible endpoint)" "
325325
ROUTING_MODEL=$(prompt_default " Model name" " 模型名" "your-tool-calling-model")
326326
ROUTING_API_KEY=$(prompt_default " API key (use 'any' if no auth needed)" " API key(如果不需要鉴权可填 any)" "${ROUTING_API_KEY:-any}")
327327

328+
echo
329+
if ! probe_model_endpoint "Routing" "$ROUTING_BASE_URL" "$ROUTING_API_KEY" "$ROUTING_MODEL" 1; then
330+
CONTINUE_ANYWAY=$(prompt_yes_no "Routing model check failed. Continue install anyway?" "路由模型检测失败,是否仍要继续安装?" "N")
331+
if [ "$CONTINUE_ANYWAY" != "yes" ]; then
332+
echo "Aborted. No files were modified."
333+
echo "已中止,未修改任何文件。"
334+
exit 1
335+
fi
336+
fi
337+
328338
echo
329339
if [ "$USE_OPENCLAW_DEFAULT" = "yes" ]; then
330340
echo "── Upstream LLM (main response model) ──"
@@ -352,6 +362,16 @@ else
352362
UPSTREAM_MODEL=$(prompt_default " Model name" " 模型名" "$DEFAULT_UPSTREAM_MODEL")
353363
fi
354364

365+
echo
366+
if ! probe_model_endpoint "Upstream" "$UPSTREAM_BASE_URL" "$UPSTREAM_API_KEY" "$UPSTREAM_MODEL" 0; then
367+
CONTINUE_ANYWAY=$(prompt_yes_no "Upstream model check failed. Continue install anyway?" "上游模型检测失败,是否仍要继续安装?" "N")
368+
if [ "$CONTINUE_ANYWAY" != "yes" ]; then
369+
echo "Aborted. No files were modified."
370+
echo "已中止,未修改任何文件。"
371+
exit 1
372+
fi
373+
fi
374+
355375
echo
356376

357377
echo "── General ──"
@@ -371,22 +391,6 @@ echo " 示例值: /home/mt/tools"
371391
TOOLS_BASE_DIR=$(prompt_default " Tools base directory" " 工具根目录" "$HOME/.function-router/scripts")
372392
OPENCLAW_CONFIG=$(prompt_default " OpenClaw config path" " OpenClaw 配置路径" "$DEFAULT_OPENCLAW_CONFIG")
373393

374-
echo
375-
echo "── Verifying model endpoints / 验证模型连通性 ──"
376-
ROUTING_OK=1
377-
UPSTREAM_OK=1
378-
probe_model_endpoint "Routing" "$ROUTING_BASE_URL" "$ROUTING_API_KEY" "$ROUTING_MODEL" 1 || ROUTING_OK=0
379-
probe_model_endpoint "Upstream" "$UPSTREAM_BASE_URL" "$UPSTREAM_API_KEY" "$UPSTREAM_MODEL" 0 || UPSTREAM_OK=0
380-
381-
if [ "$ROUTING_OK" -ne 1 ] || [ "$UPSTREAM_OK" -ne 1 ]; then
382-
echo
383-
CONTINUE_ANYWAY=$(prompt_yes_no "One or more model checks failed. Continue install anyway?" "一个或多个模型检测失败,是否仍要继续安装?" "N")
384-
if [ "$CONTINUE_ANYWAY" != "yes" ]; then
385-
echo "Aborted. No files were modified."
386-
echo "已中止,未修改任何文件。"
387-
exit 1
388-
fi
389-
fi
390394
echo
391395

392396
mkdir -p "$TARGET_DIR" "$SCRIPTS_DIR" "$LOGS_DIR"

0 commit comments

Comments
 (0)