Spaces:
Running
Running
File size: 860 Bytes
4af6326 db06845 009c95b 04735a9 ade4562 009c95b 04735a9 009c95b 04735a9 db06845 009c95b 04735a9 ade4562 04735a9 009c95b |
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 |
import ChatInterface from '../../../components/ChatInterface';
import { auth, sessionUser } from '@/auth';
import { dbGetChat } from '@/lib/db/functions';
import { redirect } from 'next/navigation';
import { revalidatePath } from 'next/cache';
import TopPrompt from '@/components/chat/TopPrompt';
import { Provider } from 'jotai';
interface ChatServerProps {
chatId: string;
}
export default async function ChatServer({ chatId }: ChatServerProps) {
const chat = await dbGetChat(chatId);
const { id: userId } = await sessionUser();
if (!chat) {
revalidatePath('/');
redirect('/');
}
return (
<Provider>
<div className="w-[1600px] max-w-full mx-auto flex flex-col space-y-4 items-center">
<TopPrompt chat={chat} userId={userId} />
<ChatInterface chat={chat} userId={userId} />
</div>
</Provider>
);
}
|