diff --git a/components/Conversations.tsx b/components/Conversations.tsx new file mode 100644 index 0000000..f4cb529 --- /dev/null +++ b/components/Conversations.tsx @@ -0,0 +1,39 @@ +import { Conversation } from "@/types"; +import { IconMessage, IconTrash } from "@tabler/icons-react"; +import { FC } from "react"; + +interface Props { + conversations: Conversation[]; + selectedConversation: Conversation; + onSelectConversation: (conversation: Conversation) => void; + onDeleteConversation: (conversation: Conversation) => void; +} + +export const Conversations: FC = ({ conversations, selectedConversation, onSelectConversation, onDeleteConversation }) => { + return ( +
+ {conversations.map((conversation, index) => ( +
onSelectConversation(conversation)} + > + +
{conversation.messages[0] ? conversation.messages[0].content : "Empty conversation"}
+ + { + e.stopPropagation(); + onDeleteConversation(conversation); + }} + /> +
+ ))} +
+ ); +}; diff --git a/components/ModelSelect.tsx b/components/ModelSelect.tsx index d092c45..a0199cd 100644 --- a/components/ModelSelect.tsx +++ b/components/ModelSelect.tsx @@ -11,7 +11,7 @@ export const ModelSelect: FC = ({ model, onSelect }) => {