Skip to content

Commit 70ef50b

Browse files
committed
Add attachment function & basic theming
1 parent d4ed5b7 commit 70ef50b

29 files changed

+625
-139
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"@next-auth/prisma-adapter": "^1.0.7",
3333
"@prisma/adapter-neon": "^6.10.1",
3434
"@prisma/client": "^6.10.1",
35-
"@radix-ui/react-dialog": "^1.1.4",
35+
"@radix-ui/react-avatar": "^1.1.10",
36+
"@radix-ui/react-dialog": "^1.1.14",
3637
"@radix-ui/react-icons": "^1.3.0",
3738
"@radix-ui/react-separator": "^1.1.7",
3839
"@radix-ui/react-slot": "^1.2.3",
@@ -78,7 +79,8 @@
7879
"tailwindcss-animate": "^1.0.7",
7980
"tw-animate-css": "^1.3.5",
8081
"ws": "^8.18.2",
81-
"zod": "^3.25.67"
82+
"zod": "^3.25.67",
83+
"zustand": "^5.0.6"
8284
},
8385
"devDependencies": {
8486
"@fullhuman/postcss-purgecss": "^4.1.3",
File renamed without changes.

src/app/(vetsai)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const RootLayout = ({
2323
children: React.ReactNode;
2424
}>) => {
2525
return (
26-
<html lang="en">
26+
<html lang="en" className="dark">
2727
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
2828
{children}
2929
</body>

src/app/(vetsai)/vetsai/assistant.tsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,51 @@
22

33
import { AssistantRuntimeProvider } from "@assistant-ui/react";
44
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
5-
import { Thread } from "@/components/vetsai/assistant-ui/thread";
6-
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/vetsai/ui/sidebar";
7-
import { Separator } from "@/components/vetsai/ui/separator";
5+
import { Thread } from "@assets/components/assistant-ui/thread";
6+
import { AppSidebar } from "@assets/components/app-sidebar";
7+
import { Session } from "next-auth";
8+
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/assets/components/ui/sidebar";
9+
import { Separator } from "@assets/components/ui/separator";
810
import {
911
Breadcrumb,
1012
BreadcrumbItem,
11-
BreadcrumbLink,
13+
// BreadcrumbLink,
1214
BreadcrumbList,
13-
BreadcrumbPage,
14-
BreadcrumbSeparator,
15-
} from "@/components/vetsai/ui/breadcrumb";
16-
import { AppSidebar } from "@/components/vetsai/app-sidebar";
15+
// BreadcrumbPage,
16+
// BreadcrumbSeparator,
17+
} from "@/assets/components/ui/breadcrumb";
18+
import { PDFAttachmentAdapter } from "@/lib/ai/pdf-attachment-adapter";
1719

18-
export const Assistant = () => {
20+
interface AssistantProps {
21+
user: Session["user"];
22+
}
23+
24+
export const Assistant = ({ user }: AssistantProps) => {
1925
const runtime = useChatRuntime({
2026
api: "/api/chat",
27+
adapters: {
28+
attachments: new PDFAttachmentAdapter(),
29+
},
2130
});
2231

2332
return (
2433
<AssistantRuntimeProvider runtime={runtime}>
2534
<SidebarProvider>
26-
<AppSidebar />
35+
<AppSidebar user={user} />
2736
<SidebarInset>
28-
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
37+
<header className="bg-background sticky top-0 z-1 flex h-16 shrink-0 items-center gap-2 border-b px-4">
2938
<SidebarTrigger />
3039
<Separator orientation="vertical" className="mr-2 h-4" />
3140
<Breadcrumb>
3241
<BreadcrumbList>
3342
<BreadcrumbItem className="hidden md:block">
34-
<BreadcrumbLink href="#">
35-
Build Your Own ChatGPT UX
36-
</BreadcrumbLink>
43+
VetsAI
44+
{/* <BreadcrumbLink href="#">VetsAI</BreadcrumbLink> */}
3745
</BreadcrumbItem>
38-
<BreadcrumbSeparator className="hidden md:block" />
46+
{/* <BreadcrumbSeparator className="hidden md:block" />
3947
<BreadcrumbItem>
4048
<BreadcrumbPage>Starter Template</BreadcrumbPage>
41-
</BreadcrumbItem>
49+
</BreadcrumbItem> */}
4250
</BreadcrumbList>
4351
</Breadcrumb>
4452
</header>

src/app/(vetsai)/vetsai/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const VetsAI = async () => {
1010
redirect("/login");
1111
}
1212

13-
return <Assistant />;
13+
return <Assistant user={session.user} />;
1414
};
1515

1616
export default VetsAI;

src/app/api/chat/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ export async function POST(req: NextRequest) {
99
if (!session) {
1010
return NextResponse.json({ error: "You must be logged in to access this API route." });
1111
}
12-
console.log(session);
1312
const { messages }: { messages: CoreMessage[] } = await req.json();
13+
14+
messages.forEach((msg) => {
15+
console.log(msg.content);
16+
});
17+
1418
const response = gemini.chat(messages);
1519
return response.toDataStreamResponse();
1620
}

src/components/vetsai/app-sidebar.tsx renamed to src/assets/components/app-sidebar.tsx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
2-
import { Github, MessagesSquare } from "lucide-react";
32
import Link from "next/link";
3+
import { Session } from "next-auth";
44
import {
55
Sidebar,
66
SidebarContent,
@@ -13,19 +13,29 @@ import {
1313
} from "./ui/sidebar";
1414
import { ThreadList } from "./assistant-ui/thread-list";
1515

16-
export const AppSidebar = ({ ...props }: React.ComponentProps<typeof Sidebar>) => {
16+
interface AppSidebarProps {
17+
user: Session["user"];
18+
}
19+
20+
export const AppSidebar = ({
21+
user,
22+
...props
23+
}: AppSidebarProps & React.ComponentProps<typeof Sidebar>) => {
1724
return (
1825
<Sidebar {...props}>
1926
<SidebarHeader>
2027
<SidebarMenu>
2128
<SidebarMenuItem>
2229
<SidebarMenuButton size="lg" asChild>
23-
<Link href="https://assistant-ui.com" target="_blank">
30+
<Link href="https://vetswhocode.io" target="_blank">
2431
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
25-
<MessagesSquare className="size-4" />
32+
<img
33+
src="https://res.cloudinary.com/vetswhocode/image/upload/e_bgremoval/f_auto,q_auto/v1609084190/hashflag-white-vscode_n5k5db.jpg"
34+
alt="Vets Who Code Hashflag"
35+
/>
2636
</div>
2737
<div className="flex flex-col gap-0.5 leading-none">
28-
<span className="font-semibold">assistant-ui</span>
38+
<span className="font-semibold">VetsAI</span>
2939
</div>
3040
</Link>
3141
</SidebarMenuButton>
@@ -41,18 +51,16 @@ export const AppSidebar = ({ ...props }: React.ComponentProps<typeof Sidebar>) =
4151
<SidebarMenu>
4252
<SidebarMenuItem>
4353
<SidebarMenuButton size="lg" asChild>
44-
<Link
45-
href="https://github.com/assistant-ui/assistant-ui"
46-
target="_blank"
47-
>
48-
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
49-
<Github className="size-4" />
50-
</div>
51-
<div className="flex flex-col gap-0.5 leading-none">
52-
<span className="font-semibold">GitHub</span>
53-
<span className="">View Source</span>
54-
</div>
55-
</Link>
54+
<div className="flex">
55+
{user.image && (
56+
<img
57+
src={user.image}
58+
alt={user.name || user.id}
59+
className="aspect-square h-[36px] rounded-lg object-contain"
60+
/>
61+
)}
62+
{user.name || user.id}
63+
</div>
5664
</SidebarMenuButton>
5765
</SidebarMenuItem>
5866
</SidebarMenu>

0 commit comments

Comments
 (0)