mirror of
https://github.com/techforces-ai/Cial.git
synced 2026-05-15 19:14:11 +00:00
fix(MessageList): guard against possibly-undefined message in lookup
`session.messages[i]` is typed as `Message | undefined` under noUncheckedIndexedAccess. Optional-chain the role check so the agent's lastUserIdx scan type-checks again — the runtime semantics are identical (loop only runs while `i` is in range).
This commit is contained in:
parent
f380008659
commit
f8c0b5fa69
1 changed files with 1 additions and 1 deletions
|
|
@ -34,7 +34,7 @@ export function MessageList({ session }: MessageListProps) {
|
|||
// pulsing-gradient + glow state while the assistant is busy).
|
||||
let lastUserIdx = -1;
|
||||
for (let i = session.messages.length - 1; i >= 0; i--) {
|
||||
if (session.messages[i].role === 'user') {
|
||||
if (session.messages[i]?.role === 'user') {
|
||||
lastUserIdx = i;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue