diff --git a/packages/web/src/app/[domain]/chat/page.tsx b/packages/web/src/app/[domain]/chat/page.tsx index 5317328d9..43ef9d063 100644 --- a/packages/web/src/app/[domain]/chat/page.tsx +++ b/packages/web/src/app/[domain]/chat/page.tsx @@ -1,6 +1,6 @@ import { getRepos, getReposStats, getSearchContexts } from "@/actions"; import { SourcebotLogo } from "@/app/components/sourcebotLogo"; -import { getConfiguredLanguageModelsInfo } from "@/features/chat/actions"; +import { getConfiguredLanguageModelsInfo, getUserChatHistory } from "@/features/chat/actions"; import { CustomSlateEditor } from "@/features/chat/customSlateEditor"; import { ServiceErrorException } from "@/lib/serviceError"; import { isServiceError, measure } from "@/lib/utils"; @@ -12,6 +12,10 @@ import { DemoCards } from "./components/demoCards"; import { env } from "@sourcebot/shared"; import { loadJsonFile } from "@sourcebot/shared"; import { DemoExamples, demoExamplesSchema } from "@/types"; +import { auth } from "@/auth"; +import { ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable"; +import { ChatSidePanel } from "./components/chatSidePanel"; +import { AnimatedResizableHandle } from "@/components/ui/animatedResizableHandle"; interface PageProps { params: Promise<{ @@ -24,6 +28,8 @@ export default async function Page(props: PageProps) { const languageModels = await getConfiguredLanguageModelsInfo(); const searchContexts = await getSearchContexts(params.domain); const allRepos = await getRepos(); + const session = await auth(); + const chatHistory = session ? await getUserChatHistory() : []; const carouselRepos = await getRepos({ where: { @@ -52,6 +58,10 @@ export default async function Page(props: PageProps) { throw new ServiceErrorException(repoStats); } + if (isServiceError(chatHistory)) { + throw new ServiceErrorException(chatHistory); + } + const demoExamples = env.SOURCEBOT_DEMO_EXAMPLES_PATH ? await (async () => { try { return (await measure(() => loadJsonFile(env.SOURCEBOT_DEMO_EXAMPLES_PATH!, demoExamplesSchema), 'loadExamplesJsonFile')).data; @@ -62,45 +72,61 @@ export default async function Page(props: PageProps) { })() : undefined; return ( -
+
+ + + + +
+
+ +
+ + + -
-
- -
- - - - -
- -
- - {demoExamples && ( - <> -
- -
- - + - - )} +
-
+ {demoExamples && ( + <> +
+ +
+ + + + )} +
+ +
) } \ No newline at end of file