From 5294d9460481276d7c1c41315d65769b44723dda Mon Sep 17 00:00:00 2001 From: Wonder Date: Fri, 20 Mar 2026 21:19:39 +0800 Subject: [PATCH] =?UTF-8?q?Test:=20AI=20Client=20=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/ai/client_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/ai/client_test.go diff --git a/internal/ai/client_test.go b/internal/ai/client_test.go new file mode 100644 index 0000000..ba190d7 --- /dev/null +++ b/internal/ai/client_test.go @@ -0,0 +1,25 @@ +package ai + +import ( + "testing" +) + +func TestGenerate(t *testing.T) { + client := NewClient(Config{ + Endpoint: `https://api.siliconflow.cn/v1`, + Model: `Pro/deepseek-ai/DeepSeek-V3.2`, + Timeout: 120, + MaxRetries: 3, + ApiKey: `sk-rrizhcztbcpqvzszpsosxbylpuaajjropmzrcdzlqynhopzm`, + }) + ans, err := client.Generate("你好") + if err != nil { + t.Fatalf("%v", err) + } + if ans == "" { + t.Fatalf("无输出") + } + + t.Log(ans) + +}