chennaji9 opened a new pull request, #6887: URL: https://github.com/apache/rocketmq-dashboard/pull/6887
### Which Issue(s) This PR Fixes None — small self-contained fix found by inspection (no issue tracked). ### Brief Description Saving with "clear API key" checked never succeeds for HTTP engines. The persist path already understands the clear intent (the `saveConfig` chain carries `.clearApiKey(...)`), but `validate()` still runs its `keyRequired` rule afterwards — a non-ollama provider with an HTTP engine and an empty key raises `missing_api_key` via `LlmGatewayException`. So for openai/deepseek/tongyi-style gateways the "clear key" action itself is rejected by the save-time validation, one step after the persistence side learned to honour it. `validate` now takes an `enforceApiKeyRequirement` flag (the existing overload keeps enforcing), and `saveConfig` passes `!normalized.isClearApiKey()`. `testConfig` keeps enforcing — testing a connection still requires a usable key. A cleared config lands in the not-ready state (`fromGeneralSettings` derives `enabled=false`), consistent with how HTTP-engine readiness already treats a missing key. Context: #5436 (closed, not merged) covered the persistence half of this; that half landed internally on master. This PR closes the loop on the save-time validation. ### How Did You Test This Change? `mvn -B -ntp test -Dtest=LlmConfigServiceTest` → **Tests run: 34, Failures: 0** (31 existing + 3 new). New cases: - clearing the key saves successfully — persisted empty key and the not-ready derivation; - `testConfig` still rejects the cleared config (`missing_api_key`); - saving with neither a stored key nor the clear intent still rejects (store emptied first, since a blank key with no clear intent falls back to the stored one by design). Red side: against the unfixed service the clear-save case fails with an unexpected `LlmGatewayException` — exactly the reported behaviour. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`fix:`) - [x] Tests added or updated for non-trivial changes (3 new red-green tests on the save path) - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (n/a — no UI change) - [x] Architecture constraints stay green (same module, no new dependency) - [x] New source files carry the ASF license header (n/a — no new source file) - [x] Documentation touched where behaviour changed (n/a — clearing a key is already a supported UI action) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
