增加2.5模型调用
This commit is contained in:
1 parent
3f29ba716a
commit
be655b6569
32 files changed
+1075
-56
No files matched your search
@@ -190,6 +190,72 @@ func TestRuntimeProviderJobBuilderRefreshesDatabaseSettings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvoLinkImageModelOptionsAndConfiguredDefault(t *testing.T) {
|
||||
getenv := func(name string) string {
|
||||
switch name {
|
||||
case "IMAGE_GENERATE_ENGINE":
|
||||
return "evolink"
|
||||
case "EVOLINK_IMAGE_MODEL":
|
||||
return "custom-image-model"
|
||||
case "EVOLINK_IMAGE_QUALITY":
|
||||
return "high"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
options := evolinkImageModelOptions(getenv)
|
||||
if len(options) != 4 || options[3].(map[string]any)["id"] != "custom-image-model" {
|
||||
t.Fatalf("options=%#v", options)
|
||||
}
|
||||
capabilities, err := capabilitySummary(getenv)(context.Background())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
image := capabilities.([]any)[0].(map[string]any)
|
||||
if image["reqKey"] != "custom-image-model" || len(image["models"].([]any)) != 4 {
|
||||
t.Fatalf("image capability=%#v", image)
|
||||
}
|
||||
builder := configuredProviderJobBuilder(getenv, false)
|
||||
for _, model := range []string{"gpt-image-2", "gpt-image-2.5-flare", "gpt-image-2.5-sunburst", "custom-image-model"} {
|
||||
command, err := builder.Build(context.Background(), "owner", "", "image.generate", "", map[string]any{
|
||||
"engine": "evolink", "model": model, "prompt": "draw",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("model %s: %v", model, err)
|
||||
}
|
||||
var request providers.Request
|
||||
if err := json.Unmarshal(command.Job.RequestPayload, &request); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if command.Job.ReqKey != model || request.Model != model || request.Settings["quality"] != "high" {
|
||||
t.Fatalf("model %s: job=%#v request=%#v", model, command.Job, request)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageCapabilityExposesEvoLinkDefaultWhenPrimaryIsJimeng(t *testing.T) {
|
||||
getenv := func(name string) string {
|
||||
if name == "EVOLINK_IMAGE_MODEL" {
|
||||
return "gpt-image-2.5-sunburst"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
capabilities, err := capabilitySummary(getenv)(context.Background())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
image := capabilities.([]any)[0].(map[string]any)
|
||||
evolink := image["evolink"].(map[string]any)
|
||||
if image["engine"] != "jimeng" || evolink["reqKey"] != "gpt-image-2.5-sunburst" || len(evolink["models"].([]any)) != 3 {
|
||||
t.Fatalf("image capability=%#v", image)
|
||||
}
|
||||
health := runtimeHealthDetails(getenv)
|
||||
healthImage := health.Capabilities[0].(map[string]any)
|
||||
if healthImage["evolink"].(map[string]any)["reqKey"] != "gpt-image-2.5-sunburst" {
|
||||
t.Fatalf("health capability=%#v", healthImage)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRuntimeProviderJobBuilderRoutesSeedreamWithoutReplacingJimeng(t *testing.T) {
|
||||
values := map[string]string{
|
||||
"SEEDANCE_API_KEY": "ark-secret",
|
||||
|
||||
Reference in new issue
Block a user