├── app ├── favicon.ico ├── callback │ └── route.ts ├── login │ └── route.ts ├── ConvexClientProvider.tsx ├── page.tsx ├── layout.tsx ├── globals.css └── api │ └── analyze │ └── route.ts ├── postcss.config.mjs ├── public ├── vercel.svg ├── window.svg ├── file.svg ├── globe.svg └── next.svg ├── sampleData.jsonl ├── next.config.ts ├── lib └── utils.ts ├── convex ├── convex.config.ts ├── _generated │ ├── api.js │ ├── dataModel.d.ts │ ├── server.js │ ├── server.d.ts │ └── api.d.ts ├── tsconfig.json ├── README.md └── agent.ts ├── middleware.ts ├── components ├── ui │ ├── skeleton.tsx │ ├── separator.tsx │ ├── textarea.tsx │ ├── input.tsx │ ├── badge.tsx │ ├── tooltip.tsx │ ├── button.tsx │ ├── card.tsx │ ├── sheet.tsx │ └── sidebar.tsx ├── thinking-card.tsx ├── chat-input.tsx ├── header.tsx ├── threads.tsx ├── chat.tsx └── chat-messages.tsx ├── eslint.config.mjs ├── components.json ├── @types └── chat.ts ├── hooks └── use-mobile.ts ├── .gitignore ├── tsconfig.json ├── package.json ├── solution └── index.ts └── README.md /app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kulkarniankita/ai-agent-assistant-saas/HEAD/app/favicon.ico -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: ["@tailwindcss/postcss"], 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sampleData.jsonl: -------------------------------------------------------------------------------- 1 | {"text": "Buy groceries", "isCompleted": true} 2 | {"text": "Go for a swim", "isCompleted": true} 3 | {"text": "Integrate Convex", "isCompleted": false} -------------------------------------------------------------------------------- /next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | }; 6 | 7 | export default nextConfig; 8 | -------------------------------------------------------------------------------- /lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /convex/convex.config.ts: -------------------------------------------------------------------------------- 1 | // convex/convex.config.ts 2 | import { defineApp } from "convex/server"; 3 | import agent from "@convex-dev/agent/convex.config"; 4 | 5 | const app = defineApp(); 6 | app.use(agent); 7 | 8 | export default app; 9 | -------------------------------------------------------------------------------- /app/callback/route.ts: -------------------------------------------------------------------------------- 1 | import { handleAuth } from "@workos-inc/authkit-nextjs"; 2 | 3 | // Redirect the user to `/` after successful sign in 4 | // The redirect can be customized: `handleAuth({ returnPathname: '/foo' })` 5 | export const GET = handleAuth(); 6 | -------------------------------------------------------------------------------- /app/login/route.ts: -------------------------------------------------------------------------------- 1 | import { getSignInUrl } from "@workos-inc/authkit-nextjs"; 2 | import { redirect } from "next/navigation"; 3 | 4 | export const GET = async () => { 5 | const signInUrl = await getSignInUrl(); 6 | 7 | return redirect(signInUrl); 8 | }; 9 | -------------------------------------------------------------------------------- /middleware.ts: -------------------------------------------------------------------------------- 1 | import { authkitMiddleware } from "@workos-inc/authkit-nextjs"; 2 | 3 | export default authkitMiddleware(); 4 | 5 | // Match against pages that require authentication 6 | // Leave this out if you want authentication on every page in your application 7 | // export const config = { matcher: ['/'] }; 8 | -------------------------------------------------------------------------------- /components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ className, ...props }: React.ComponentProps<"div">) { 4 | return ( 5 |
10 | ) 11 | } 12 | 13 | export { Skeleton } 14 | -------------------------------------------------------------------------------- /public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/ConvexClientProvider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { ConvexProvider, ConvexReactClient } from "convex/react"; 4 | import { ReactNode } from "react"; 5 | 6 | const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!); 7 | 8 | export function ConvexClientProvider({ children }: { children: ReactNode }) { 9 | return {children}; 10 | } 11 | -------------------------------------------------------------------------------- /app/page.tsx: -------------------------------------------------------------------------------- 1 | import Chat from "@/components/chat"; 2 | import { withAuth } from "@workos-inc/authkit-nextjs"; 3 | 4 | export default async function Home() { 5 | // If the user isn't signed in, they will be automatically redirected to AuthKit 6 | const { user } = await withAuth(); 7 | 8 | return ( 9 |
10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | ]; 15 | 16 | export default eslintConfig; 17 | -------------------------------------------------------------------------------- /components/thinking-card.tsx: -------------------------------------------------------------------------------- 1 | import { Card, CardContent } from "./ui/card"; 2 | import { BrainIcon } from "lucide-react"; 3 | 4 | export default function ThinkingCard() { 5 | return ( 6 |
7 | 8 | 9 | 10 |

Thinking...

11 |
12 |
13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "", 8 | "css": "app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /@types/chat.ts: -------------------------------------------------------------------------------- 1 | export type ToolResult = 2 | | { 3 | type: "analyze"; 4 | formatted: string; 5 | tone: string; 6 | clarity: string; 7 | grammarIssues: string; 8 | rewrittenMessage: string; 9 | } 10 | | { type: "email"; recipient: string; subject: string; body: string } 11 | | { type: "social"; platform: "X" | "LinkedIn" | "BlueSky"; message: string }; 12 | 13 | export type Message = { 14 | role: "user" | "assistant"; 15 | content: string | { toolResults: ToolResult }; 16 | }; 17 | -------------------------------------------------------------------------------- /convex/_generated/api.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | /** 3 | * Generated `api` utility. 4 | * 5 | * THIS CODE IS AUTOMATICALLY GENERATED. 6 | * 7 | * To regenerate, run `npx convex dev`. 8 | * @module 9 | */ 10 | 11 | import { anyApi, componentsGeneric } from "convex/server"; 12 | 13 | /** 14 | * A utility for referencing Convex functions in your app's API. 15 | * 16 | * Usage: 17 | * ```js 18 | * const myFunctionReference = api.myModule.myFunction; 19 | * ``` 20 | */ 21 | export const api = anyApi; 22 | export const internal = anyApi; 23 | export const components = componentsGeneric(); 24 | -------------------------------------------------------------------------------- /hooks/use-mobile.ts: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as SeparatorPrimitive from "@radix-ui/react-separator" 5 | 6 | import { cn } from "@/lib/utils" 7 | 8 | function Separator({ 9 | className, 10 | orientation = "horizontal", 11 | decorative = true, 12 | ...props 13 | }: React.ComponentProps) { 14 | return ( 15 | 25 | ) 26 | } 27 | 28 | export { Separator } 29 | -------------------------------------------------------------------------------- /components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { 6 | return ( 7 |