zjncs opened a new pull request, #5709:
URL: https://github.com/apache/rocketmq-dashboard/pull/5709
### What
`ModelBadge` — the brand logo in front of a model name, so the model
selector reads at a glance — had no test. This adds `ModelBadge.test.tsx` with
8 tests.
### Why
Model ids arrive as free text from the configured provider, so the prefix
mapping and its fallback are the whole contract: a wrong mapping shows one
vendor's logo on another vendor's model, and a lost fallback renders nothing
for unknown models. The exported `modelBrandLogo` is also reused by the
assistant avatar in the transcript, so the mapping is shared API, not a private
detail.
### What is pinned
- known model families (qwen / claude / deepseek / gemini / gpt) render
their vendored brand logo as a decorative image (`alt=""`, `aria-hidden`);
- **the brand prefix match is case-insensitive** (`QWEN-Max` resolves);
- an unknown model falls back to the neutral **uppercase letter** badge;
- an empty model falls back to a question mark;
- the requested size is honoured on both the logo image and the letter span,
and defaults to the inline 16px;
- `modelBrandLogo` resolves known families and returns `null` for unknown
ones so the avatar caller can fall back.
### Verification
- New tests on unmodified code: **8/8 green** (`npx vitest run`).
- Discriminating mutations on `ModelBadge`, vitest result verified red each
time:
1. the lowercasing dropped so the prefix match is case-sensitive — red;
2. the fallback letter no longer uppercased — red;
3. the requested size ignored in favour of a hardcoded 16 — red.
- Restored: 8/8 green. Test-only change; no product code touched.
--
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]