Commit cda45d3
RHOAIENG-58422: Replace magic number check with semantic user-message check
Address review feedback by replacing `messages.length <= 1` with an
explicit check for user messages (`!messages.some(m => m.role === 'user')`).
This eliminates the magic number that depended on knowing the initial bot
message always occupies index 0, making the intent clear: the welcome
prompt hides only when a user has actually sent a message. Added a test
for the empty-messages edge case.
The CI failures (Contract-Tests, test-and-build) were caused by a
transient npm ETIMEDOUT in model-registry install and a pre-existing
flaky mcpTab Cypress test — neither is related to this change.
Closes RHOAIENG-58422
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Nick Gagan <ngagan@redhat.com>1 parent cd4bfb1 commit cda45d3
2 files changed
Lines changed: 9 additions & 3 deletions
File tree
- packages/gen-ai/frontend/src/app/Chatbot
- __tests__
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
| |||
0 commit comments