catalog: a relay's Nano Banana is a drawer, whatever its spelling (#2071)
ll905518294's relay serves Gemini's image models under the name they are called, "Nano Banana 2.1", and both it and a video model landed in the chat model list: a base-URL provider's list is classified by the id alone, and "banana" is no word of Google's own ids, which all say "image". - DrawsID knows "banana": the Nano Banana family (gemini-2.5-flash-image, gemini-3-pro-image), which relays id "nano-banana", "Nano Banana 2.1", "NanoBanana2". A model it catches leaves the chat list for the editor's image models and Settings -> Images, as an id saying "image" does. - The video model is not touched: a list that says nothing of what a model makes stays a chat model, for the user to mark in the editor (#1399, "Makes: Video model"). No word of "omni_flash-10s" says video, and none is guessed. TestFetchRelayDrawerNames (a relay list with the three spellings, a "gemini-3-pro-image-preview" that drew already, and the two that must stay chat) fails on the old DrawsID: "Nano Banana 2.1: not a drawer", "nano-banana-pro: not a drawer", "NanoBanana2: not a drawer". With the word it passes. Run (branch hunt19-b2 on origin/mainf074996d): gofmt clean (CRLF false positives judged on LF copies); go vet -tags nogui and GOOS=linux go vet -tags nogui and GOOS=windows go vet of ./internal/catalog ./internal/gateway ./internal/provider, clean; go build -tags nogui ./... ok; go test -tags nogui -count=1 ./internal/catalog ok, and -run 'Draw|Film|Video|Image' of ./internal/gateway and ./internal/provider ok. Not tried against the reporter's relay (no account here): the classification is the live-list path's own, tried on a fixture of the ids the report's screenshot shows. Re-run on landing (macOS, origin/main722abfbb0): the new test red with catalog.go reverted, green with it; ./internal/catalog, and -run 'Draw|Film|Video|Image' of gateway and provider, ok; gofmt clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean. No other copy of the word list exists (grep hidream). Fixes #2071 Generated-by: GLM-5.3-Flash (ZCode)
This commit is contained in:
@@ -1280,10 +1280,12 @@ func draws(m mdModel) bool {
|
||||
}
|
||||
|
||||
// DrawsID is whether a model's id names one that makes images, for a model
|
||||
// the catalog doesn't know (one typed in, or a vendor's own list's).
|
||||
// the catalog doesn't know (one typed in, or a vendor's own list's). Banana
|
||||
// is the Nano Banana the Gemini image models are called on a relay, whatever
|
||||
// its spelling there (#2071).
|
||||
func DrawsID(id string) bool {
|
||||
id = strings.ToLower(id)
|
||||
for _, w := range []string{"image", "imagen", "imagine", "dall-e", "flux", "seedream", "cogview", "stable-diffusion", "sdxl", "wanx", "kolors", "hidream"} {
|
||||
for _, w := range []string{"image", "imagen", "imagine", "dall-e", "flux", "seedream", "cogview", "stable-diffusion", "sdxl", "wanx", "kolors", "hidream", "banana"} {
|
||||
if strings.Contains(id, w) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -269,3 +269,43 @@ func TestFetchOpenRouterNames(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A relay names Gemini's image models for what they are called, not for
|
||||
// what Google ships: "Nano Banana 2.1" and its spellings draw, though no
|
||||
// word of Google's own ids is in them (#2071). A model the list says
|
||||
// nothing of stays in the chat list, where the user marks what it makes
|
||||
// (#1399).
|
||||
func TestFetchRelayDrawerNames(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, `{"data":[
|
||||
{"id":"Nano Banana 2.1"},
|
||||
{"id":"nano-banana-pro"},
|
||||
{"id":"NanoBanana2"},
|
||||
{"id":"gemini-3-pro-image-preview"},
|
||||
{"id":"omni_flash-10s"},
|
||||
{"id":"claude-sonnet-4-5"}]}`)
|
||||
}))
|
||||
defer srv.Close()
|
||||
ms, err := FetchURL(context.Background(), srv.URL+"/v1/models", "", false, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
draws, chat := map[string]bool{}, map[string]bool{}
|
||||
for _, m := range ms {
|
||||
if m.Films {
|
||||
t.Errorf("%s: films, which nothing here said", m.ID)
|
||||
} else if m.Draws {
|
||||
draws[m.ID] = true
|
||||
} else {
|
||||
chat[m.ID] = true
|
||||
}
|
||||
}
|
||||
for _, id := range []string{"gemini-3-pro-image-preview", "Nano Banana 2.1", "nano-banana-pro", "NanoBanana2"} {
|
||||
if !draws[id] {
|
||||
t.Errorf("%s: not a drawer", id)
|
||||
}
|
||||
}
|
||||
if !chat["omni_flash-10s"] || !chat["claude-sonnet-4-5"] {
|
||||
t.Errorf("the chat list lost a model: omni_flash-10s %v, claude-sonnet-4-5 %v", chat["omni_flash-10s"], chat["claude-sonnet-4-5"])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user