feat: support guest session (#919)
This commit is contained in:
parent
24cb2ce19b
commit
9279135355
34 changed files with 741 additions and 288 deletions
|
|
@ -4,8 +4,16 @@ import { Chat } from '@/components/chat';
|
|||
import { DEFAULT_CHAT_MODEL } from '@/lib/ai/models';
|
||||
import { generateUUID } from '@/lib/utils';
|
||||
import { DataStreamHandler } from '@/components/data-stream-handler';
|
||||
import { auth } from '../(auth)/auth';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default async function Page() {
|
||||
const session = await auth();
|
||||
|
||||
if (!session) {
|
||||
redirect('/api/auth/guest');
|
||||
}
|
||||
|
||||
const id = generateUUID();
|
||||
|
||||
const cookieStore = await cookies();
|
||||
|
|
@ -21,6 +29,7 @@ export default async function Page() {
|
|||
selectedChatModel={DEFAULT_CHAT_MODEL}
|
||||
selectedVisibilityType="private"
|
||||
isReadonly={false}
|
||||
session={session}
|
||||
/>
|
||||
<DataStreamHandler id={id} />
|
||||
</>
|
||||
|
|
@ -36,6 +45,7 @@ export default async function Page() {
|
|||
selectedChatModel={modelIdFromCookie.value}
|
||||
selectedVisibilityType="private"
|
||||
isReadonly={false}
|
||||
session={session}
|
||||
/>
|
||||
<DataStreamHandler id={id} />
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue