perf: split classic chat from lovart home
This commit is contained in:
parent
d62822bc03
commit
dedc62cb79
@ -1,8 +1,6 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
import { Chat } from "@/components/chat";
|
||||
import { DataStreamHandler } from "@/components/data-stream-handler";
|
||||
import { LovartHome } from "@/components/home/lovart-home";
|
||||
import { generateUUID } from "@/lib/utils";
|
||||
import { auth } from "../(auth)/auth";
|
||||
@ -146,19 +144,13 @@ async function NewChatPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const { ClassicChatStart } = await import("@/components/classic-chat-start");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Chat
|
||||
autoResume={false}
|
||||
id={id}
|
||||
initialChatModel={initialModelId || ""}
|
||||
initialMessages={[]}
|
||||
initialVisibilityType="private"
|
||||
isReadonly={false}
|
||||
key={id}
|
||||
userType={session?.user?.type}
|
||||
/>
|
||||
<DataStreamHandler />
|
||||
</>
|
||||
<ClassicChatStart
|
||||
id={id}
|
||||
initialModelId={initialModelId || ""}
|
||||
userType={session?.user?.type}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
31
components/classic-chat-start.tsx
Normal file
31
components/classic-chat-start.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import type { UserType } from "@/app/(auth)/auth";
|
||||
import { Chat } from "@/components/chat";
|
||||
import { DataStreamHandler } from "@/components/data-stream-handler";
|
||||
|
||||
type ClassicChatStartProps = {
|
||||
id: string;
|
||||
initialModelId: string;
|
||||
userType?: UserType;
|
||||
};
|
||||
|
||||
export function ClassicChatStart({
|
||||
id,
|
||||
initialModelId,
|
||||
userType,
|
||||
}: ClassicChatStartProps) {
|
||||
return (
|
||||
<>
|
||||
<Chat
|
||||
autoResume={false}
|
||||
id={id}
|
||||
initialChatModel={initialModelId}
|
||||
initialMessages={[]}
|
||||
initialVisibilityType="private"
|
||||
isReadonly={false}
|
||||
key={id}
|
||||
userType={userType}
|
||||
/>
|
||||
<DataStreamHandler />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user