From 45d8181205e3d8cb7ae0e1d81425ed002ff1f350 Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Thu, 11 Sep 2025 21:54:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=B9=B6=E8=B0=83=E6=95=B4=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在配置加载时添加调试信息输出,方便排查问题 将健康检查的超时时间从2秒延长至60秒,避免因网络延迟导致误判 --- .gitignore | 5 +++++ mcp_server_go/main.go | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f3d3c93..9794991 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,8 @@ logs/ mcp_server_go/go.sum mcp_server_go/mcp_server_go crontab/smartctl_log +crontab/debug_*.py +crontab/test_*.py +crontab/test*.py +g-b/* +.gitignore diff --git a/mcp_server_go/main.go b/mcp_server_go/main.go index 3bb3558..23b8c9e 100644 --- a/mcp_server_go/main.go +++ b/mcp_server_go/main.go @@ -129,6 +129,9 @@ func loadConfig() error { return fmt.Errorf("读取配置文件失败: %w", err) } + // 打印当前使用的配置文件路径(使用标准库输出,因为logger可能还未初始化) + fmt.Printf("成功加载配置文件: %s\n", viper.ConfigFileUsed()) + if err := viper.Unmarshal(&config); err != nil { return fmt.Errorf("解析配置文件失败: %w", err) } @@ -280,7 +283,7 @@ func healthCheckHandler(w http.ResponseWriter, r *http.Request) { oaiHealthy := false if openaiClient != nil { // 创建一个轻量级的测试请求 - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel() _, err := openaiClient.ListModels(ctx)