Skip to content

fix: use truthy check for VITE_LLM_MODELS and VITE_CHAT_MODES env vars#1548

Open
learner-77 wants to merge 1 commit intoneo4j-labs:mainfrom
learner-77:upstream-pr/fix-vite-env-var-truthy-check
Open

fix: use truthy check for VITE_LLM_MODELS and VITE_CHAT_MODES env vars#1548
learner-77 wants to merge 1 commit intoneo4j-labs:mainfrom
learner-77:upstream-pr/fix-vite-env-var-truthy-check

Conversation

@learner-77
Copy link
Copy Markdown

Replace != '' guard with truthy check for llms, prodllms, and chatModes. undefined?.trim() returns undefined, and undefined != '' is true, causing the env var guard to pass with an undefined value — crashing callers that call .split() or .includes() on it.

Also fix chatModes mapping: split values like 'graph+vector' are human-readable labels, not internal mode keys. Map through chatModeLables and filter out any mode not present in chatModeReadableLables to prevent ChatModeToggle crash on unknown keys.

Replace != '' guard with truthy check for llms, prodllms, and chatModes.
undefined?.trim() returns undefined, and undefined != '' is true, causing
the env var guard to pass with an undefined value — crashing callers that
call .split() or .includes() on it.

Also fix chatModes mapping: split values like 'graph+vector' are
human-readable labels, not internal mode keys. Map through chatModeLables
and filter out any mode not present in chatModeReadableLables to prevent
ChatModeToggle crash on unknown keys.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant