fix deletion bug
This commit is contained in:
parent
742efea50d
commit
c40f755cac
|
@ -6,7 +6,7 @@ It aims to mimic ChatGPT's interface and functionality.
|
||||||
|
|
||||||
All conversations are stored locally on your device.
|
All conversations are stored locally on your device.
|
||||||
|
|
||||||
See a [demo]()
|
See a [demo]().
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Conversations: FC<Props> = ({ loading, conversations, selectedConversation, onSelectConversation, onDeleteConversation }) => {
|
export const Conversations: FC<Props> = ({ loading, conversations, selectedConversation, onSelectConversation, onDeleteConversation }) => {
|
||||||
|
console.log(conversations);
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col space-y-2">
|
<div className="flex flex-col space-y-2">
|
||||||
{conversations.map((conversation, index) => (
|
{conversations.map((conversation, index) => (
|
||||||
|
|
|
@ -119,8 +119,10 @@ export default function Home() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNewConversation = () => {
|
const handleNewConversation = () => {
|
||||||
|
const lastConversation = conversations[conversations.length - 1];
|
||||||
|
|
||||||
const newConversation: Conversation = {
|
const newConversation: Conversation = {
|
||||||
id: conversations.length + 1,
|
id: lastConversation ? lastConversation.id + 1 : 1,
|
||||||
name: "",
|
name: "",
|
||||||
messages: []
|
messages: []
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue