LibreChat/client/src/components/Conversations/index.jsx

50 lines
1.5 KiB
React
Raw Normal View History

import React from 'react';
2023-02-06 13:27:28 -05:00
import Conversation from './Conversation';
2023-03-05 14:41:50 -05:00
export default function Conversations({ conversations, conversationId, showMore }) {
const clickHandler = async (e) => {
e.preventDefault();
await showMore();
};
2023-02-06 13:27:28 -05:00
return (
<>
{conversations &&
conversations.length > 0 &&
conversations.map((convo) => {
2023-02-20 21:16:40 -05:00
const bingData = convo.conversationSignature
? {
2023-03-08 19:47:23 -05:00
jailbreakConversationId: convo.jailbreakConversationId,
2023-02-20 21:16:40 -05:00
conversationSignature: convo.conversationSignature,
parentMessageId: convo.parentMessageId || null,
2023-02-20 21:16:40 -05:00
clientId: convo.clientId,
invocationId: convo.invocationId
}
: null;
return (
<Conversation
key={convo.conversationId}
id={convo.conversationId}
parentMessageId={convo.parentMessageId}
title={convo.title}
conversationId={conversationId}
chatGptLabel={convo.chatGptLabel}
promptPrefix={convo.promptPrefix}
2023-02-20 21:16:40 -05:00
bingData={bingData}
retainView={showMore.bind(null, false)}
2023-02-20 21:16:40 -05:00
/>
);
})}
{conversations?.length >= 12 && (
2023-03-05 14:41:50 -05:00
<button
onClick={clickHandler}
className="btn btn-dark btn-small m-auto mb-2 flex justify-center gap-2"
>
Show more
</button>
)}
</>
2023-02-06 13:27:28 -05:00
);
}