feature: chatgpt

This commit is contained in:
JK-le-dev 2025-10-19 09:22:48 -05:00
commit eb48d61dcf
2 changed files with 57 additions and 4 deletions

View file

@ -11,6 +11,11 @@ export default function ChatLayout() {
},
]);
function addMessage(role, content) {
const msg = { role, content };
setMessages((s) => [...s, msg]);
}
function handleSend(text) {
const userMsg = { role: "user", content: text };
setMessages((s) => [...s, userMsg]);
@ -31,9 +36,13 @@ export default function ChatLayout() {
return (
<div className="flex flex-col flex-start w-full max-w-3xl gap-4 p-4">
<ChatHeader />
<ChatHeader />
<ChatWindow messages={messages} />
<MessageInput onSend={handleSend} onDeleteAll={handleDeleteAll}/>
<MessageInput
onSend={handleSend}
onMessage={addMessage}
onDeleteAll={handleDeleteAll}
/>
</div>
);
}