Skip to content
Snippets Groups Projects
Commit 9ff8f622 authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

separate template types and components in file system

parent 8744a9a7
No related branches found
No related tags found
No related merge requests found
Showing
with 12 additions and 9 deletions
......@@ -2,7 +2,7 @@
import { nanoid } from "nanoid";
import { useState } from "react";
import { ChatInput, ChatMessages, Message } from "../../../../ui/html/chat";
import { ChatInput, ChatMessages, Message } from "../../../../../ui/html/chat";
export default function ChatSection() {
const [messages, setMessages] = useState<Message[]>([]);
......@@ -10,15 +10,18 @@ export default function ChatSection() {
const [input, setInput] = useState("");
const getAssistantMessage = async (messages: Message[]) => {
const response = await fetch(process.env.NEXT_PUBLIC_CHAT_API ?? "/api/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
const response = await fetch(
process.env.NEXT_PUBLIC_CHAT_API ?? "/api/chat",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
messages,
}),
},
body: JSON.stringify({
messages,
}),
});
);
const data = await response.json();
const assistantMessage = data.result as Message;
return assistantMessage;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment