This commit is contained in:
Dhravya 2024-06-22 18:23:05 -05:00
parent 5140a4d769
commit 445acf7c47
4 changed files with 11 additions and 20 deletions

View file

@ -11,16 +11,19 @@ async function Page({
}) {
const { firstTime, q, spaces } = chatSearchParamsCache.parse(searchParams);
const chat = await getFullChatThread(params.chatid);
let chat: Awaited<ReturnType<typeof getFullChatThread>>;
console.log(chat);
if (!chat.success || !chat.data) {
// TODO: handle this error
return <div>Chat not found</div>;
try {
chat = await getFullChatThread(params.chatid);
} catch (e) {
const error = e as Error;
return <div>This page errored out: {error.message}</div>;
}
console.log(chat.data);
if (!chat.success || !chat.data) {
console.error(chat.error);
return <div>Chat not found. Check the console for more details.</div>;
}
return (
<ChatWindow

View file

@ -91,7 +91,6 @@ function ChatWindow({
const sourcesParsed = sourcesZod.safeParse(sources);
if (!sourcesParsed.success) {
console.log(sources);
console.error(sourcesParsed.error);
toast.error("Something went wrong while getting the sources");
return;
@ -154,9 +153,7 @@ function ChatWindow({
while (!done && reader) {
const { value, done: d } = await reader.read();
if (d) {
console.log(chatHistory);
setChatHistory((prevChatHistory) => {
console.log(prevChatHistory);
createChatObject(threadId, prevChatHistory);
return prevChatHistory;
});

View file

@ -71,16 +71,13 @@ function DynamicIslandContent() {
}
const lastBtn = useRef<string>();
useEffect(() => {
console.log(show);
}, [show]);
useEffect(() => {
document.addEventListener("keydown", (e) => {
if (e.key === "Escape") {
setshow(true);
}
console.log(e.key, lastBtn.current);
if (e.key === "a" && lastBtn.current === "Alt") {
setshow(false);
}
@ -268,7 +265,6 @@ function PageForm({
spaces: space ? [space] : undefined,
});
console.log(cont);
setLoading(false);
if (cont.success) {
toast.success("Memory created");

View file

@ -45,8 +45,6 @@ export async function POST(req: NextRequest) {
);
}
console.log("validated.data.chatHistory", validated.data.chatHistory);
const modelCompatible = await convertChatHistoryList(
validated.data.chatHistory,
);
@ -65,11 +63,8 @@ export async function POST(req: NextRequest) {
},
);
console.log("sourcesOnly", sourcesOnly);
if (sourcesOnly == "true") {
const data = await resp.json();
console.log("data", data);
return new Response(JSON.stringify(data), { status: 200 });
}