Skip to content

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

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

fix(lightspeed): added empty state for unconfigured LLM#2781
ciiay wants to merge 4 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 replace any inference or models setting with an empty array [] like this
providers:
  ...
  inference: []

registered_resources:
  models: []
  # models:
  #   - metadata: {}
  #     model_id: ${env.SAFETY_MODEL:=llama-guard3:8b}
  #     model_type: llm
  #     provider_id: ${env.ENABLE_SAFETY:+safety-guard}
  #     provider_model_id: ${env.SAFETY_MODEL:=llama-guard3:8b}
  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>
@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.

3 participants