From b57def19a013ebaf8009f250372b67aca69385cb Mon Sep 17 00:00:00 2001 From: RKhur <60106241+RKhur@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:28:13 -0700 Subject: [PATCH 01/13] feat(website): clarify Hub model playground and API access --- .../e2e/workshop-loading-flash.spec.ts | 2 +- .../components/workshop/FeaturedBanner.vue | 11 +- .../components/workshop/ModelDetail.test.ts | 20 ++- .../src/components/workshop/ModelDetail.vue | 7 + .../src/components/workshop/ModelsPage.vue | 2 +- .../workshop/WorkshopModelCard.test.ts | 41 ++++- .../components/workshop/WorkshopModelCard.vue | 150 ++++++++++-------- .../src/lib/workshop/featured-slides.ts | 5 + apps/website/src/locales/en/main.json | 4 +- apps/website/src/locales/zh-CN/main.json | 4 +- 10 files changed, 163 insertions(+), 83 deletions(-) diff --git a/apps/website/e2e/workshop-loading-flash.spec.ts b/apps/website/e2e/workshop-loading-flash.spec.ts index b3ce5d22eb3..85d9d81e961 100644 --- a/apps/website/e2e/workshop-loading-flash.spec.ts +++ b/apps/website/e2e/workshop-loading-flash.spec.ts @@ -22,7 +22,7 @@ test('static HTML at /hub/models/ names the catalogue and links every model', as expect.stringContaining('ComfyUI models') ]) expect(live).not.toMatch(/Grok Imagine in ComfyUI|Try Grok Imagine Now/) - expect(live).toMatch(/>\s*Hub\s*<\/p>/) + expect(live).not.toMatch(/>\s*Hub\s*<\/p>/) expect(live).toContain('data-testid="workshop-loading"') expect(live).not.toContain('data-testid="workshop-search"') const directory = live.match( diff --git a/apps/website/src/components/workshop/FeaturedBanner.vue b/apps/website/src/components/workshop/FeaturedBanner.vue index 2f19a1bca08..ad5c2c67ca5 100644 --- a/apps/website/src/components/workshop/FeaturedBanner.vue +++ b/apps/website/src/components/workshop/FeaturedBanner.vue @@ -33,6 +33,7 @@ export interface FeaturedSlide { readonly summary: string | undefined readonly media: { url: string; kind: 'image' | 'video' } | undefined readonly docsHref: string | undefined + readonly apiHref?: string readonly cta?: string } @@ -211,16 +212,18 @@ const fill = computed(() => {{ active.cta ?? t('workshop.hub.tryNow') }} diff --git a/apps/website/src/components/workshop/ModelDetail.test.ts b/apps/website/src/components/workshop/ModelDetail.test.ts index 66b805c7fb4..85989a36ca3 100644 --- a/apps/website/src/components/workshop/ModelDetail.test.ts +++ b/apps/website/src/components/workshop/ModelDetail.test.ts @@ -260,6 +260,18 @@ describe('ModelDetail', () => { }) }) + it('opens the API tab from a catalogue deep link', async () => { + const previousUrl = location.href + history.replaceState(null, '', '#api') + onTestFinished(() => history.replaceState(null, '', previousUrl)) + await mountDetail({ model: runnable }) + expect(screen.getByTestId('tab-api')).toHaveAttribute( + 'aria-selected', + 'true' + ) + expect(runWorkshopRouter).not.toHaveBeenCalled() + }) + // Ben's finding, pinned: whatever the flag says, a page that goes away takes // its run with it. Only the reader can choose otherwise, and only out loud. it.for([{ saving: '1' }, { saving: '0' }])( @@ -1022,7 +1034,9 @@ describe('ModelDetail', () => { respondToFetch( { method: 'PUT' }, () => Promise.reject(new TypeError('Failed to fetch')), - { times: 1 } + { + times: 1 + } ) const model = getRouterWorkshopModelDetail( 'vertexai--gemini-nano-banana-2--edit-images' @@ -1758,7 +1772,9 @@ describe('ModelDetail', () => { const prepare = () => { const event = Object.assign( new Event('astro:before-preparation', { cancelable: true }), - { navigationType: 'traverse' } + { + navigationType: 'traverse' + } ) document.dispatchEvent(event) preparationWasAllowed = !event.defaultPrevented diff --git a/apps/website/src/components/workshop/ModelDetail.vue b/apps/website/src/components/workshop/ModelDetail.vue index 6c30716a54f..e0e48cb43f2 100644 --- a/apps/website/src/components/workshop/ModelDetail.vue +++ b/apps/website/src/components/workshop/ModelDetail.vue @@ -126,6 +126,13 @@ const sectionLabel: Record = { } const activeSection = ref
('playground') +function readSectionHash() { + if (window.location.hash === '#api') activeSection.value = 'api' + else if (window.location.hash === '#playground') + activeSection.value = 'playground' +} +onMounted(readSectionHash) +useEventListener('hashchange', readSectionHash) const { onKeydown: onTabKeydown } = useTablist( () => sections.value, activeSection diff --git a/apps/website/src/components/workshop/ModelsPage.vue b/apps/website/src/components/workshop/ModelsPage.vue index a20f8b4538f..3bfe8dc1548 100644 --- a/apps/website/src/components/workshop/ModelsPage.vue +++ b/apps/website/src/components/workshop/ModelsPage.vue @@ -239,7 +239,7 @@ const Content = shallowRef(createContent()) data-testid="workshop-heading" :class="inSection ? 'sr-only' : 'animate-soft-in pb-4 sm:short:pb-3'" > -

+

{{ t('workshop.catalogue.eyebrow') }}

{{ heading }}

diff --git a/apps/website/src/components/workshop/WorkshopModelCard.test.ts b/apps/website/src/components/workshop/WorkshopModelCard.test.ts index d70eaeba904..8b594bdc6e7 100644 --- a/apps/website/src/components/workshop/WorkshopModelCard.test.ts +++ b/apps/website/src/components/workshop/WorkshopModelCard.test.ts @@ -1,4 +1,4 @@ -import { render, screen } from '@testing-library/vue' +import { render, screen, within } from '@testing-library/vue' import { afterEach, describe, expect, it } from 'vitest' import { nextTick } from 'vue' @@ -37,6 +37,29 @@ describe('WorkshopModelCard', () => { Object.defineProperty(HTMLElement.prototype, name, descriptor) }) + it('offers separate playground and API links without nesting controls', () => { + render(WorkshopModelCard, { props: { model: base } }) + expect(screen.getByRole('link', { name: 'Try model' })).toHaveAttribute( + 'href', + base.href + ) + expect(screen.getByRole('link', { name: 'Use API' })).toHaveAttribute( + 'href', + base.href + '#api' + ) + expect( + within(screen.getByTestId('workshop-model-card')).queryByRole('link') + ).toBeNull() + }) + + it('does not offer model actions for a disabled model', () => { + render(WorkshopModelCard, { + props: { model: { ...base, href: undefined } } + }) + expect(screen.queryByRole('link', { name: 'Use API' })).toBeNull() + expect(screen.queryByRole('link', { name: 'Try model' })).toBeNull() + }) + it('links the name, provider badge and task to the model page', () => { render(WorkshopModelCard, { props: { model: base } }) const link = screen.getByTestId('workshop-model-card') @@ -52,7 +75,9 @@ describe('WorkshopModelCard', () => { expect(screen.queryByTestId('model-incomplete-badge')).toBeNull() expect(screen.getByTestId('model-media-placeholder')).toBeTruthy() expect(screen.queryByRole('img', { name: 'Flux' })).toBeNull() - expect(screen.getAllByLabelText('Flux')).toEqual([screen.getByRole('link')]) + expect(screen.getAllByLabelText('Flux')).toEqual([ + screen.getByTestId('workshop-model-card') + ]) }) // The artwork is decorative: the mark says who made this and the heading @@ -66,7 +91,7 @@ describe('WorkshopModelCard', () => { } } }) - expect(screen.getByRole('link')).toHaveAccessibleName( + expect(screen.getByTestId('workshop-model-card')).toHaveAccessibleName( 'Black Forest Labs Flux Image to image' ) expect(screen.queryByRole('img', { name: 'Flux' })).toBeNull() @@ -89,7 +114,7 @@ describe('WorkshopModelCard', () => { await nextTick() await nextTick() expect(screen.getByTestId('tag-overflow')).toBeTruthy() - expect(screen.getByRole('link')).toHaveAccessibleName( + expect(screen.getByTestId('workshop-model-card')).toHaveAccessibleName( 'Black Forest Labs Flux Image to image' ) expect(screen.queryByRole('button')).toBeNull() @@ -97,7 +122,7 @@ describe('WorkshopModelCard', () => { it('names a hub card with its kind badge after the provider', () => { render(WorkshopModelCard, { props: { model: base, providerBadge: true } }) - expect(screen.getByRole('link')).toHaveAccessibleName( + expect(screen.getByTestId('workshop-model-card')).toHaveAccessibleName( 'Black Forest Labs Models Flux Image to image' ) }) @@ -154,7 +179,9 @@ describe('WorkshopModelCard', () => { 'href', base.href ) - expect(screen.getAllByLabelText('Flux')).toEqual([screen.getByRole('link')]) + expect(screen.getAllByLabelText('Flux')).toEqual([ + screen.getByTestId('workshop-model-card') + ]) }) // Artwork that repeats the name gives a screen reader the model twice. The @@ -180,7 +207,7 @@ describe('WorkshopModelCard', () => { screen.getByRole('link', { name: /Black Forest Labs/ }) ).toBeVisible() expect(screen.getAllByLabelText('Flux')).toEqual([ - screen.getByRole('link') + screen.getByTestId('workshop-model-card') ]) if (kind === 'video') expect(screen.getByTestId('model-card-media')).toHaveAttribute( diff --git a/apps/website/src/components/workshop/WorkshopModelCard.vue b/apps/website/src/components/workshop/WorkshopModelCard.vue index 0bad60bf7f1..5236d8df777 100644 --- a/apps/website/src/components/workshop/WorkshopModelCard.vue +++ b/apps/website/src/components/workshop/WorkshopModelCard.vue @@ -81,83 +81,101 @@ const pillClass = diff --git a/apps/website/src/lib/workshop/featured-slides.ts b/apps/website/src/lib/workshop/featured-slides.ts index a44573f9f18..6212b19ea96 100644 --- a/apps/website/src/lib/workshop/featured-slides.ts +++ b/apps/website/src/lib/workshop/featured-slides.ts @@ -1,6 +1,7 @@ import type { WorkshopModel } from '@/config/models-catalogue' import type { FeaturedSlide } from '@/components/workshop/FeaturedBanner.vue' import type { Locale } from '@/i18n/translations' +import { translationsFor } from '@/i18n/translations' import { bannerName } from './banner-name' import { bannerSummary } from './banner-summary' import { modelDocsHref } from './model-docs' @@ -27,6 +28,10 @@ export function modelSlides( .map((model) => ({ key: model.slug, href: model.href, + apiHref: model.routerId ? `${model.href}#api` : undefined, + cta: model.routerId + ? translationsFor(locale).t('workshop.hub.tryModel') + : undefined, title: bannerName(model.name, taskLabelFor(model, 'en')), kind: taskLabelFor(model, locale), tags: model.capabilities.slice(0, TAG_LIMIT), diff --git a/apps/website/src/locales/en/main.json b/apps/website/src/locales/en/main.json index 6691450e7d1..3c4adde8e6f 100644 --- a/apps/website/src/locales/en/main.json +++ b/apps/website/src/locales/en/main.json @@ -20,7 +20,7 @@ "hero": { "eyebrow": "Models", "heading": "ComfyUI models", - "subtitle": "What will you make next? Try the latest AI models with your own ideas, right in your browser." + "subtitle": "Try models here, call them through the API, or build them into a ComfyUI workflow." }, "search": { "label": "Search models, providers, and categories", @@ -551,6 +551,8 @@ "models": "Models", "categories": "CATEGORIES", "docs": "Read docs", + "tryModel": "Try model", + "useApi": "Use API", "tryNow": "Try now", "tag": { "partnerNodes": "Partner Nodes" diff --git a/apps/website/src/locales/zh-CN/main.json b/apps/website/src/locales/zh-CN/main.json index 434f8a896b6..d2b095ef47b 100644 --- a/apps/website/src/locales/zh-CN/main.json +++ b/apps/website/src/locales/zh-CN/main.json @@ -4818,7 +4818,7 @@ "hero": { "eyebrow": "模型", "heading": "ComfyUI 模型", - "subtitle": "接下来你想创造什么?用你自己的创意试用最新的 AI 模型,就在浏览器中。" + "subtitle": "在这里试用模型,通过 API 调用,或将它们集成到 ComfyUI 工作流中。" }, "hub": { "categories": "分类", @@ -4861,6 +4861,8 @@ "partnerNodes": "合作伙伴节点" }, "title": "浏览模型", + "tryModel": "试用模型", + "useApi": "使用 API", "tryNow": "立即试用", "workflows": "工作流" }, From ed244cfe7181788b45a00d325e49df2300179b0f Mon Sep 17 00:00:00 2001 From: RKhur <60106241+RKhur@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:35:38 -0700 Subject: [PATCH 02/13] fix(website): place model actions inside cards and restore API symbol --- .../workshop/FeaturedBanner.test.ts | 15 +++++---- .../components/workshop/FeaturedBanner.vue | 1 + .../workshop/WorkshopModelCard.test.ts | 31 +++++++++++++------ .../components/workshop/WorkshopModelCard.vue | 16 +++++++--- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/apps/website/src/components/workshop/FeaturedBanner.test.ts b/apps/website/src/components/workshop/FeaturedBanner.test.ts index 5b76ce1f8db..f34c20c30b1 100644 --- a/apps/website/src/components/workshop/FeaturedBanner.test.ts +++ b/apps/website/src/components/workshop/FeaturedBanner.test.ts @@ -102,7 +102,7 @@ describe('FeaturedBanner', () => { ) }) - it('shows the docs button only when the provider has a docs section', async () => { + it('offers an API link even when the provider has no docs section', async () => { const user = userEvent.setup() const undocumented: WorkshopModel = { ...kling, @@ -117,13 +117,16 @@ describe('FeaturedBanner', () => { }) const docs = screen.getByTestId('featured-docs-link') - expect(docs.getAttribute('href')).toBe( - 'https://docs.comfy.org/development/comfy-router/models#black-forest-labs' - ) - expect(docs.getAttribute('target')).toBe('_blank') + expect(docs.getAttribute('href')).toBe('/models/flux/#api') + expect(docs.getAttribute('target')).toBeNull() + expect(docs).toHaveTextContent('Use API') + expect(docs).toHaveTextContent('⌘') await user.click(screen.getByRole('button', { name: 'Magnific' })) - expect(screen.queryByTestId('featured-docs-link')).toBeNull() + expect(screen.getByTestId('featured-docs-link')).toHaveAttribute( + 'href', + '/models/magnific/#api' + ) }) it('stays out of the way when the catalogue has nothing to feature', () => { diff --git a/apps/website/src/components/workshop/FeaturedBanner.vue b/apps/website/src/components/workshop/FeaturedBanner.vue index ad5c2c67ca5..82309eb1a1d 100644 --- a/apps/website/src/components/workshop/FeaturedBanner.vue +++ b/apps/website/src/components/workshop/FeaturedBanner.vue @@ -224,6 +224,7 @@ const fill = computed(() => {{ t(active.apiHref ? 'workshop.hub.useApi' : 'workshop.hub.docs') }} + diff --git a/apps/website/src/components/workshop/WorkshopModelCard.test.ts b/apps/website/src/components/workshop/WorkshopModelCard.test.ts index 8b594bdc6e7..1fd087a6ac3 100644 --- a/apps/website/src/components/workshop/WorkshopModelCard.test.ts +++ b/apps/website/src/components/workshop/WorkshopModelCard.test.ts @@ -38,7 +38,12 @@ describe('WorkshopModelCard', () => { }) it('offers separate playground and API links without nesting controls', () => { - render(WorkshopModelCard, { props: { model: base } }) + render(WorkshopModelCard, { + props: { model: { ...base, capabilities: ['upscale'] } } + }) + expect(screen.queryByTestId('model-card-task')).toBeNull() + expect(screen.queryByText('upscale')).toBeNull() + expect(screen.getByRole('link', { name: 'Use API' })).toHaveTextContent('⌘') expect(screen.getByRole('link', { name: 'Try model' })).toHaveAttribute( 'href', base.href @@ -60,7 +65,7 @@ describe('WorkshopModelCard', () => { expect(screen.queryByRole('link', { name: 'Try model' })).toBeNull() }) - it('links the name, provider badge and task to the model page', () => { + it('links the name and provider badge to the model page', () => { render(WorkshopModelCard, { props: { model: base } }) const link = screen.getByTestId('workshop-model-card') expect(link.getAttribute('href')).toBe('/models/flux/') @@ -68,9 +73,7 @@ describe('WorkshopModelCard', () => { expect(screen.getByTestId('model-card-provider')).toHaveTextContent( 'Black Forest Labs' ) - expect(screen.getByTestId('model-card-task').textContent).toBe( - 'Image to image' - ) + expect(screen.queryByTestId('model-card-task')).toBeNull() expect(screen.queryByText(/credits|\$/)).toBeNull() expect(screen.queryByTestId('model-incomplete-badge')).toBeNull() expect(screen.getByTestId('model-media-placeholder')).toBeTruthy() @@ -92,7 +95,7 @@ describe('WorkshopModelCard', () => { } }) expect(screen.getByTestId('workshop-model-card')).toHaveAccessibleName( - 'Black Forest Labs Flux Image to image' + 'Black Forest Labs Flux' ) expect(screen.queryByRole('img', { name: 'Flux' })).toBeNull() }) @@ -108,7 +111,11 @@ describe('WorkshopModelCard', () => { }) render(WorkshopModelCard, { props: { - model: { ...base, capabilities: ['upscale', 'inpaint', 'controlnet'] } + model: { + ...base, + routerId: undefined, + capabilities: ['upscale', 'inpaint', 'controlnet'] + } } }) await nextTick() @@ -123,7 +130,7 @@ describe('WorkshopModelCard', () => { it('names a hub card with its kind badge after the provider', () => { render(WorkshopModelCard, { props: { model: base, providerBadge: true } }) expect(screen.getByTestId('workshop-model-card')).toHaveAccessibleName( - 'Black Forest Labs Models Flux Image to image' + 'Black Forest Labs Models Flux' ) }) @@ -151,7 +158,13 @@ describe('WorkshopModelCard', () => { it('falls back to the provider initial and the modality when nothing matches', () => { render(WorkshopModelCard, { props: { - model: { ...base, name: 'Mystery', provider: 'Nobody', task: undefined } + model: { + ...base, + routerId: undefined, + name: 'Mystery', + provider: 'Nobody', + task: undefined + } } }) expect(screen.getByText('N')).toBeTruthy() diff --git a/apps/website/src/components/workshop/WorkshopModelCard.vue b/apps/website/src/components/workshop/WorkshopModelCard.vue index 5236d8df777..45ca2a573ea 100644 --- a/apps/website/src/components/workshop/WorkshopModelCard.vue +++ b/apps/website/src/components/workshop/WorkshopModelCard.vue @@ -62,7 +62,10 @@ const thumbnailLabel = computed(() => ) const id = useId() -const showsTask = computed(() => !workflow.value || !underHeading) +const hasModelActions = computed(() => Boolean(model.routerId && model.href)) +const showsTask = computed( + () => !hasModelActions.value && (!workflow.value || !underHeading) +) // The tags stay visible inside the link but out of its name. const labelledBy = computed(() => [ @@ -81,10 +84,12 @@ const pillClass =