Skip to content

fix(ai-chat): add null check to model name#645

Open
hestela wants to merge 1 commit intoCrosstalk-Solutions:devfrom
hestela:feat/fix-model-check
Open

fix(ai-chat): add null check to model name#645
hestela wants to merge 1 commit intoCrosstalk-Solutions:devfrom
hestela:feat/fix-model-check

Conversation

@hestela
Copy link
Copy Markdown
Collaborator

@hestela hestela commented Apr 4, 2026

When the OpenAI-compatible fallback (/v1/models) is used, models are mapped as { name: m.id, size: 0 } with no details field. Accessing model.details.parameter_size throws
TypeError: Cannot read properties of undefined, which crashes the React render and causes the entire page to go blank.

When the OpenAI-compatible fallback (/v1/models) is used, models are mapped as { name: m.id, size: 0 } with no details field. Accessing model.details.parameter_size throws
TypeError: Cannot read properties of undefined, which crashes the React render and causes the entire page to go blank.
@hestela
Copy link
Copy Markdown
Collaborator Author

hestela commented Apr 4, 2026

this seems to be new code from #612. i found this with lm-studio as well as a custom openai api interface.

Copy link
Copy Markdown
Collaborator

@chriscrosstalk chriscrosstalk left a comment

Choose a reason for hiding this comment

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

Reviewed the diff -- clean one-character fix for a real crash. When using the remote OpenAI-compatible fallback (/v1/models), models come back without a details field, so model.details.parameter_size throws a TypeError and blanks the entire AI settings page. Optional chaining is the right fix.

This is a regression from PR #612 (Installed Models section) that shipped in v1.31.0. Recommend including in a v1.31.1 hotfix.

Copy link
Copy Markdown
Collaborator

@chriscrosstalk chriscrosstalk left a comment

Choose a reason for hiding this comment

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

Textbook hotfix. One-character optional-chaining addition that prevents a full-page crash when any remote OpenAI-compatible backend returns models without a details field. Zero regression risk — optional chaining is strictly safer than the current unchecked access.

This also directly addresses the crash symptom I diagnosed in #679 (empty Models & Settings page with remote LLM). It won't make unsupported backends like LM Studio fully work, but it restores the page and prevents the blank-screen experience for anyone using a remote Ollama host too.

Strong v1.31.1 candidate. Approving.

@chriscrosstalk chriscrosstalk added the Next Release This PR is staged for our next release. label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Next Release This PR is staged for our next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants