Revert "catalog: a listed model its id names a video model is one (agnes-video-2.5)"
This reverts commitb5b6cc573. It broke a rule #1399 set on purpose: a model's name alone makes no video model, since magpie would then send videos requests to a relay that may not serve them. A relay's video model stays in the chat list until its list says "kind": "video" or the user marks it Video in the provider editor, which needs the row there. The full suite atb5b6cc573(mote, go test -timeout 45m ./...) was red in internal/gateway on TestCustomProviderMakesVideos, TestCustomProviderVideoNeedsTheListsWord and TestCustomProviderVideoTheUserMarks: sora-like-2, unmarked, became a video maker and a /v1/videos request went out for it. I ran only catalog, provider, agent and gui before pushing, not gateway. Agnes's agnes-video-2.5 and -flash therefore stay among its chat models, and the user marks them Video, as #1399 designed. Run (mote, at this tree): go test ./internal/catalog and go test -run 'TestCustomProvider' ./internal/gateway.
This commit is contained in:
@@ -1972,26 +1972,6 @@ func DrawsID(id string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// filmsWords are words of a model id that names one that makes videos:
|
||||
// Sora, Veo, Kling, Seedance, Hailuo, Vidu, Runway, and Wan's and
|
||||
// HappyHorse's text-, image- and reference-to-video models (t2v, i2v, r2v).
|
||||
// Each was checked against models.dev: every id it matches there makes
|
||||
// video and no text, save a video classifier that answers in text, and
|
||||
// a model whose list says it answers in text is never taken for one
|
||||
// (FilmsID's callers). Veo and Kling count only as a word of their own,
|
||||
// so thinkingmachines/inkling still chats.
|
||||
var filmsWords = regexp.MustCompile(`video|seedance|sora|hailuo|vidu|runway|(^|[/_.-])veo|(^|[/_.-])kling|[/_.-][tir]2v($|[/_.-])`)
|
||||
|
||||
// FilmsID is DrawsID for videos: whether a model's id names one that makes
|
||||
// videos, for a model the catalog doesn't know and whose list marks no
|
||||
// kind. Agnes AI's /v1/models lists agnes-video-2.5 and
|
||||
// agnes-video-2.5-flash beside its chat models with nothing but the id to
|
||||
// tell them apart (glorious_rabbit_30894 on Discord), and they were offered
|
||||
// to agents to chat with.
|
||||
func FilmsID(id string) bool {
|
||||
return filmsWords.MatchString(strings.ToLower(id))
|
||||
}
|
||||
|
||||
// ImagesAPI is whether a model draws on an images API rather than answering
|
||||
// in chat with pictures: gpt-image, dall-e, imagen, flux, seedream… — not
|
||||
// gemini-*-image or gpt-5-image, which chat. iFlytek Loomy's Hy-Image
|
||||
|
||||
@@ -71,12 +71,6 @@ func readLive(provider string) (liveFile, error) {
|
||||
func mendKinds(ms []Model) {
|
||||
for i := range ms {
|
||||
m := &ms[i]
|
||||
// a list saved before FilmsID kept a video model its id names
|
||||
// among the chat models; it is one from the first read after the
|
||||
// update, not the next fetch
|
||||
if !m.Draws && !m.Films && !m.Decides && !slices.Contains(m.OutputModalities, "text") && !slices.Contains(m.OutputModalities, "text/plain") && !DrawsID(m.ID) && FilmsID(m.ID) {
|
||||
m.Films = true
|
||||
}
|
||||
if m.InputModalities == nil {
|
||||
continue
|
||||
}
|
||||
@@ -654,10 +648,7 @@ func fetchPage(ctx context.Context, url, key string, anthropic bool, headers map
|
||||
// an output of video without text (doubao-seedance-*, wan2-1-*),
|
||||
// which is no model to chat with (axelburks on Discord: Ark's
|
||||
// Seedance sat among its chat models, not under Video models)
|
||||
// — or, where it says nothing of what the model makes, one whose id
|
||||
// names it (FilmsID: Agnes's agnes-video-2.5)
|
||||
films := r.Kind == "video" || r.Kind == "" && (r.Domain == "VideoGeneration" || slices.Contains(outs, "video") && !slices.Contains(outs, "text") ||
|
||||
r.Domain == "" && !slices.Contains(outs, "text") && !DrawsID(id) && FilmsID(id))
|
||||
films := r.Kind == "video" || r.Kind == "" && (r.Domain == "VideoGeneration" || slices.Contains(outs, "video") && !slices.Contains(outs, "text"))
|
||||
drawer := !films && !decision && (DrawsID(id) && !strings.Contains(strings.ToLower(id), "deep-research") || r.Kind == "image" ||
|
||||
r.Kind == "" && (r.Domain == "ImageGeneration" || slices.Contains(outs, "image") && !slices.Contains(outs, "text")))
|
||||
// and none the list says answers without text (Ark's 3D models)
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
package catalog
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Agnes AI's own /v1/models (apihub.agnes-ai.com, 2026-11-04), as new-api
|
||||
// sends it: no kind, domain or modalities, only supported_endpoint_types
|
||||
// "openai" on every row. Its two video models are video models by their
|
||||
// id, out of the chat list (glorious_rabbit_30894 on Discord: Agnes's
|
||||
// models in an agent's picker), its image models draw, and its chat
|
||||
// models stay.
|
||||
func TestFetchAgnesMarksVideoModelsByID(t *testing.T) {
|
||||
body, err := os.ReadFile("testdata/agnes-models-2026-11-04.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/v1/models" {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
w.Write(body)
|
||||
}))
|
||||
defer srv.Close()
|
||||
ms, _, err := FetchAt(context.Background(), srv.URL+"/v1", "k", false, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var films, draws, chat []string
|
||||
for _, m := range ms {
|
||||
switch {
|
||||
case m.Films:
|
||||
films = append(films, m.ID)
|
||||
case m.Draws:
|
||||
draws = append(draws, m.ID)
|
||||
default:
|
||||
chat = append(chat, m.ID)
|
||||
}
|
||||
}
|
||||
slices.Sort(films)
|
||||
slices.Sort(draws)
|
||||
slices.Sort(chat)
|
||||
if want := []string{"agnes-video-2.5", "agnes-video-2.5-flash"}; !slices.Equal(films, want) {
|
||||
t.Errorf("video models %v, want %v", films, want)
|
||||
}
|
||||
if want := []string{"agnes-image-2.0-flash", "agnes-image-2.1-flash", "agnes-image-2.5-flash"}; !slices.Equal(draws, want) {
|
||||
t.Errorf("image models %v, want %v", draws, want)
|
||||
}
|
||||
if want := []string{"agnes-2.5-flash", "agnes-2.5-pro-alpha", "agnes-2.5-pro-beta", "agnes-3.0-flash"}; !slices.Equal(chat, want) {
|
||||
t.Errorf("chat models %v, want %v", chat, want)
|
||||
}
|
||||
}
|
||||
|
||||
// A list saved before FilmsID kept Agnes's video models among its chat
|
||||
// models; they leave the chat list from the first read after the update,
|
||||
// not only once the list is fetched again.
|
||||
func TestSavedListVideoModelsLeaveChat(t *testing.T) {
|
||||
saved := []Model{
|
||||
{ID: "agnes-2.5-flash"},
|
||||
{ID: "agnes-video-2.5"},
|
||||
{ID: "agnes-video-2.5-flash"},
|
||||
// said to answer in text by its list: a chat model whatever its name
|
||||
{ID: "video-chat-1", OutputModalities: []string{"text"}},
|
||||
}
|
||||
if err := SaveLive("agnes-saved", "https://apihub.agnes-ai.com/v1", saved); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ms, _, _ := Live("agnes-saved")
|
||||
var chat []string
|
||||
for _, m := range ms {
|
||||
chat = append(chat, m.ID)
|
||||
}
|
||||
if want := []string{"agnes-2.5-flash", "video-chat-1"}; !slices.Equal(chat, want) {
|
||||
t.Errorf("chat models %v, want %v", chat, want)
|
||||
}
|
||||
var films []string
|
||||
for _, m := range LiveVideomakers("agnes-saved") {
|
||||
films = append(films, m.ID)
|
||||
}
|
||||
if want := []string{"agnes-video-2.5", "agnes-video-2.5-flash"}; !slices.Equal(films, want) {
|
||||
t.Errorf("video models %v, want %v", films, want)
|
||||
}
|
||||
}
|
||||
|
||||
// FilmsID knows the video models of models.dev's lists by name, and none
|
||||
// of the chat models whose names hold one of its words inside another.
|
||||
func TestFilmsID(t *testing.T) {
|
||||
for _, id := range []string{"agnes-video-2.5", "openai/sora-2", "google/veo-3.1", "google/veo3.1-fast", "kling-v2-6", "klingai/kling-v3.0-t2v",
|
||||
"bytedance/seedance-2.0", "happyhorse-1.1-i2v", "alibaba/wan-v2.6-r2v", "wan2-2-t2v-a14b", "runwayml/runway-gen-4-turbo", "MiniMax-Hailuo-02", "vidu-q2"} {
|
||||
if !FilmsID(id) {
|
||||
t.Errorf("FilmsID(%q) = false", id)
|
||||
}
|
||||
}
|
||||
for _, id := range []string{"agnes-2.5-flash", "thinkingmachines/inkling", "inkling-small", "gpt-5.5", "claude-sonnet-5", "qwen3-vl-plus", "doubao-seed-2-1-pro-260915", "deepseek-v4", "glm-5.2", "grok-4-1-fast", "kimi-k3"} {
|
||||
if FilmsID(id) {
|
||||
t.Errorf("FilmsID(%q) = true", id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"data":[{"id":"agnes-2.5-flash","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-2.5-pro-alpha","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-2.5-pro-beta","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-3.0-flash","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-image-2.0-flash","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-image-2.1-flash","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-image-2.5-flash","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-video-2.5","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]},{"id":"agnes-video-2.5-flash","object":"model","created":1626777600,"owned_by":"custom","supported_endpoint_types":["openai"]}],"object":"list","success":true}
|
||||
Reference in New Issue
Block a user