iloveeyjafjalla opened a new pull request, #6274: URL: https://github.com/apache/rocketmq-dashboard/pull/6274
### Which Issue(s) This PR Fixes The accompanying bug report will be linked immediately after PR creation. ### Brief Description Home adds the saved model to its selector even when it is absent from the model catalog. If the catalog finishes loading after Home hands that model to the AI page, `useLlmRuntime` replaces the added option. The selected value and initial request still use the correct model, but after selecting another model the user cannot select the original one again. Keep explicitly handed-off options separately from fetched catalog options and merge them by value. A catalog refresh replaces its own entries; disabling the runtime clears both lists. Existing request-generation guards and send behavior stay intact. ### How Did You Test This Change? Baseline: `rocketmq-studio@5e4c39b053c35a5598cc79ff331b8a54e649d7b1`. Windows 11, Node 24.15.0, npm 11.12.1; independent LF worktree sharing the existing npm-ci dependencies through a local junction. - Unchanged production code with the new regressions: 3 expected failures, 1 duplicate-option control passed. The page failure occurs after real Home → AI navigation, the initial model request and switching away from `qwen-plus`; its original option is absent on reopening the menu. - `npm test -- --maxWorkers=1 src/pages/ai/hooks/useLlmRuntime.test.ts src/pages/ai/__tests__/AiPage.test.tsx`: 29/29 passed after the fix. Covers real selector round-trip, empty/nonempty catalogs, preservation of selection, deduplication and disabled-runtime clearing. - `npm run lint`: exit 0, 0 errors and 10 warnings in untouched files. Targeted ESLint, Prettier and `git diff --check` passed. - `npm run build`: passed, including the license gate (133 components, 140 legal files). - `npm test -- --maxWorkers=4`: 153/153 files and 1521/1521 tests passed (571.65 seconds). The page regression uses the repository's existing saved-provider example (`tongyi` with `qwen-plus`) and the complete current twelve-ID Tongyi catalog from `LlmConfigService`. It renders real HomePage, AiPage and Composer controls, with API/stream boundaries mocked. No model provider, broker, database or deployment was contacted; model availability or inference success is not asserted. Backend and Go tests were not run for this frontend-only change. AI assistance: OpenAI Codex helped investigate, implement and verify this change. Separate automated agents reviewed the source contract, duplicate search and actual implementation/regression evidence. This is not a claim of human or maintainer approval. ### Checklist - [x] One coherent fix and its tests - [x] Conventional Commit subject - [x] Meaningful hook and real-page regressions - [x] New UI translations: N/A, no new UI text - [ ] Java architecture/integration tests: not run, no backend change - [x] Existing ASF headers retained; no new source file - [x] Documentation: N/A, restores the documented handoff behavior -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
