Skip to content

Commit bbabfe4

Browse files
feat(web): Show user chat history (#721)
* show user chat history * limit chat history display to 3 recent chats * removed old cards and added existing chat sidebar * allow scrolling * small ui fix * changelog * feedback --------- Co-authored-by: Brendan Kellam <bshizzle1234@gmail.com>
1 parent c0bf978 commit bbabfe4

File tree

3 files changed

+64
-35
lines changed

3 files changed

+64
-35
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Added ask sidebar to homepage. [#721](https://github.com/sourcebot-dev/sourcebot/pull/721)
12+
1013
## [4.10.17] - 2026-01-23
1114

1215
### Fixed
Lines changed: 60 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getRepos, getReposStats, getSearchContexts } from "@/actions";
22
import { SourcebotLogo } from "@/app/components/sourcebotLogo";
3-
import { getConfiguredLanguageModelsInfo } from "@/features/chat/actions";
3+
import { getConfiguredLanguageModelsInfo, getUserChatHistory } from "@/features/chat/actions";
44
import { CustomSlateEditor } from "@/features/chat/customSlateEditor";
55
import { ServiceErrorException } from "@/lib/serviceError";
66
import { isServiceError, measure } from "@/lib/utils";
@@ -12,6 +12,10 @@ import { DemoCards } from "./components/demoCards";
1212
import { env } from "@sourcebot/shared";
1313
import { loadJsonFile } from "@sourcebot/shared";
1414
import { DemoExamples, demoExamplesSchema } from "@/types";
15+
import { auth } from "@/auth";
16+
import { ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable";
17+
import { ChatSidePanel } from "./components/chatSidePanel";
18+
import { AnimatedResizableHandle } from "@/components/ui/animatedResizableHandle";
1519

1620
interface PageProps {
1721
params: Promise<{
@@ -24,6 +28,8 @@ export default async function Page(props: PageProps) {
2428
const languageModels = await getConfiguredLanguageModelsInfo();
2529
const searchContexts = await getSearchContexts(params.domain);
2630
const allRepos = await getRepos();
31+
const session = await auth();
32+
const chatHistory = session ? await getUserChatHistory() : [];
2733

2834
const carouselRepos = await getRepos({
2935
where: {
@@ -52,6 +58,10 @@ export default async function Page(props: PageProps) {
5258
throw new ServiceErrorException(repoStats);
5359
}
5460

61+
if (isServiceError(chatHistory)) {
62+
throw new ServiceErrorException(chatHistory);
63+
}
64+
5565
const demoExamples = env.SOURCEBOT_DEMO_EXAMPLES_PATH ? await (async () => {
5666
try {
5767
return (await measure(() => loadJsonFile<DemoExamples>(env.SOURCEBOT_DEMO_EXAMPLES_PATH!, demoExamplesSchema), 'loadExamplesJsonFile')).data;
@@ -62,45 +72,61 @@ export default async function Page(props: PageProps) {
6272
})() : undefined;
6373

6474
return (
65-
<div className="flex flex-col items-center overflow-hidden min-h-screen">
75+
<div className="flex flex-col items-center min-h-screen overflow-hidden">
6676
<NavigationMenu
6777
domain={params.domain}
6878
/>
79+
<ResizablePanelGroup
80+
direction="horizontal"
81+
className="flex-1"
82+
>
83+
<ChatSidePanel
84+
order={1}
85+
chatHistory={chatHistory}
86+
isAuthenticated={!!session}
87+
isCollapsedInitially={true}
88+
/>
89+
<AnimatedResizableHandle />
90+
<ResizablePanel
91+
order={2}
92+
id="chat-home-panel"
93+
defaultSize={85}
94+
>
95+
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-16 w-full px-5">
96+
<div className="max-h-44 w-auto">
97+
<SourcebotLogo
98+
className="h-18 md:h-40 w-auto"
99+
/>
100+
</div>
101+
<CustomSlateEditor>
102+
<LandingPageChatBox
103+
languageModels={languageModels}
104+
repos={allRepos}
105+
searchContexts={searchContexts}
106+
/>
107+
</CustomSlateEditor>
69108

70-
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
71-
<div className="max-h-44 w-auto">
72-
<SourcebotLogo
73-
className="h-18 md:h-40 w-auto"
74-
/>
75-
</div>
76-
<CustomSlateEditor>
77-
<LandingPageChatBox
78-
languageModels={languageModels}
79-
repos={allRepos}
80-
searchContexts={searchContexts}
81-
/>
82-
</CustomSlateEditor>
83-
84-
<div className="mt-8">
85-
<RepositoryCarousel
86-
numberOfReposWithIndex={repoStats.numberOfReposWithIndex}
87-
displayRepos={carouselRepos}
88-
/>
89-
</div>
90-
91-
{demoExamples && (
92-
<>
93-
<div className="flex flex-col items-center w-fit gap-6">
94-
<Separator className="mt-5 w-[700px]" />
95-
</div>
96-
97-
<DemoCards
98-
demoExamples={demoExamples}
109+
<div className="mt-8">
110+
<RepositoryCarousel
111+
numberOfReposWithIndex={repoStats.numberOfReposWithIndex}
112+
displayRepos={carouselRepos}
99113
/>
100-
</>
101-
)}
114+
</div>
102115

103-
</div>
116+
{demoExamples && (
117+
<>
118+
<div className="flex flex-col items-center w-fit gap-6">
119+
<Separator className="mt-5 w-[700px]" />
120+
</div>
121+
122+
<DemoCards
123+
demoExamples={demoExamples}
124+
/>
125+
</>
126+
)}
127+
</div>
128+
</ResizablePanel>
129+
</ResizablePanelGroup>
104130
</div>
105131
)
106132
}

packages/web/src/app/[domain]/search/components/searchLandingPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const SearchLandingPage = async ({
3737
domain={domain}
3838
/>
3939

40-
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
40+
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-16 w-full px-5">
4141
<div className="max-h-44 w-auto">
4242
<SourcebotLogo
4343
className="h-18 md:h-40 w-auto"

0 commit comments

Comments
 (0)