feat: add sources of user
This commit is contained in:
parent
4dc5857b17
commit
3afa826fb9
2 changed files with 45 additions and 26 deletions
|
@ -352,7 +352,7 @@ const loadMessages = async (
|
||||||
const messages = data.messages.map((msg: any) => {
|
const messages = data.messages.map((msg: any) => {
|
||||||
return {
|
return {
|
||||||
...msg,
|
...msg,
|
||||||
...JSON.parse(msg.metadata),
|
// ...JSON.parse(msg.metadata),
|
||||||
};
|
};
|
||||||
}) as Message[];
|
}) as Message[];
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,23 @@ const MessageBox = ({
|
||||||
<h2 className="text-black dark:text-white font-medium text-3xl lg:w-9/12">
|
<h2 className="text-black dark:text-white font-medium text-3xl lg:w-9/12">
|
||||||
{message.content}
|
{message.content}
|
||||||
</h2>
|
</h2>
|
||||||
|
<div
|
||||||
|
ref={dividerRef}
|
||||||
|
className="flex flex-col space-y-6 w-full lg:w-9/12"
|
||||||
|
>
|
||||||
|
|
||||||
|
{message.sources && message.sources.length > 0 && (
|
||||||
|
<div className="flex flex-col space-y-2">
|
||||||
|
<div className="flex flex-row items-center space-x-2">
|
||||||
|
<BookCopy className="text-black dark:text-white" size={20}/>
|
||||||
|
<h3 className="text-black dark:text-white font-medium text-xl">
|
||||||
|
Sources
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<MessageSources sources={message.sources}/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -114,7 +131,8 @@ const MessageBox = ({
|
||||||
{parsedMessage}
|
{parsedMessage}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
{loading && isLast ? null : (
|
{loading && isLast ? null : (
|
||||||
<div className="flex flex-row items-center justify-between w-full text-black dark:text-white py-4 -mx-2">
|
<div
|
||||||
|
className="flex flex-row items-center justify-between w-full text-black dark:text-white py-4 -mx-2">
|
||||||
<div className="flex flex-row items-center space-x-1">
|
<div className="flex flex-row items-center space-x-1">
|
||||||
{/* <button className="p-2 text-black/70 dark:text-white/70 rounded-xl hover:bg-light-secondary dark:hover:bg-dark-secondary transition duration-200 hover:text-black text-black dark:hover:text-white">
|
{/* <button className="p-2 text-black/70 dark:text-white/70 rounded-xl hover:bg-light-secondary dark:hover:bg-dark-secondary transition duration-200 hover:text-black text-black dark:hover:text-white">
|
||||||
<Share size={18} />
|
<Share size={18} />
|
||||||
|
@ -183,7 +201,8 @@ const MessageBox = ({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="lg:sticky lg:top-20 flex flex-col items-center space-y-3 w-full lg:w-3/12 z-30 h-full pb-4">
|
<div
|
||||||
|
className="lg:sticky lg:top-20 flex flex-col items-center space-y-3 w-full lg:w-3/12 z-30 h-full pb-4">
|
||||||
<SearchImages
|
<SearchImages
|
||||||
query={history[messageIndex - 1].content}
|
query={history[messageIndex - 1].content}
|
||||||
chatHistory={history.slice(0, messageIndex - 1)}
|
chatHistory={history.slice(0, messageIndex - 1)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue