-
Notifications
You must be signed in to change notification settings - Fork 304
/
page.tsx
35 lines (28 loc) · 800 Bytes
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { getFullChatThread } from "@/app/actions/fetchers";
import { chatSearchParamsCache } from "@/lib/searchParams";
import ChatWindow from "../chatWindow";
async function Page({
params,
searchParams,
}: {
params: { chatid: string };
searchParams: Record<string, string | string[] | undefined>;
}) {
const { firstTime, q, spaces } = chatSearchParamsCache.parse(searchParams);
const chat = await getFullChatThread(params.chatid);
console.log(chat);
if (!chat.success || !chat.data) {
// TODO: handle this error
return <div>Chat not found</div>;
}
console.log(chat.data);
return (
<ChatWindow
q={q}
spaces={spaces}
initialChat={chat.data.length > 0 ? chat.data : undefined}
threadId={params.chatid}
/>
);
}
export default Page;