- 修复 MaxPreview=0 仍被覆盖为默认值的 bug - 修复 API Endpoint 自动补全逻辑(避免 /v1/v1/chat/completions) - 为 AI 配置与匹配状态字段增加并发锁 - AI 增强未匹配行改为按索引跟踪,避免重复行误判 - 无时间列时 AI 匹配 B 表行数可配置并增加截断警告 - 导出时防御参差不齐行导致的数组越界 panic - Excel 读取时对单元格统一 TrimSpace - 删除未使用的 minInt 函数 - 修复 wails.json 开发服务器地址为 http://localhost:5173 - 重新生成 Wails 前端绑定 - 新增 ai_test.go / export_test.go 单元测试
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestResolveAIEndpoint(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
expected string
|
|
}{
|
|
{
|
|
name: "empty uses Deepseek default",
|
|
input: "",
|
|
expected: "https://api.deepseek.com/v1/chat/completions",
|
|
},
|
|
{
|
|
name: "base URL without trailing slash",
|
|
input: "https://api.openai.com",
|
|
expected: "https://api.openai.com/v1/chat/completions",
|
|
},
|
|
{
|
|
name: "base URL with trailing slash",
|
|
input: "https://api.openai.com/",
|
|
expected: "https://api.openai.com/v1/chat/completions",
|
|
},
|
|
{
|
|
name: "v1 base URL",
|
|
input: "https://api.openai.com/v1",
|
|
expected: "https://api.openai.com/v1/chat/completions",
|
|
},
|
|
{
|
|
name: "full completions URL kept as is",
|
|
input: "https://api.openai.com/v1/chat/completions",
|
|
expected: "https://api.openai.com/v1/chat/completions",
|
|
},
|
|
{
|
|
name: "local base URL",
|
|
input: "http://localhost:8080",
|
|
expected: "http://localhost:8080/v1/chat/completions",
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := resolveAIEndpoint(tt.input)
|
|
if got != tt.expected {
|
|
t.Errorf("resolveAIEndpoint(%q) = %q, want %q", tt.input, got, tt.expected)
|
|
}
|
|
})
|
|
}
|
|
}
|