Skip to content

fix(home): report a failed assistant config load instead of a dead input - #6082

Merged
lizhimins merged 1 commit into
apache:masterfrom
Frun1na:fix/home-llm-config-load
Nov 27, 2026
Merged

lizhimins merged 1 commit into
apache:masterfrom
Frun1na:fix/home-llm-config-load

Conversation

@Frun1na

@Frun1na Frun1na commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

The home page loaded the assistant configuration with getLlmConfig().catch(() => null)
(web/src/pages/home/index.tsx:118), so a failed request was stored as "there is no configuration" —
indistinguishable from the state before the response arrives. The shared composer explains a missing
configuration only when it has one: its not-ready banner and status tag are both behind llmConfig && ...
(web/src/pages/ai/components/Composer.tsx:312, :425), while the send action requires llmReady
(index.tsx:100-101). A failed GET /api/llm/config therefore left the input box disabled with no reason
shown, no retry, and nothing to tell it apart from a page that is still loading.

The failure is now a state: the load is wrapped in try/catch, the page renders llm.loadFailed above the
composer with a retry that re-runs the load, and the recovered configuration drives the composer again.
User-visible change: on the home page a failed assistant-configuration request now says so ("加载AI配置失败"
/ "Failed to load AI config") and can be retried; before, the input box was silently dead. No new
user-facing copy was introduced — llm.loadFailed and common.retry already exist with Chinese and
English entries.

The model fallback is unchanged: when the configuration cannot be read, the home model list is still
offered and the recommended model is still preselected.

How Did You Test This Change?

$ cd web && npx eslint src/pages/home/index.tsx
# clean

$ cd web && npx prettier --check src/pages/home/index.tsx
# clean

$ cd web && npx vitest related --run src/pages/home/index.tsx --maxWorkers=1 --fileParallelism=false
 ✓ src/pages/home/__tests__/HomePage.test.tsx (10 tests) 1384ms
 ✓ src/App.test.tsx (10 tests) 468ms
 Test Files  2 passed (2)
      Tests  20 passed (20)

$ cd web && npx tsc -b
# clean

The new test fails without the fix:

$ cd web && npx vitest related --run src/pages/home/__tests__/HomePage.test.tsx \
    --maxWorkers=1 --fileParallelism=false
 FAIL src/pages/home/__tests__/HomePage.test.tsx > HomePage LLM models > says the assistant configuration could not be loaded instead of leaving the input dead
 TestingLibraryElementError: Unable to find an element with the text: 加载AI配置失败.
 Test Files  1 failed (1)
      Tests  1 failed | 9 passed (10)

(That run is pages/home/index.tsx reverted and the new test kept, which is also the mutation check; the
case is green again once the fix is restored. The test also pins the recovery: after the retry the composer
reports its provider status and a prompt is handed to the AI page again.)

Checklist

  • One coherent change; unrelated modifications are not bundled in
  • Commit subject follows Conventional Commits (feat: / fix: / refactor: / chore: / docs: / perf:)
  • Tests added or updated for non-trivial changes, test methods named ...Test
  • New UI text has both Chinese and English entries under web/src/i18n/
  • Architecture constraints stay green (mvn test runs the ArchUnit checks)
  • New source files carry the ASF license header
  • Documentation touched where behaviour changed (README / docs/ / in-app help)

The home page loaded the assistant configuration with `getLlmConfig().catch(() => null)`, so a failed
request was stored as "there is no configuration". The shared composer explains a missing configuration
only when it has one (`Composer` renders its not-ready banner and status tag behind `llmConfig && ...`)
while the send action requires `llmReady`, so the failure left the input box disabled with no reason shown,
no retry, and no way to tell it apart from a page that is still loading.

The failure is now a state: the page reports `llm.loadFailed` above the composer with a retry that re-runs
the load, and the recovered configuration drives the composer again. The model fallback is unchanged - the
home model list is still offered when the configuration cannot be read.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 08:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

lizhimins pushed a commit that referenced this pull request Oct 15, 2026
…pty form (#6550)

The AI assistant settings tab reported a failed configuration load as a transient toast and then
rendered the form anyway, with every field empty and the API key slot prompting for a key - the tab
claimed that nothing is configured. The load request is admin-only on the server
(`AuthInterceptor.isAdminOnlyGetPath` covers `/api/llm/config` and `/api/llm/models`), so a reader
opening Settings sees that blank configuration on every visit, and an administrator's transient
failure is indistinguishable from an empty configuration as well.

The tab keeps the server's reason and offers a retry: a failed load now renders an error notice
above the form with the message the request failed with ("Admin permission required" for a reader)
and a retry button that re-runs the load, clearing the notice once it succeeds. `AlertRuleAssetList`
already uses this shape for its own list, and the home page's assistant load failure is handled the
same way in #6082. No new copy: the notice and the button reuse `llm.loadFailed` and `common.retry`.
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.

@github-actions github-actions Bot added the stale label Oct 20, 2026
@github-actions github-actions Bot closed this Oct 20, 2026
@lizhimins lizhimins reopened this Nov 27, 2026
@lizhimins
lizhimins changed the base branch from rocketmq-studio to master November 27, 2026 04:55
@lizhimins
lizhimins merged commit 9367f66 into apache:master Nov 27, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] The home page leaves the assistant input dead when the LLM configuration cannot be loaded

3 participants