4bc1b8d2e3
CI / docker (push) Has been cancelled
引入用户端对话/生图与管理端 Provider 配置,统一 invoke 编排、Gateway、请求日志与模型管理;前端按设计规范拆分布局,Go module 更名为 github.com/rose_cat707/Atlas;生图长任务 SSE 推送;管理端登录防爆破;协议与服务类型联动;Replicate 模型同步修复;用户端创作台 UI 重构;管理端创作历史替代请求日志。 Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
597 B
Go
28 lines
597 B
Go
package invoke
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildPredictionBody(t *testing.T) {
|
|
body, err := buildPredictionBody("z-image", map[string]any{"prompt": "cat"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var payload map[string]any
|
|
if err := json.Unmarshal(body, &payload); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if payload["version"] != "z-image" {
|
|
t.Fatalf("version: %v", payload["version"])
|
|
}
|
|
if _, ok := payload["model"]; ok {
|
|
t.Fatal("should not send model field")
|
|
}
|
|
input, _ := payload["input"].(map[string]any)
|
|
if input["prompt"] != "cat" {
|
|
t.Fatalf("input: %v", input)
|
|
}
|
|
}
|