Skip to content

fix(lightspeed): added empty state for unconfigured LLM#2781

Open
ciiay wants to merge 7 commits intoredhat-developer:mainfrom
ciiay:rhidp-12816-add-empty-state
Open

fix(lightspeed): added empty state for unconfigured LLM#2781
ciiay wants to merge 7 commits intoredhat-developer:mainfrom
ciiay:rhidp-12816-add-empty-state

Conversation

@ciiay
Copy link
Copy Markdown
Member

@ciiay ciiay commented Apr 15, 2026

Hey, I just made a Pull Request!

For RHIDP-12816

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

Test steps:

  1. In run.yaml comment out your provider config in the inference array, for example:
providers:
  ...
  inference:
    - config:
        api_token: ${env.VLLM_API_KEY:=}
        base_url: ${env.VLLM_URL:=}
        max_tokens: ${env.VLLM_MAX_TOKENS:=4096}
        network:
          tls:
            verify: ${env.VLLM_TLS_VERIFY:=true}
      provider_id: ${env.ENABLE_VLLM:+vllm}
      provider_type: remote::vllm
    # - config:
    #     base_url: ${env.OLLAMA_URL:=http://localhost:11434/v1}
    #   provider_id: ${env.ENABLE_OLLAMA:+ollama}
    #   provider_type: remote::vllm
    ...
  1. Remove local persistence (matches whatever paths you have in storage.backend in your run.yaml)
rm -f /tmp/kvstore.db /tmp/sql_store.db
  1. Restart Llama Stack and LCS

Screenshot(updated on 4/16):

image

Signed-off-by: Yi Cai <yicai@redhat.com>
@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge bot commented Apr 15, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Error blocks usable chat🐞
Description
LightspeedChatContainerInner always renders the error empty-state when useAllModels().isError is
true, even if useAllModels().data already contains LLM models (modelsItems non-empty). This can
unnecessarily hide the chat UI (and force a retry) in scenarios where model data is still usable
(e.g., stale/cached data or partial failures).
Code

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatContainer.tsx[R176-182]

+  if (modelsError) {
+    return <ModelsLoadErrorEmptyState onRetry={() => refetchModels()} />;
+  }
+
+  if (modelsItems.length === 0) {
+    return <LcoreNotConfiguredEmptyState />;
+  }
Evidence
The container derives modelsItems from the query data (models) and then checks modelsError before
checking whether modelsItems is empty; because data and error state are not mutually exclusive in
the hook contract, this ordering can select the error screen even when modelsItems has entries.

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatContainer.tsx[56-86]
workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatContainer.tsx[172-182]
workspaces/lightspeed/plugins/lightspeed/src/hooks/useAllModels.ts[25-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`LightspeedChatContainerInner` shows `ModelsLoadErrorEmptyState` whenever `isError` is true, even if there is still model data available (i.e., `modelsItems.length > 0`). This can block the chat UI unnecessarily.

### Issue Context
`modelsItems` is computed from `useAllModels().data` and may be non-empty while `useAllModels().isError` is true (the hook’s return type does not guarantee these are mutually exclusive).

### Fix Focus Areas
- workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatContainer.tsx[172-182]

### Suggested change
Adjust the conditional to only show the error empty-state when there is no usable model data, e.g.:
- `if (modelsError && modelsItems.length === 0) return <ModelsLoadErrorEmptyState ... />;`

Optionally, if `modelsItems.length > 0` and `modelsError` is true, keep rendering the chat and surface a non-blocking warning/retry control.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@rhdh-gh-app
Copy link
Copy Markdown

rhdh-gh-app bot commented Apr 15, 2026

Missing Changesets

The following package(s) are changed by this PR but do not have a changeset:

  • @red-hat-developer-hub/backstage-plugin-lightspeed

See CONTRIBUTING.md for more information about how to add changesets.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-lightspeed workspaces/lightspeed/plugins/lightspeed none v2.0.0

@rhdh-qodo-merge
Copy link
Copy Markdown

Review Summary by Qodo

Add empty and error states for Lightspeed LLM configuration

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Added empty state UI for unconfigured LLM models
• Added error state UI for failed model loading
• Added loading state UI while fetching models
• Extended translations across 6 languages
• Added comprehensive test coverage for new states
Diagram
flowchart LR
  A["Models API"] -->|loading| B["Loading State"]
  A -->|error| C["Error State with Retry"]
  A -->|empty list| D["Not Configured State"]
  A -->|success| E["Chat Interface"]
Loading

Grey Divider

File Changes

1. workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatModelsState.tsx ✨ Enhancement +196/-0

New component for model state UI displays

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatModelsState.tsx


2. workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatContainer.tsx ✨ Enhancement +23/-1

Integrated model state handling and displays

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatContainer.tsx


3. workspaces/lightspeed/plugins/lightspeed/src/translations/ref.ts 📝 Documentation +11/-0

Added English translations for model states

workspaces/lightspeed/plugins/lightspeed/src/translations/ref.ts


View more (6)
4. workspaces/lightspeed/plugins/lightspeed/src/translations/de.ts 📝 Documentation +9/-0

Added German translations for model states

workspaces/lightspeed/plugins/lightspeed/src/translations/de.ts


5. workspaces/lightspeed/plugins/lightspeed/src/translations/es.ts 📝 Documentation +9/-0

Added Spanish translations for model states

workspaces/lightspeed/plugins/lightspeed/src/translations/es.ts


6. workspaces/lightspeed/plugins/lightspeed/src/translations/fr.ts 📝 Documentation +9/-0

Added French translations for model states

workspaces/lightspeed/plugins/lightspeed/src/translations/fr.ts


7. workspaces/lightspeed/plugins/lightspeed/src/translations/it.ts 📝 Documentation +9/-0

Added Italian translations for model states

workspaces/lightspeed/plugins/lightspeed/src/translations/it.ts


8. workspaces/lightspeed/plugins/lightspeed/src/translations/ja.ts 📝 Documentation +9/-0

Added Japanese translations for model states

workspaces/lightspeed/plugins/lightspeed/src/translations/ja.ts


9. workspaces/lightspeed/plugins/lightspeed/src/components/__tests__/LightspeedPage.test.tsx 🧪 Tests +105/-3

Added tests for model loading and error states

workspaces/lightspeed/plugins/lightspeed/src/components/tests/LightspeedPage.test.tsx


Grey Divider

Qodo Logo

ciiay added 2 commits April 15, 2026 14:26
Signed-off-by: Yi Cai <yicai@redhat.com>
Signed-off-by: Yi Cai <yicai@redhat.com>
@ciiay ciiay enabled auto-merge (squash) April 15, 2026 18:40
@ciiay
Copy link
Copy Markdown
Member Author

ciiay commented Apr 15, 2026

Hi @ShiranHi , any input to the empty state display?

@aprilma419
Copy link
Copy Markdown

aprilma419 commented Apr 16, 2026 via email

@ShiranHi
Copy link
Copy Markdown

@ciiay looks good to me, I have some small comments:

  1. Let's change the text to:
    Title: Connect an LLM to get started
    Text: To use Lightspeed's AI capabilities, you'll need to register an OpenAI-compatible LLM with your Llama Stack deployment.
  2. Change the first button label to be "Configure Llama Stack"
  3. Change the second button label to be "Lightspeed Backend Setup" should be a link and not a secondary button
  4. Remove the top X button, users can close this window from the floating button

Signed-off-by: Yi Cai <yicai@redhat.com>
Signed-off-by: Yi Cai <yicai@redhat.com>
@ciiay
Copy link
Copy Markdown
Member Author

ciiay commented Apr 17, 2026

Hi @ShiranHi , thanks for the input. I have updated the screenshot in the PR description. Can you take a look and see if it looks good now?

Signed-off-by: Yi Cai <yicai@redhat.com>
@ShiranHi
Copy link
Copy Markdown

Hi @ShiranHi , thanks for the input. I have updated the screenshot in the PR description. Can you take a look and see if it looks good now?

Thank you! Looks good to me!

Comment on lines +139 to +142
const modeToUse =
rawMode === ChatbotDisplayMode.embedded
? ChatbotDisplayMode.default
: rawMode;
Copy link
Copy Markdown
Member

@karthikjeeyar karthikjeeyar Apr 17, 2026

Choose a reason for hiding this comment

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

This makes the persisting & retaining user mode selection feature only work on overlay and docked mode? I am trying to understand why we need to skip the full-screen mode here, most of the users may use full screen mode, with this change to get to fullscreen then user have to change it manually everytime via mode selector now?

Copy link
Copy Markdown
Contributor

@Jdubrick Jdubrick left a comment

Choose a reason for hiding this comment

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

Thanks for this! Couple of things I have in mind / questions:

  1. In the blurb about using Lightspeed and connecting to an LLM to get started, I think we should maybe be also mentioning that they should be contacting an administrator to get it setup? A normal user of Lightspeed won't have the access required to set up the secrets required
  2. I like the link to Llama Stack, but I think if we leave a link there it should be to our rhdh documentation instead of the llama stack github
  3. I noticed in the test steps it instructs to set the inference settings to an empty array [], what version of Lightspeed Core / Llama Stack did you test this against? My concern is that it will never truly be empty as we always will have our RAG transformer in the inference, even if there is no LLM:

I.e.

- provider_id: sentence-transformers
      provider_type: inline::sentence-transformers
      config: {}

The content in main of https://github.com/redhat-ai-dev/lightspeed-configs/tree/main can spin up a local LCORE instance with our latest config set

@ciiay
Copy link
Copy Markdown
Member Author

ciiay commented Apr 17, 2026

Hi @Jdubrick , thanks for the review and feedback.

I noticed in the test steps it instructs to set the inference settings to an empty array [], what version of Lightspeed Core / Llama Stack did you test this against? My concern is that it will never truly be empty as we always will have our RAG transformer in the inference, even if there is no LLM:

Good catch 👍 You’re right about the inference config. I tested against latest main of lightspeed-stack at the time I worked on this PR. I only described an empty array for convenience. I’ve updated the Test steps in the PR description so other reviewers aren’t confused.

I agree with the other two points. I’ll get input from our UX team and update the wording and links accordingly.

@ciiay
Copy link
Copy Markdown
Member Author

ciiay commented Apr 17, 2026

Hi @ShiranHi , any suggestions to these points? Shall we use Installing and configuring Red Hat Developer Lightspeed for Red Hat Developer Hub for the second point?

  1. In the blurb about using Lightspeed and connecting to an LLM to get started, I think we should maybe be also mentioning that they should be contacting an administrator to get it setup? A normal user of Lightspeed won't have the access required to set up the secrets required
  2. I like the link to Llama Stack, but I think if we leave a link there it should be to our rhdh documentation instead of the llama stack github

Signed-off-by: Yi Cai <yicai@redhat.com>
@sonarqubecloud
Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants