fix(Chat): list map element must specify a unique key
This commit is contained in:
parent
d9ba36794a
commit
0af66f8b72
|
@ -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 />}
|
||||||
|
|
Loading…
Reference in New Issue