2026-08-22 02:18:27 +03:00
|
|
|
import { notFound } from "next/navigation";
|
|
|
|
|
import { Chat } from "@/components/chat";
|
2026-08-31 19:51:17 +03:00
|
|
|
import type { TeacherUIMessage } from "@/src/core";
|
|
|
|
|
import { getChat } from "@/src/server";
|
2026-08-22 02:18:27 +03:00
|
|
|
|
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
|
|
|
|
|
|
export default async function ChatPage({
|
|
|
|
|
params,
|
|
|
|
|
searchParams,
|
|
|
|
|
}: {
|
|
|
|
|
params: Promise<{ id: string }>;
|
|
|
|
|
searchParams: Promise<{ prompt?: string }>;
|
|
|
|
|
}) {
|
|
|
|
|
const [{ id }, { prompt }] = await Promise.all([params, searchParams]);
|
|
|
|
|
const chat = getChat(id);
|
|
|
|
|
if (!chat) notFound();
|
|
|
|
|
return (
|
|
|
|
|
<Chat
|
2026-08-22 06:45:32 +03:00
|
|
|
key={chat.id}
|
2026-08-22 02:18:27 +03:00
|
|
|
chatId={chat.id}
|
|
|
|
|
title={chat.title}
|
|
|
|
|
initialMessages={chat.messages as TeacherUIMessage[]}
|
|
|
|
|
initialPrompt={prompt}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|