catalog: a listed model its id names a video model is one (agnes-video-2.5)
glorious_rabbit_30894 on Discord (#help): models of a custom provider pointed at Agnes AI (apihub.agnes-ai.com/v1) "can't be added to an agent". Agnes runs new-api; its /v1/models rows carry only id, owned_by "custom" and supported_endpoint_types ["openai"], no kind, domain or modalities. Nothing but the id tells agnes-video-2.5 and agnes-video-2.5-flash from its chat models, and magpie had a name check for image models (DrawsID) but none for video, so both were offered to every agent as chat models, and never as video models. FilmsID is DrawsID for videos (video, sora, veo, kling, seedance, hailuo, vidu, runway, *-t2v/i2v/r2v; veo and kling only as a word of their own, so inkling still chats). fetchPage marks a row a video model by it when the list says no kind, no domain, no text output and the id isn't an image model's. mendKinds applies the same to a list saved before, so a fetched Agnes list is fixed on the first read, not the next fetch. A model whose list says it answers in text is never moved. Checked FilmsID against every id in models.dev's cache (~/.cache/magpie models.json, 2026-11-04): every id it matches outputs video and no text, except nvidia/synthetic-video-detector (a classifier, text out); video models it misses are named for nothing it could know (ray2, minimax-h3, gemini-omni), and their lists' modalities or a user's kind still mark them. Not the cause of the report, as far as can be told: with Agnes's real list (testdata, fetched 2026-11-04) and models.dev's real cache, a custom provider at .../v1, at the bare host, Anthropic or Responses protocol, reaches Available, Exposed and Catalog with all four chat models, and every agent's picker (claude, codex, opencode, pi, omp, ... 75 fields) lists them beside a relay's. The reporter says (#help 09:52) dsh, VS Code and Codex can't pick them, with no error; that is not reproduced here and is asked for. Run (mote): - at this tree on origin/main69eb93e0a: go test ./internal/catalog ok; go vet ./internal/catalog ./internal/provider for darwin, linux and windows ok; gofmt -l clean - at the same change on9595a503a: go test ./internal/provider ./internal/agent ok; ./internal/gui red only in TestCoreScriptBudget (#5139) and TestMainWindowCorners/macOS_26_SDK (#3949), both filed, neither in a file this touches - sandbox HOME, Agnes's real list + models.dev's cache: Picks, Spell, Apply and Drift for codex, dsh, vscode, claude, opencode take agnes/agnes-2.5-flash with no error, and magpieModels for each lists the four chat models and, with this change, no video model Broken by hand: live.go at HEAD with FilmsID kept: both Agnes tests red (video models [] and listed as chat, saved list's too); green with it. Not tried: a real Agnes key (none here); Agnes's video models asked at /v1/videos (magpie's video path for a base URL) — whether Agnes serves them there is unknown.
This commit is contained in:
@@ -1972,6 +1972,26 @@ 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,6 +71,12 @@ 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
|
||||
}
|
||||
@@ -648,7 +654,10 @@ 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)
|
||||
films := r.Kind == "video" || r.Kind == "" && (r.Domain == "VideoGeneration" || slices.Contains(outs, "video") && !slices.Contains(outs, "text"))
|
||||
// — 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))
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"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