From e060cbdb5c855c446e773829478d61dac6406952 Mon Sep 17 00:00:00 2001 From: Matt Rothenberg Date: Mon, 16 Mar 2026 19:56:29 -0400 Subject: [PATCH] feat(Workers AI): improve model catalog search and display tags - Search now matches model name, description, AND tags - Display clickable tag pills on individual model pages - Show tags as badges on model cards in catalog - Fix card alignment so badges align at bottom --- src/components/ModelCatalog.tsx | 17 ++++++++--- src/components/models/ModelBadges.tsx | 36 ++++++++++++++++++++---- src/pages/workers-ai/models/[name].astro | 15 ++++++++++ 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/src/components/ModelCatalog.tsx b/src/components/ModelCatalog.tsx index 9a02787452b..3574aca714c 100644 --- a/src/components/ModelCatalog.tsx +++ b/src/components/ModelCatalog.tsx @@ -164,7 +164,16 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => { } if (filters.search) { - if (!model.name.toLowerCase().includes(filters.search.toLowerCase())) { + const searchTerm = filters.search.toLowerCase(); + const matchesName = model.name.toLowerCase().includes(searchTerm); + const matchesDescription = model.description + .toLowerCase() + .includes(searchTerm); + const matchesTags = model.tags?.some((tag) => + tag.toLowerCase().includes(searchTerm), + ); + + if (!matchesName && !matchesDescription && !matchesTags) { return false; } } @@ -309,7 +318,7 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => { return ( {isPinned && ( @@ -340,8 +349,8 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {

{model.model.description}

-
- +
+
); diff --git a/src/components/models/ModelBadges.tsx b/src/components/models/ModelBadges.tsx index f9e768359f0..22d554f00d9 100644 --- a/src/components/models/ModelBadges.tsx +++ b/src/components/models/ModelBadges.tsx @@ -1,6 +1,12 @@ import type { WorkersAIModelsSchema } from "~/schemas"; -const ModelBadges = ({ model }: { model: WorkersAIModelsSchema }) => { +const ModelBadges = ({ + model, + showTags = false, +}: { + model: WorkersAIModelsSchema; + showTags?: boolean; +}) => { const badges = model.properties.flatMap(({ property_id, value }) => { if (property_id === "lora" && value === "true") { return { @@ -50,11 +56,31 @@ const ModelBadges = ({ model }: { model: WorkersAIModelsSchema }) => { return []; }); + // Add tags as badges if showTags is enabled + const tagBadges = + showTags && model.tags + ? model.tags.slice(0, 3).map((tag) => ({ + variant: "default", + text: tag, + isTag: true, + })) + : []; + + const allBadges = [...badges, ...tagBadges]; + return ( -