* feat(canvas): 参考素材 - 增加移除按钮并删除对应连线 * feat(canvas): 完善节点面板交互与拖拽反馈 * fix(canvas): 画布交互与小地图 - 统一浮层层级并完善节点识别 * feat(prompt-optimizer): 增加 AI 提示词优化器及宿主接入 * feat(canvas): 画布 - 增加自动整理节点按钮并补充文档 * chore(web): 前端 - 修正提示词优化器格式 * chore(backend): 后端 - 修正 Go 格式检查 * feat(workspace): 完善诊断导出与本地排障支持 * chore(web): 格式化诊断导出文件 * fix(web-test): 兼容 Bun 测试运行时 * fix(web-test): 对齐模型目录协议断言
27 lines
933 B
Go
27 lines
933 B
Go
package handler
|
|
|
|
import "testing"
|
|
|
|
func TestShortSystemProxyPath(t *testing.T) {
|
|
tests := []struct {
|
|
path string
|
|
channel string
|
|
provider string
|
|
ok bool
|
|
}{
|
|
{path: "/api/channel-1/chat/completions", channel: "channel-1", provider: "/chat/completions", ok: true},
|
|
{path: "/api/channel-1/v1/models", channel: "channel-1", provider: "/v1/models", ok: true},
|
|
{path: "/api/tasks/123", ok: false},
|
|
{path: "/api/diagnostics/export", ok: false},
|
|
{path: "/api/channel-1", ok: false},
|
|
{path: "/api//chat/completions", ok: false},
|
|
{path: "/other/channel-1/chat/completions", ok: false},
|
|
}
|
|
for _, test := range tests {
|
|
channel, provider, ok := shortSystemProxyPath(test.path)
|
|
if ok != test.ok || channel != test.channel || provider != test.provider {
|
|
t.Errorf("shortSystemProxyPath(%q) = (%q, %q, %v), want (%q, %q, %v)", test.path, channel, provider, ok, test.channel, test.provider, test.ok)
|
|
}
|
|
}
|
|
}
|