diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 1eb6911..fef1de2 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -1,7 +1,6 @@ import { auth } from "@/auth"; import { chats, db } from "@/lib/db/schema"; import { openai } from "@/lib/openai"; -import { nanoid } from "@/lib/utils"; import { OpenAIStream, StreamingTextResponse } from "ai-connector"; export const runtime = "edge"; diff --git a/app/chat-list.tsx b/app/chat-list.tsx index eac0318..9e63425 100644 --- a/app/chat-list.tsx +++ b/app/chat-list.tsx @@ -5,6 +5,7 @@ import { type Message } from "ai-connector"; import { ChatMessage } from "./chat-message"; import { NextChatLogo } from "@/components/ui/nextchat-logo"; import { Plus } from "lucide-react"; +import { EmptyScreen } from "./empty"; export interface ChatList { messages: Message[]; @@ -15,7 +16,7 @@ export function ChatList({ messages }: ChatList) {
-
+
Next.js Chatbot
@@ -36,7 +37,9 @@ export function ChatList({ messages }: ChatList) { /> ))}
- ) : null} + ) : ( + + )}
); diff --git a/app/chat.tsx b/app/chat.tsx index 16d3870..0daaef0 100644 --- a/app/chat.tsx +++ b/app/chat.tsx @@ -1,9 +1,9 @@ "use client"; import { useRouter } from "next/navigation"; -import { ChatList } from "./chat-list"; import { Prompt } from "./prompt"; import { useChat, type Message } from "ai-connector"; +import { ChatList } from "./chat-list"; export interface ChatProps { // create?: (input: string) => Chat | undefined; diff --git a/app/empty.tsx b/app/empty.tsx new file mode 100644 index 0000000..1c58122 --- /dev/null +++ b/app/empty.tsx @@ -0,0 +1,56 @@ +import { cn } from "@/lib/utils"; +import { ExternalLink } from "./external-link"; +import { fontMessage } from "@/lib/fonts"; + +function ExampleBubble({ children }: { children?: React.ReactNode }) { + return ( +
+
+

{children}

+
+ ); +} + +export function EmptyScreen() { + return ( +
+
+
+
+

Welcome to Next.js Chatbot!

+

+ This is an open source AI chatbot app built with{" "} + Next.js and{" "} + + Vercel Postgres + + . You can start a conversation here or try the following examples: +

+
+
+
+ Explain technical concepts + Summarize article + Get assistance + Draft an email +
+
+
+ ); +} diff --git a/app/external-link.tsx b/app/external-link.tsx new file mode 100644 index 0000000..7025ee5 --- /dev/null +++ b/app/external-link.tsx @@ -0,0 +1,29 @@ +export function ExternalLink({ + href, + children, +}: { + href: string; + children: React.ReactNode; +}) { + return ( + + {children} + + + ); +} diff --git a/app/icon.png b/app/icon.png new file mode 100644 index 0000000..8b60a2b Binary files /dev/null and b/app/icon.png differ diff --git a/app/prompt.tsx b/app/prompt.tsx index 152f614..26ad418 100644 --- a/app/prompt.tsx +++ b/app/prompt.tsx @@ -32,7 +32,7 @@ export function Prompt({ await onSubmit(input); }} ref={formRef} - className="stretch flex w-full flex-row gap-3 md:max-w-2xl lg:max-w-xl xl:max-w-3xl mx-auto px-4 lg:pl-16" + className="stretch flex w-full flex-row gap-3 md:max-w-2xl lg:max-w-xl xl:max-w-3xl mx-auto px-4" >
diff --git a/app/sidebar.tsx b/app/sidebar.tsx index ebe0963..a2d55f1 100644 --- a/app/sidebar.tsx +++ b/app/sidebar.tsx @@ -9,6 +9,7 @@ import { Plus } from "lucide-react"; import { unstable_cache } from "next/cache"; import Link from "next/link"; import { SidebarItem } from "./sidebar-item"; +import { ExternalLink } from "./external-link"; export interface SidebarProps { session?: Session; @@ -22,7 +23,7 @@ export function Sidebar({ session, newChat }: SidebarProps) {
diff --git a/auth.ts b/auth.ts index a123564..85f3ab2 100644 --- a/auth.ts +++ b/auth.ts @@ -2,19 +2,10 @@ import NextAuth from "@auth/nextjs"; import GitHub from "@auth/nextjs/providers/github"; import { NextResponse } from "next/server"; -import { PgAdapter } from "./lib/db"; - export const { handlers: { GET, POST }, auth, - CSRF_experimental, } = NextAuth({ - // adapter: PgAdapter(db, { - // accounts, - // users, - // sessions, - // verificationTokens, - // }), // @ts-ignore providers: [GitHub], session: { strategy: "jwt" }, diff --git a/components/ui/nextchat-logo.tsx b/components/ui/nextchat-logo.tsx index 37266a5..2fcd355 100644 --- a/components/ui/nextchat-logo.tsx +++ b/components/ui/nextchat-logo.tsx @@ -1,6 +1,8 @@ import { useId } from "react"; -export function NextChatLogo(props: JSX.IntrinsicElements["svg"]) { +export function NextChatLogo( + props: JSX.IntrinsicElements["svg"] & { inverted?: boolean } +) { const id = useId(); return ( - - + + - - + + - + - + =2.26.0 || >=3' - next-auth: ^4 - dependencies: - '@prisma/client': 4.14.0(prisma@4.14.0) - next-auth: 4.22.1(next@13.4.5-canary.3)(react-dom@18.2.0)(react@18.2.0) - dev: false - /@next/env@13.4.5-canary.3: resolution: {integrity: sha512-2TrPvCIs8R9DpFpEDmGUOpWkVqbpb4+sGQMcZVP4zDYYg893p0nAbNbBxL996oBl+/vLTzcLIDceP5peHsGPzg==} dev: false @@ -727,28 +708,6 @@ packages: tslib: 2.5.0 dev: true - /@prisma/client@4.14.0(prisma@4.14.0): - resolution: {integrity: sha512-MK/XaA2sFdfaOa7I9MjNKz6dxeIEdeZlnpNRoF2w3JuRLlFJLkpp6cD3yaqw2nUUhbrn3Iqe3ZpVV+VuGGil7Q==} - engines: {node: '>=14.17'} - requiresBuild: true - peerDependencies: - prisma: '*' - peerDependenciesMeta: - prisma: - optional: true - dependencies: - '@prisma/engines-version': 4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c - prisma: 4.14.0 - dev: false - - /@prisma/engines-version@4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c: - resolution: {integrity: sha512-3jum8/YSudeSN0zGW5qkpz+wAN2V/NYCQ+BPjvHYDfWatLWlQkqy99toX0GysDeaUoBIJg1vaz2yKqiA3CFcQw==} - dev: false - - /@prisma/engines@4.14.0: - resolution: {integrity: sha512-PDNlhP/1vyTgmNyiucGqGCdXIp7HIkkvKO50si3y3PcceeHvqtiKPaH1iJdz63jCWMVMbj2MElSxXPOeBvEVIQ==} - requiresBuild: true - /@radix-ui/primitive@1.0.0: resolution: {integrity: sha512-3e7rn8FDMin4CgeL7Z/49smCA3rFYY3Ha2rUQ7HRWFadS5iCRw08ZgVT1LaNTCNqgvrUiyczLflrVrF0SRQtNA==} dependencies: @@ -4049,31 +4008,6 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true - /next-auth@4.22.1(next@13.4.5-canary.3)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-NTR3f6W7/AWXKw8GSsgSyQcDW6jkslZLH8AiZa5PQ09w1kR8uHtR9rez/E9gAq/o17+p0JYHE8QjF3RoniiObA==} - peerDependencies: - next: ^12.2.5 || ^13 - nodemailer: ^6.6.5 - react: ^17.0.2 || ^18 - react-dom: ^17.0.2 || ^18 - peerDependenciesMeta: - nodemailer: - optional: true - dependencies: - '@babel/runtime': 7.21.5 - '@panva/hkdf': 1.1.1 - cookie: 0.5.0 - jose: 4.14.4 - next: 13.4.5-canary.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) - oauth: 0.9.15 - openid-client: 5.4.2 - preact: 10.14.1 - preact-render-to-string: 5.2.6(preact@10.14.1) - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - uuid: 8.3.2 - dev: false - /next-themes@0.2.1(next@13.4.5-canary.3)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: @@ -4179,19 +4113,10 @@ packages: resolution: {integrity: sha512-JGkb5doGrwzVDuHwgrR4nHJayzN4h59VCed6EW8Tql6iHDfZIabCJvg6wtbn5q6pyB2hZruI3b77Nudvq7NmvA==} dev: false - /oauth@0.9.15: - resolution: {integrity: sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA==} - dev: false - /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} - /object-hash@2.2.0: - resolution: {integrity: sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==} - engines: {node: '>= 6'} - dev: false - /object-hash@3.0.0: resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} engines: {node: '>= 6'} @@ -4257,11 +4182,6 @@ packages: es-abstract: 1.21.2 dev: true - /oidc-token-hash@5.0.3: - resolution: {integrity: sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==} - engines: {node: ^10.13.0 || >=12.0.0} - dev: false - /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -4296,15 +4216,6 @@ packages: engines: {node: '>=12'} dev: false - /openid-client@5.4.2: - resolution: {integrity: sha512-lIhsdPvJ2RneBm3nGBBhQchpe3Uka//xf7WPHTIglery8gnckvW7Bd9IaQzekzXJvWthCMyi/xVEyGW0RFPytw==} - dependencies: - jose: 4.14.4 - lru-cache: 6.0.0 - object-hash: 2.2.0 - oidc-token-hash: 5.0.3 - dev: false - /optionator@0.9.1: resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} engines: {node: '>= 0.8.0'} @@ -4523,23 +4434,10 @@ packages: pretty-format: 3.8.0 dev: false - /preact-render-to-string@5.2.6(preact@10.14.1): - resolution: {integrity: sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==} - peerDependencies: - preact: '>=10' - dependencies: - preact: 10.14.1 - pretty-format: 3.8.0 - dev: false - /preact@10.11.3: resolution: {integrity: sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg==} dev: false - /preact@10.14.1: - resolution: {integrity: sha512-4XDSnUisk3YFBb3p9WeKeH1mKoxdFUsaXcvxs9wlpYR1wax/TWJVqhwmIWbByX0h7jMEJH6Zc5J6jqc58FKaNQ==} - dev: false - /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -4555,14 +4453,6 @@ packages: resolution: {integrity: sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==} dev: false - /prisma@4.14.0: - resolution: {integrity: sha512-+5dMl1uxMQb4RepndY6AwR9xi1cDcaGFICu+ws6/Nmgt93mFPNj8tYxSfTdmfg+rkNrUId9rk/Ac2vTgLe/oXA==} - engines: {node: '>=14.17'} - hasBin: true - requiresBuild: true - dependencies: - '@prisma/engines': 4.14.0 - /prismjs@1.27.0: resolution: {integrity: sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==} engines: {node: '>=6'} @@ -5448,11 +5338,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - /uuid@8.3.2: - resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} - hasBin: true - dev: false - /uuid@9.0.0: resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} hasBin: true diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index 718d6fe..0000000 Binary files a/public/favicon.ico and /dev/null differ