Merge pull request #86 from WanQuanXie/list-map-key-fix

fix(Chat): list map element must specify a unique key
This commit is contained in:
ItzCrazyKns 2024-05-08 12:56:00 +05:30 committed by GitHub
commit 17fbc28172
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
'use client'; 'use client';
import { useEffect, useRef, useState } from 'react'; import { Fragment, useEffect, useRef, useState } from 'react';
import MessageInput from './MessageInput'; import MessageInput from './MessageInput';
import { Message } from './ChatWindow'; import { Message } from './ChatWindow';
import MessageBox from './MessageBox'; import MessageBox from './MessageBox';
@ -53,7 +53,7 @@ const Chat = ({
const isLast = i === messages.length - 1; const isLast = i === messages.length - 1;
return ( return (
<> <Fragment key={msg.id}>
<MessageBox <MessageBox
key={i} key={i}
message={msg} message={msg}
@ -67,7 +67,7 @@ const Chat = ({
{!isLast && msg.role === 'assistant' && ( {!isLast && msg.role === 'assistant' && (
<div className="h-px w-full bg-[#1C1C1C]" /> <div className="h-px w-full bg-[#1C1C1C]" />
)} )}
</> </Fragment>
); );
})} })}
{loading && !messageAppeared && <MessageBoxLoading />} {loading && !messageAppeared && <MessageBoxLoading />}