Skip to content

Fix --list-models in JS vision sample#826

Open
natke wants to merge 1 commit into
mainfrom
natke/fix-js-vision-list-models
Open

Fix --list-models in JS vision sample#826
natke wants to merge 1 commit into
mainfrom
natke/fix-js-vision-list-models

Conversation

@natke

@natke natke commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

The --list-models branch in samples/js/web-server-responses-vision-example/app.js called manager.catalog.listModels(), which does not exist on the SDK catalog (the correct method is getModels()). It also awaited variant.isCached as if it were an async method, but it is a synchronous getter property.

This PR fixes both call sites of listModels() and the isCached() invocation so that --list-models actually prints the vision-model table instead of throwing.

Tested locally against the Qwen3.5 VL family with node app.js --list-models — output now renders the expected table.

The --list-models branch in samples/js/web-server-responses-vision-example/app.js
called manager.catalog.listModels(), which does not exist on the SDK catalog
(the correct method is getModels()). It also awaited variant.isCached as if it
were an async method, but it is a synchronous getter property.

This fixes both call sites of listModels() and the isCached() invocation so
that --list-models actually prints the vision-model table instead of throwing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 19, 2026 23:12
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Jun 19, 2026 11:12pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the --list-models code path in the JavaScript vision sample (samples/js/web-server-responses-vision-example/app.js). The sample called manager.catalog.listModels(), which does not exist on the SDK catalog, and awaited v.isCached as though it were an async method. Both bugs would cause --list-models to throw instead of printing the vision-model table. The corrections align the sample with the actual foundry-local-sdk API.

I verified against the SDK source that:

  • Catalog.getModels() exists (sdk/js/src/catalog.ts:149) and there is no listModels() method.
  • IModel.isCached is a synchronous boolean getter (sdk/js/src/imodel.ts:11), so it must not be invoked or awaited.

Both listModels() call sites (lines 52 and 101) and the single await v.isCached() (line 88) were correctly updated, and no other affected call sites remain.

Changes:

  • Replace manager.catalog.listModels() with manager.catalog.getModels() at both call sites.
  • Replace (await v.isCached()) with the synchronous getter v.isCached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants