perf: split classic chat from lovart home
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-04-30 00:22:17 +08:00
parent d62822bc03
commit dedc62cb79
2 changed files with 38 additions and 15 deletions

View File

@ -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}
/>
);
}

View 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 />
</>
);
}