Skip to content

An AI-powered search engine with a generative UI

feat: Add CI/CD, formatting, and documentation to v0.5 branch

Yoshiki Miuraa826b3516091
diff --git a/.eslintrc.json b/.eslintrc.json
index bffb357a..009005f3 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,3 +1,36 @@
{
- "extends": "next/core-web-vitals"
+ "extends": "next/core-web-vitals",
+ "plugins": ["simple-import-sort"],
+ "rules": {
+ "simple-import-sort/imports": [
+ "error",
+ {
+ "groups": [
+ // React and Next.js imports
+ ["^react", "^next"],
+ // Third party imports
+ ["^@?\\w"],
+ // Internal imports
+ ["^@/types"],
+ ["^@/config"],
+ ["^@/lib"],
+ ["^@/hooks"],
+ ["^@/components/ui"],
+ ["^@/components"],
+ ["^@/registry"],
+ ["^@/styles"],
+ ["^@/app"],
+ // Side effect imports
+ ["^\\u0000"],
+ // Parent imports
+ ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
+ // Other relative imports
+ ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
+ // Style imports
+ ["^.+\\.s?css$"]
+ ]
+ }
+ ],
+ "simple-import-sort/exports": "error"
+ }
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..71825578
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,38 @@
+name: CI
+
+on:
+ push:
+ branches: [main, v0.5]
+ pull_request:
+ branches: [main, v0.5]
+
+jobs:
+ lint-typecheck-format:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup Bun
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.2.12
+
+ - name: Install dependencies
+ run: bun install
+
+ - name: Run linting
+ run: bun lint
+
+ - name: Run type checking
+ run: bun typecheck
+
+ - name: Check formatting
+ run: bun format:check
+
+ - name: Build application
+ run: bun run build
+
+ - name: Run tests
+ run: bun test
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000..ad6d1447
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,40 @@
+# Dependencies
+node_modules/
+.next/
+out/
+build/
+dist/
+
+# Environment
+.env*
+
+# Generated files
+*.lock
+bun.lock
+package-lock.json
+yarn.lock
+pnpm-lock.yaml
+
+# IDE
+.vscode/
+.idea/
+
+# Misc
+*.log
+.DS_Store
+coverage/
+.cache/
+
+# Next.js
+.next/
+out/
+
+# Production
+build/
+
+# Temporary files
+tmp/
+temp/
+
+# Database
+lib/db/migrations/
\ No newline at end of file
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 00000000..e8fc830b
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,138 @@
+# CLAUDE.md
+
+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+
+## Key Commands
+
+### Development
+
+- `bun dev` - Start development server with Next.js Turbo mode (http://localhost:3000)
+- `bun run build` - Create production build
+- `bun start` - Start production server
+- `bun lint` - Run ESLint for code quality checks and import sorting
+- `bun typecheck` - Run TypeScript type checking
+- `bun format` - Format code with Prettier
+- `bun format:check` - Check code formatting without modifying files
+- `bun migrate` - Run database migrations
+- `bun test` - Run tests with Vitest
+- `bun test:watch` - Run tests in watch mode
+
+### Docker
+
+- `docker compose up -d` - Run the application with Docker
+- `docker pull ghcr.io/miurla/morphic:latest` - Pull prebuilt Docker image
+
+## Architecture Overview
+
+### Tech Stack
+
+- **Next.js 15.2.3** with App Router and React Server Components
+- **React 19.0.0** with TypeScript for type safety
+- **Vercel AI SDK 5.0.0-alpha.2** for AI streaming and GenerativeUI
+- **Supabase** for authentication and backend services
+- **PostgreSQL** with Drizzle ORM for database
+- **Redis** (Upstash or local) for chat history storage
+- **Tailwind CSS** with shadcn/ui components
+
+### Core Architecture
+
+1. **App Router Structure** (`/app`)
+ - `/api/` - Backend API routes for chat, search, and auth endpoints
+ - `/auth/` - Authentication pages (login, signup, password reset)
+ - `/search/` - Search functionality and results display
+ - `/share/` - Sharing functionality for search results
+
+2. **AI Integration** (`/lib`)
+ - `/lib/agents/` - AI agents for research and question generation
+ - `/lib/config/` - Model configuration management
+ - `/lib/streaming/` - Stream handling for AI responses
+ - `/lib/tools/` - Search and retrieval tool implementations
+ - Models configured in `public/config/models.json`
+
+3. **Database** (`/lib/db`)
+ - PostgreSQL database with Drizzle ORM
+ - Schema defined in `/lib/db/schema.ts`
+ - Migrations in `/lib/db/migrations/`
+ - Database actions in `/lib/actions/chat-db.ts`
+
+4. **Search System**
+ - Multiple providers: Tavily (default), SearXNG (self-hosted), Exa (neural)
+ - Video search support via Serper API
+ - URL-specific search capabilities
+ - Configurable search depth and result limits
+
+5. **Component Organization** (`/components`)
+ - `/artifact/` - Search result and AI response display components
+ - `/sidebar/` - Chat history and navigation
+ - `/ui/` - Reusable UI components from shadcn/ui
+ - Feature-specific components (auth forms, chat interfaces)
+
+6. **State Management**
+ - Server-side state via React Server Components
+ - Client-side hooks in `/hooks/`
+ - Redis for persistent chat history
+ - Supabase for user data
+
+## Environment Configuration
+
+### Required Variables
+
+```bash
+OPENAI_API_KEY= # Default AI provider
+TAVILY_API_KEY= # Default search provider
+DATABASE_URL= # PostgreSQL connection string
+```
+
+### Optional Features
+
+- Chat history: Set `ENABLE_SAVE_CHAT_HISTORY=true` and configure Redis
+- Alternative AI providers: Add corresponding API keys (ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, etc.)
+- Alternative search: Configure SEARCH_API and provider-specific settings
+- Sharing: Set `NEXT_PUBLIC_ENABLE_SHARE=true`
+
+## Key Development Patterns
+
+1. **AI Streaming**: Uses Vercel AI SDK's streaming capabilities for real-time responses
+2. **GenerativeUI**: Dynamic UI components generated based on AI responses
+3. **Type Safety**: Strict TypeScript configuration with comprehensive type definitions in `/lib/types/`
+4. **Schema Validation**: Zod schemas in `/lib/schema/` for data validation
+5. **Error Handling**: Comprehensive error boundaries and fallback UI components
+
+## Testing Approach
+
+- Unit and integration tests with Vitest
+- Test files located alongside source files with `.test.ts` or `.test.tsx` extension
+- Run `bun test` to execute all tests
+- Run `bun test:watch` for development
+
+## Pre-PR Requirements
+
+Before creating a pull request, you MUST ensure all of the following checks pass:
+
+1. **Linting**: Run `bun lint` and fix all ESLint errors and warnings (includes import sorting)
+2. **Type checking**: Run `bun typecheck` to ensure no TypeScript errors
+3. **Formatting**: Run `bun format:check` to verify code formatting (or `bun format` to auto-fix)
+4. **Build**: Run `bun run build` to ensure the application builds successfully
+5. **Tests**: Run `bun test` to ensure all tests pass
+
+These checks are enforced in CI/CD and PRs will fail if any of these steps don't pass.
+
+Note: Import sorting is handled by ESLint using `eslint-plugin-simple-import-sort`. Run `bun lint --fix` to automatically sort imports according to the configured order.
+
+## Model Configuration
+
+Models are defined in `public/config/models.json` with:
+
+- `id`: Model identifier
+- `provider`: Display name
+- `providerId`: Provider key for API routing
+- `enabled`: Toggle availability
+- `toolCallType`: "native" or "manual" for function calling
+- `toolCallModel`: Optional override for tool calls
+
+## Database Management
+
+- Run `bun migrate` to apply database migrations
+- Migrations are located in `/lib/db/migrations/`
+- Schema changes should be made in `/lib/db/schema.ts`
+- Use Drizzle Kit for generating migrations
diff --git a/app/auth/confirm/route.ts b/app/auth/confirm/route.ts
index 3161cf0a..d114e797 100644
--- a/app/auth/confirm/route.ts
+++ b/app/auth/confirm/route.ts
@@ -14,7 +14,7 @@ export async function GET(request: NextRequest) {
const { error } = await supabase.auth.verifyOtp({
type,
- token_hash,
+ token_hash
})
if (!error) {
// redirect user to specified redirect URL or root of app
diff --git a/app/auth/error/page.tsx b/app/auth/error/page.tsx
index b7937219..013cd249 100644
--- a/app/auth/error/page.tsx
+++ b/app/auth/error/page.tsx
@@ -1,6 +1,10 @@
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
-export default async function Page({ searchParams }: { searchParams: Promise<{ error: string }> }) {
+export default async function Page({
+ searchParams
+}: {
+ searchParams: Promise<{ error: string }>
+}) {
const params = await searchParams
return (
@@ -9,13 +13,19 @@ export default async function Page({ searchParams }: { searchParams: Promise<{ e
<div className="flex flex-col gap-6">
<Card>
<CardHeader>
- <CardTitle className="text-2xl">Sorry, something went wrong.</CardTitle>
+ <CardTitle className="text-2xl">
+ Sorry, something went wrong.
+ </CardTitle>
</CardHeader>
<CardContent>
{params?.error ? (
- <p className="text-sm text-muted-foreground">Code error: {params.error}</p>
+ <p className="text-sm text-muted-foreground">
+ Code error: {params.error}
+ </p>
) : (
- <p className="text-sm text-muted-foreground">An unspecified error occurred.</p>
+ <p className="text-sm text-muted-foreground">
+ An unspecified error occurred.
+ </p>
)}
</CardContent>
</Card>
diff --git a/app/auth/sign-up-success/page.tsx b/app/auth/sign-up-success/page.tsx
index f2672f6d..d139139b 100644
--- a/app/auth/sign-up-success/page.tsx
+++ b/app/auth/sign-up-success/page.tsx
@@ -3,7 +3,7 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle,
+ CardTitle
} from '@/components/ui/card'
export default function Page() {
@@ -13,13 +13,15 @@ export default function Page() {
<div className="flex flex-col gap-6">
<Card>
<CardHeader>
- <CardTitle className="text-2xl">Thank you for signing up!</CardTitle>
+ <CardTitle className="text-2xl">
+ Thank you for signing up!
+ </CardTitle>
<CardDescription>Check your email to confirm</CardDescription>
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground">
- You&apos;ve successfully signed up. Please check your email to confirm your account
- before signing in.
+ You&apos;ve successfully signed up. Please check your email to
+ confirm your account before signing in.
</p>
</CardContent>
</Card>
diff --git a/bun.lock b/bun.lock
index bbb0d699..0a860dee 100644
--- a/bun.lock
+++ b/bun.lock
@@ -81,7 +81,9 @@
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^8",
"eslint-config-next": "^14.2.25",
+ "eslint-plugin-simple-import-sort": "^12.1.1",
"postcss": "^8",
+ "prettier": "^3.6.2",
"tailwindcss": "^3.4.1",
"typescript": "^5",
"vitest": "^3.1.3",
@@ -901,6 +903,8 @@
"eslint-plugin-react-hooks": ["[email protected]", "", { "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" } }, "sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ=="],
+ "eslint-plugin-simple-import-sort": ["[email protected]", "", { "peerDependencies": { "eslint": ">=5.0.0" } }, "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA=="],
+
"eslint-scope": ["[email protected]", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg=="],
"eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
@@ -1431,6 +1435,8 @@
"prelude-ls": ["[email protected]", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
+ "prettier": ["[email protected]", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="],
+
"pretty-format": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" } }, "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ=="],
"prismjs": ["[email protected]", "", {}, "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw=="],
diff --git a/components.json b/components.json
index d9ef0ae5..13f24bf4 100644
--- a/components.json
+++ b/components.json
@@ -18,4 +18,4 @@
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
-}
\ No newline at end of file
+}
diff --git a/components/forgot-password-form.tsx b/components/forgot-password-form.tsx
index cd256b7b..e975cacb 100644
--- a/components/forgot-password-form.tsx
+++ b/components/forgot-password-form.tsx
@@ -8,14 +8,17 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle,
+ CardTitle
} from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import Link from 'next/link'
import { useState } from 'react'
-export function ForgotPasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {
+export function ForgotPasswordForm({
+ className,
+ ...props
+}: React.ComponentPropsWithoutRef<'div'>) {
const [email, setEmail] = useState('')
const [error, setError] = useState<string | null>(null)
const [success, setSuccess] = useState(false)
@@ -30,7 +33,7 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps
try {
// The url which will be included in the email. This URL needs to be configured in your redirect URLs in the Supabase dashboard at https://supabase.com/dashboard/project/_/auth/url-configuration
const { error } = await supabase.auth.resetPasswordForEmail(email, {
- redirectTo: `${window.location.origin}/auth/update-password`,
+ redirectTo: `${window.location.origin}/auth/update-password`
})
if (error) throw error
setSuccess(true)
@@ -51,8 +54,8 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground">
- If you registered using your email and password, you will receive a password reset
- email.
+ If you registered using your email and password, you will receive
+ a password reset email.
</p>
</CardContent>
</Card>
@@ -61,7 +64,8 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps
<CardHeader>
<CardTitle className="text-2xl">Reset Your Password</CardTitle>
<CardDescription>
- Type in your email and we&apos;ll send you a link to reset your password
+ Type in your email and we&apos;ll send you a link to reset your
+ password
</CardDescription>
</CardHeader>
<CardContent>
@@ -75,7 +79,7 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps
placeholder="[email protected]"
required
value={email}
- onChange={(e) => setEmail(e.target.value)}
+ onChange={e => setEmail(e.target.value)}
/>
</div>
{error && <p className="text-sm text-red-500">{error}</p>}
@@ -85,7 +89,10 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps
</div>
<div className="mt-4 text-center text-sm">
Already have an account?{' '}
- <Link href="/auth/login" className="underline underline-offset-4">
+ <Link
+ href="/auth/login"
+ className="underline underline-offset-4"
+ >
Login
</Link>
</div>
diff --git a/components/model-selector.tsx b/components/model-selector.tsx
index c756b3df..4404f48c 100644
--- a/components/model-selector.tsx
+++ b/components/model-selector.tsx
@@ -21,14 +21,17 @@ import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'
function groupModelsByProvider(models: Model[]) {
return models
.filter(model => model.enabled)
- .reduce((groups, model) => {
- const provider = model.provider
- if (!groups[provider]) {
- groups[provider] = []
- }
- groups[provider].push(model)
- return groups
- }, {} as Record<string, Model[]>)
+ .reduce(
+ (groups, model) => {
+ const provider = model.provider
+ if (!groups[provider]) {
+ groups[provider] = []
+ }
+ groups[provider].push(model)
+ return groups
+ },
+ {} as Record<string, Model[]>
+ )
}
interface ModelSelectorProps {
@@ -54,14 +57,16 @@ export function ModelSelector({ models }: ModelSelectorProps) {
const handleModelSelect = (id: string) => {
const newValue = id === value ? '' : id
setValue(newValue)
-
- const selectedModel = models.find(model => createModelId(model) === newValue)
+
+ const selectedModel = models.find(
+ model => createModelId(model) === newValue
+ )
if (selectedModel) {
setCookie('selectedModel', JSON.stringify(selectedModel))
} else {
setCookie('selectedModel', '')
}
-
+
setOpen(false)
}
diff --git a/components/search-results-image.tsx b/components/search-results-image.tsx
index b85ab79f..f032a2d4 100644
--- a/components/search-results-image.tsx
+++ b/components/search-results-image.tsx
@@ -105,7 +105,8 @@ export const SearchResultsImageSection: React.FC<
// Determine corner rounding based on index in full mode 2x3 layout
let cornerClasses = '' // Default to no rounding
if (isFullMode) {
- if (actualIndex === 0) cornerClasses = 'rounded-tl-lg' // Top-left
+ if (actualIndex === 0)
+ cornerClasses = 'rounded-tl-lg' // Top-left
else if (actualIndex === 1)
cornerClasses = 'rounded-tr-lg' // Top-right
else if (actualIndex === 2)
diff --git a/components/ui/alert-dialog.tsx b/components/ui/alert-dialog.tsx
index 25e7b474..ab74973d 100644
--- a/components/ui/alert-dialog.tsx
+++ b/components/ui/alert-dialog.tsx
@@ -1,10 +1,10 @@
-"use client"
+'use client'
-import * as React from "react"
-import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
+import * as React from 'react'
+import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
-import { cn } from "@/lib/utils"
-import { buttonVariants } from "@/components/ui/button"
+import { cn } from '@/lib/utils'
+import { buttonVariants } from '@/components/ui/button'
const AlertDialog = AlertDialogPrimitive.Root
@@ -18,7 +18,7 @@ const AlertDialogOverlay = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Overlay
className={cn(
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
+ 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
)}
{...props}
@@ -36,7 +36,7 @@ const AlertDialogContent = React.forwardRef<
<AlertDialogPrimitive.Content
ref={ref}
className={cn(
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
+ 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className
)}
{...props}
@@ -51,13 +51,13 @@ const AlertDialogHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col space-y-2 text-center sm:text-left",
+ 'flex flex-col space-y-2 text-center sm:text-left',
className
)}
{...props}
/>
)
-AlertDialogHeader.displayName = "AlertDialogHeader"
+AlertDialogHeader.displayName = 'AlertDialogHeader'
const AlertDialogFooter = ({
className,
@@ -65,13 +65,13 @@ const AlertDialogFooter = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
+ 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
className
)}
{...props}
/>
)
-AlertDialogFooter.displayName = "AlertDialogFooter"
+AlertDialogFooter.displayName = 'AlertDialogFooter'
const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
@@ -79,7 +79,7 @@ const AlertDialogTitle = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title
ref={ref}
- className={cn("text-lg font-semibold", className)}
+ className={cn('text-lg font-semibold', className)}
{...props}
/>
))
@@ -91,7 +91,7 @@ const AlertDialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description
ref={ref}
- className={cn("text-sm text-muted-foreground", className)}
+ className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
))
@@ -117,8 +117,8 @@ const AlertDialogCancel = React.forwardRef<
<AlertDialogPrimitive.Cancel
ref={ref}
className={cn(
- buttonVariants({ variant: "outline" }),
- "mt-2 sm:mt-0",
+ buttonVariants({ variant: 'outline' }),
+ 'mt-2 sm:mt-0',
className
)}
{...props}
@@ -137,5 +137,5 @@ export {
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
- AlertDialogCancel,
+ AlertDialogCancel
}
diff --git a/components/ui/collapsible.tsx b/components/ui/collapsible.tsx
index 9fa48946..1bbaed5a 100644
--- a/components/ui/collapsible.tsx
+++ b/components/ui/collapsible.tsx
@@ -1,6 +1,6 @@
-"use client"
+'use client'
-import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
+import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'
const Collapsible = CollapsiblePrimitive.Root
diff --git a/components/ui/command.tsx b/components/ui/command.tsx
index 59a26452..d1c24af4 100644
--- a/components/ui/command.tsx
+++ b/components/ui/command.tsx
@@ -1,12 +1,12 @@
-"use client"
+'use client'
-import * as React from "react"
-import { type DialogProps } from "@radix-ui/react-dialog"
-import { Command as CommandPrimitive } from "cmdk"
-import { Search } from "lucide-react"
+import * as React from 'react'
+import { type DialogProps } from '@radix-ui/react-dialog'
+import { Command as CommandPrimitive } from 'cmdk'
+import { Search } from 'lucide-react'
-import { cn } from "@/lib/utils"
-import { Dialog, DialogContent } from "@/components/ui/dialog"
+import { cn } from '@/lib/utils'
+import { Dialog, DialogContent } from '@/components/ui/dialog'
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
@@ -15,7 +15,7 @@ const Command = React.forwardRef<
<CommandPrimitive
ref={ref}
className={cn(
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
+ 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
className
)}
{...props}
@@ -44,7 +44,7 @@ const CommandInput = React.forwardRef<
<CommandPrimitive.Input
ref={ref}
className={cn(
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
+ 'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
className
)}
{...props}
@@ -60,7 +60,7 @@ const CommandList = React.forwardRef<
>(({ className, ...props }, ref) => (
<CommandPrimitive.List
ref={ref}
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
+ className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}
{...props}
/>
))
@@ -87,7 +87,7 @@ const CommandGroup = React.forwardRef<
<CommandPrimitive.Group
ref={ref}
className={cn(
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
+ 'overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',
className
)}
{...props}
@@ -102,7 +102,7 @@ const CommandSeparator = React.forwardRef<
>(({ className, ...props }, ref) => (
<CommandPrimitive.Separator
ref={ref}
- className={cn("-mx-1 h-px bg-border", className)}
+ className={cn('-mx-1 h-px bg-border', className)}
{...props}
/>
))
@@ -131,14 +131,14 @@ const CommandShortcut = ({
return (
<span
className={cn(
- "ml-auto text-xs tracking-widest text-muted-foreground",
+ 'ml-auto text-xs tracking-widest text-muted-foreground',
className
)}
{...props}
/>
)
}
-CommandShortcut.displayName = "CommandShortcut"
+CommandShortcut.displayName = 'CommandShortcut'
export {
Command,
@@ -149,5 +149,5 @@ export {
CommandGroup,
CommandItem,
CommandShortcut,
- CommandSeparator,
+ CommandSeparator
}
diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx
index 01ff19c7..5509e2dd 100644
--- a/components/ui/dialog.tsx
+++ b/components/ui/dialog.tsx
@@ -1,10 +1,10 @@
-"use client"
+'use client'
-import * as React from "react"
-import * as DialogPrimitive from "@radix-ui/react-dialog"
-import { X } from "lucide-react"
+import * as React from 'react'
+import * as DialogPrimitive from '@radix-ui/react-dialog'
+import { X } from 'lucide-react'
-import { cn } from "@/lib/utils"
+import { cn } from '@/lib/utils'
const Dialog = DialogPrimitive.Root
@@ -21,7 +21,7 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={cn(
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
+ 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
)}
{...props}
@@ -38,7 +38,7 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
+ 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className
)}
{...props}
@@ -59,13 +59,13 @@ const DialogHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col space-y-1.5 text-center sm:text-left",
+ 'flex flex-col space-y-1.5 text-center sm:text-left',
className
)}
{...props}
/>
)
-DialogHeader.displayName = "DialogHeader"
+DialogHeader.displayName = 'DialogHeader'
const DialogFooter = ({
className,
@@ -73,13 +73,13 @@ const DialogFooter = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
+ 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
className
)}
{...props}
/>
)
-DialogFooter.displayName = "DialogFooter"
+DialogFooter.displayName = 'DialogFooter'
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
@@ -88,7 +88,7 @@ const DialogTitle = React.forwardRef<
<DialogPrimitive.Title
ref={ref}
className={cn(
- "text-lg font-semibold leading-none tracking-tight",
+ 'text-lg font-semibold leading-none tracking-tight',
className
)}
{...props}
@@ -102,7 +102,7 @@ const DialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
- className={cn("text-sm text-muted-foreground", className)}
+ className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
))
@@ -118,5 +118,5 @@ export {
DialogHeader,
DialogFooter,
DialogTitle,
- DialogDescription,
+ DialogDescription
}
diff --git a/components/ui/drawer.tsx b/components/ui/drawer.tsx
index 45eb821e..16506c1b 100644
--- a/components/ui/drawer.tsx
+++ b/components/ui/drawer.tsx
@@ -1,9 +1,9 @@
-"use client"
+'use client'
-import * as React from "react"
-import { Drawer as DrawerPrimitive } from "vaul"
+import * as React from 'react'
+import { Drawer as DrawerPrimitive } from 'vaul'
-import { cn } from "@/lib/utils/index"
+import { cn } from '@/lib/utils/index'
const Drawer = ({
shouldScaleBackground = true,
@@ -14,7 +14,7 @@ const Drawer = ({
{...props}
/>
)
-Drawer.displayName = "Drawer"
+Drawer.displayName = 'Drawer'
const DrawerTrigger = DrawerPrimitive.Trigger
@@ -28,7 +28,7 @@ const DrawerOverlay = React.forwardRef<
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Overlay
ref={ref}
- className={cn("fixed inset-0 z-50 bg-black/80", className)}
+ className={cn('fixed inset-0 z-50 bg-black/80', className)}
{...props}
/>
))
@@ -43,7 +43,7 @@ const DrawerContent = React.forwardRef<
<DrawerPrimitive.Content
ref={ref}
className={cn(
- "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
+ 'fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background',
className
)}
{...props}
@@ -53,29 +53,29 @@ const DrawerContent = React.forwardRef<
</DrawerPrimitive.Content>
</DrawerPortal>
))
-DrawerContent.displayName = "DrawerContent"
+DrawerContent.displayName = 'DrawerContent'
const DrawerHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
- className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
+ className={cn('grid gap-1.5 p-4 text-center sm:text-left', className)}
{...props}
/>
)
-DrawerHeader.displayName = "DrawerHeader"
+DrawerHeader.displayName = 'DrawerHeader'
const DrawerFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
+ className={cn('mt-auto flex flex-col gap-2 p-4', className)}
{...props}
/>
)
-DrawerFooter.displayName = "DrawerFooter"
+DrawerFooter.displayName = 'DrawerFooter'
const DrawerTitle = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Title>,
@@ -84,7 +84,7 @@ const DrawerTitle = React.forwardRef<
<DrawerPrimitive.Title
ref={ref}
className={cn(
- "text-lg font-semibold leading-none tracking-tight",
+ 'text-lg font-semibold leading-none tracking-tight',
className
)}
{...props}
@@ -98,7 +98,7 @@ const DrawerDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Description
ref={ref}
- className={cn("text-sm text-muted-foreground", className)}
+ className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
))
@@ -114,5 +114,5 @@ export {
DrawerHeader,
DrawerFooter,
DrawerTitle,
- DrawerDescription,
+ DrawerDescription
}
diff --git a/components/ui/popover.tsx b/components/ui/popover.tsx
index a0ec48be..1903cfa7 100644
--- a/components/ui/popover.tsx
+++ b/components/ui/popover.tsx
@@ -1,9 +1,9 @@
-"use client"
+'use client'
-import * as React from "react"
-import * as PopoverPrimitive from "@radix-ui/react-popover"
+import * as React from 'react'
+import * as PopoverPrimitive from '@radix-ui/react-popover'
-import { cn } from "@/lib/utils"
+import { cn } from '@/lib/utils'
const Popover = PopoverPrimitive.Root
@@ -12,14 +12,14 @@ const PopoverTrigger = PopoverPrimitive.Trigger
const PopoverContent = React.forwardRef<
React.ElementRef<typeof PopoverPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
->(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
+>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Content
ref={ref}
align={align}
sideOffset={sideOffset}
className={cn(
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ 'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className
)}
{...props}
diff --git a/components/ui/sonner.tsx b/components/ui/sonner.tsx
index 452f4d9f..1053bd8d 100644
--- a/components/ui/sonner.tsx
+++ b/components/ui/sonner.tsx
@@ -1,27 +1,27 @@
-"use client"
+'use client'
-import { useTheme } from "next-themes"
-import { Toaster as Sonner } from "sonner"
+import { useTheme } from 'next-themes'
+import { Toaster as Sonner } from 'sonner'
type ToasterProps = React.ComponentProps<typeof Sonner>
const Toaster = ({ ...props }: ToasterProps) => {
- const { theme = "system" } = useTheme()
+ const { theme = 'system' } = useTheme()
return (
<Sonner
- theme={theme as ToasterProps["theme"]}
+ theme={theme as ToasterProps['theme']}
className="toaster group"
toastOptions={{
classNames: {
toast:
- "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
- description: "group-[.toast]:text-muted-foreground",
+ 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
+ description: 'group-[.toast]:text-muted-foreground',
actionButton:
- "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
+ 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
cancelButton:
- "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
- },
+ 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground'
+ }
}}
{...props}
/>
diff --git a/components/ui/tooltip-button.tsx b/components/ui/tooltip-button.tsx
index 934d8a3f..85862ba7 100644
--- a/components/ui/tooltip-button.tsx
+++ b/components/ui/tooltip-button.tsx
@@ -13,9 +13,14 @@ interface TooltipButtonProps extends ButtonProps {
* The tooltip content to display.
* Can be a string or TooltipContent props.
*/
- tooltipContent: string | Omit<React.ComponentPropsWithoutRef<typeof TooltipContent>, 'children'> & {
- children: React.ReactNode
- }
+ tooltipContent:
+ | string
+ | (Omit<
+ React.ComponentPropsWithoutRef<typeof TooltipContent>,
+ 'children'
+ > & {
+ children: React.ReactNode
+ })
/**
* The content of the button.
*/
diff --git a/components/ui/tooltip.tsx b/components/ui/tooltip.tsx
index c8cfaf1a..6e12f6b5 100644
--- a/components/ui/tooltip.tsx
+++ b/components/ui/tooltip.tsx
@@ -1,9 +1,9 @@
-"use client"
+'use client'
-import * as React from "react"
-import * as TooltipPrimitive from "@radix-ui/react-tooltip"
+import * as React from 'react'
+import * as TooltipPrimitive from '@radix-ui/react-tooltip'
-import { cn } from "@/lib/utils/index"
+import { cn } from '@/lib/utils/index'
const TooltipProvider = TooltipPrimitive.Provider
@@ -19,7 +19,7 @@ const TooltipContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ 'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className
)}
{...props}
diff --git a/drizzle/meta/0000_snapshot.json b/drizzle/meta/0000_snapshot.json
index f4e22da3..576ccb53 100644
--- a/drizzle/meta/0000_snapshot.json
+++ b/drizzle/meta/0000_snapshot.json
@@ -107,12 +107,8 @@
"name": "messages_chat_id_chats_id_fk",
"tableFrom": "messages",
"tableTo": "chats",
- "columnsFrom": [
- "chat_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -135,4 +131,4 @@
"schemas": {},
"tables": {}
}
-}
\ No newline at end of file
+}
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index 73eae23c..5c6a10c5 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -10,4 +10,4 @@
"breakpoints": true
}
]
-}
\ No newline at end of file
+}
diff --git a/drizzle/migrations/meta/0000_snapshot.json b/drizzle/migrations/meta/0000_snapshot.json
index f71489e8..93637771 100644
--- a/drizzle/migrations/meta/0000_snapshot.json
+++ b/drizzle/migrations/meta/0000_snapshot.json
@@ -107,12 +107,8 @@
"name": "messages_chat_id_chats_id_fk",
"tableFrom": "messages",
"tableTo": "chats",
- "columnsFrom": [
- "chat_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -135,4 +131,4 @@
"schemas": {},
"tables": {}
}
-}
\ No newline at end of file
+}
diff --git a/hooks/use-mobile.tsx b/hooks/use-mobile.tsx
index 2b0fe1df..4331d5c5 100644
--- a/hooks/use-mobile.tsx
+++ b/hooks/use-mobile.tsx
@@ -1,4 +1,4 @@
-import * as React from "react"
+import * as React from 'react'
const MOBILE_BREAKPOINT = 768
@@ -10,9 +10,9 @@ export function useIsMobile() {
const onChange = () => {
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
}
- mql.addEventListener("change", onChange)
+ mql.addEventListener('change', onChange)
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
- return () => mql.removeEventListener("change", onChange)
+ return () => mql.removeEventListener('change', onChange)
}, [])
return !!isMobile
diff --git a/lib/supabase/server.ts b/lib/supabase/server.ts
index 40633b0c..380f6897 100644
--- a/lib/supabase/server.ts
+++ b/lib/supabase/server.ts
@@ -22,8 +22,8 @@ export async function createClient() {
// This can be ignored if you have middleware refreshing
// user sessions.
}
- },
- },
+ }
+ }
}
)
}
diff --git a/lib/tools/search.ts b/lib/tools/search.ts
index a5e35082..77e4a3e6 100644
--- a/lib/tools/search.ts
+++ b/lib/tools/search.ts
@@ -2,7 +2,11 @@ import { getSearchSchemaForModel } from '@/lib/schema/search'
import { SearchResults } from '@/lib/types'
import { getBaseUrlString } from '@/lib/utils/url'
import { tool } from 'ai'
-import { DEFAULT_PROVIDER, SearchProviderType, createSearchProvider } from './search/providers'
+import {
+ DEFAULT_PROVIDER,
+ SearchProviderType,
+ createSearchProvider
+} from './search/providers'
/**
* Creates a search tool with the appropriate schema for the given model.
@@ -49,7 +53,7 @@ export function createSearchTool(fullModel: string) {
) {
// Get the base URL using the centralized utility function
const baseUrl = await getBaseUrlString()
-
+
const response = await fetch(`${baseUrl}/api/advanced-search`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
diff --git a/lib/tools/search/providers/base.ts b/lib/tools/search/providers/base.ts
index e94c7403..c709e7d1 100644
--- a/lib/tools/search/providers/base.ts
+++ b/lib/tools/search/providers/base.ts
@@ -19,15 +19,25 @@ export abstract class BaseSearchProvider implements SearchProvider {
excludeDomains: string[]
): Promise<SearchResults>
- protected validateApiKey(key: string | undefined, providerName: string): void {
+ protected validateApiKey(
+ key: string | undefined,
+ providerName: string
+ ): void {
if (!key) {
- throw new Error(`${providerName}_API_KEY is not set in the environment variables`)
+ throw new Error(
+ `${providerName}_API_KEY is not set in the environment variables`
+ )
}
}
- protected validateApiUrl(url: string | undefined, providerName: string): void {
+ protected validateApiUrl(
+ url: string | undefined,
+ providerName: string
+ ): void {
if (!url) {
- throw new Error(`${providerName}_API_URL is not set in the environment variables`)
+ throw new Error(
+ `${providerName}_API_URL is not set in the environment variables`
+ )
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/tools/search/providers/exa.ts b/lib/tools/search/providers/exa.ts
index d0303bdf..a2145d19 100644
--- a/lib/tools/search/providers/exa.ts
+++ b/lib/tools/search/providers/exa.ts
@@ -32,4 +32,4 @@ export class ExaSearchProvider extends BaseSearchProvider {
number_of_results: exaResults.results.length
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/tools/search/providers/index.ts b/lib/tools/search/providers/index.ts
index c9101fe6..ebaba485 100644
--- a/lib/tools/search/providers/index.ts
+++ b/lib/tools/search/providers/index.ts
@@ -6,9 +6,12 @@ import { TavilySearchProvider } from './tavily'
export type SearchProviderType = 'tavily' | 'exa' | 'searxng'
export const DEFAULT_PROVIDER: SearchProviderType = 'tavily'
-export function createSearchProvider(type?: SearchProviderType): SearchProvider {
- const providerType = type || (process.env.SEARCH_API as SearchProviderType) || DEFAULT_PROVIDER
-
+export function createSearchProvider(
+ type?: SearchProviderType
+): SearchProvider {
+ const providerType =
+ type || (process.env.SEARCH_API as SearchProviderType) || DEFAULT_PROVIDER
+
switch (providerType) {
case 'tavily':
return new TavilySearchProvider()
@@ -26,4 +29,3 @@ export type { ExaSearchProvider } from './exa'
export { SearXNGSearchProvider } from './searxng'
export { TavilySearchProvider } from './tavily'
export type { SearchProvider }
-
diff --git a/lib/tools/search/providers/searxng.ts b/lib/tools/search/providers/searxng.ts
index 68530d19..5314d292 100644
--- a/lib/tools/search/providers/searxng.ts
+++ b/lib/tools/search/providers/searxng.ts
@@ -1,4 +1,9 @@
-import { SearchResultItem, SearchResults, SearXNGResponse, SearXNGResult } from '@/lib/types'
+import {
+ SearchResultItem,
+ SearchResults,
+ SearXNGResponse,
+ SearXNGResult
+} from '@/lib/types'
import { BaseSearchProvider } from './base'
export class SearXNGSearchProvider extends BaseSearchProvider {
@@ -84,4 +89,4 @@ export class SearXNGSearchProvider extends BaseSearchProvider {
throw error
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/tools/search/providers/tavily.ts b/lib/tools/search/providers/tavily.ts
index 3344cdc4..967077ec 100644
--- a/lib/tools/search/providers/tavily.ts
+++ b/lib/tools/search/providers/tavily.ts
@@ -45,10 +45,12 @@ export class TavilySearchProvider extends BaseSearchProvider {
const data = await response.json()
const processedImages = includeImageDescriptions
? data.images
- .map(({ url, description }: { url: string; description: string }) => ({
- url: sanitizeUrl(url),
- description
- }))
+ .map(
+ ({ url, description }: { url: string; description: string }) => ({
+ url: sanitizeUrl(url),
+ description
+ })
+ )
.filter(
(
image: SearchResultImage
@@ -64,4 +66,4 @@ export class TavilySearchProvider extends BaseSearchProvider {
images: processedImages
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/utils/url.ts b/lib/utils/url.ts
index f0760c3f..f1bb111a 100644
--- a/lib/utils/url.ts
+++ b/lib/utils/url.ts
@@ -39,7 +39,7 @@ export async function getBaseUrlFromHeaders(): Promise<URL> {
export async function getBaseUrl(): Promise<URL> {
// Check for environment variables first
const baseUrlEnv = process.env.NEXT_PUBLIC_BASE_URL || process.env.BASE_URL
-
+
if (baseUrlEnv) {
try {
const baseUrlObj = new URL(baseUrlEnv)
@@ -52,7 +52,7 @@ export async function getBaseUrl(): Promise<URL> {
// Fall back to headers if the environment variable is invalid
}
}
-
+
// If no valid environment variable is available, use headers
return await getBaseUrlFromHeaders()
}
@@ -65,4 +65,4 @@ export async function getBaseUrl(): Promise<URL> {
export async function getBaseUrlString(): Promise<string> {
const baseUrlObj = await getBaseUrl()
return baseUrlObj.toString()
-}
\ No newline at end of file
+}
diff --git a/package.json b/package.json
index fa304a3d..e0756bdb 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,9 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
+ "typecheck": "tsc --noEmit",
+ "format": "prettier --write .",
+ "format:check": "prettier --check .",
"migrate": "bun run lib/db/migrate.ts",
"test": "vitest",
"test:watch": "vitest --watch"
@@ -90,7 +93,9 @@
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^8",
"eslint-config-next": "^14.2.25",
+ "eslint-plugin-simple-import-sort": "^12.1.1",
"postcss": "^8",
+ "prettier": "^3.6.2",
"tailwindcss": "^3.4.1",
"typescript": "^5",
"vitest": "^3.1.3"
diff --git a/postcss.config.mjs b/postcss.config.mjs
index 1a69fd2a..b1d7bf47 100644
--- a/postcss.config.mjs
+++ b/postcss.config.mjs
@@ -1,8 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
- tailwindcss: {},
- },
-};
+ tailwindcss: {}
+ }
+}
-export default config;
+export default config
diff --git a/prettier.config.js b/prettier.config.js
index 9b7f5b7e..e4684e14 100644
--- a/prettier.config.js
+++ b/prettier.config.js
@@ -6,29 +6,5 @@ module.exports = {
singleQuote: true,
arrowParens: 'avoid',
tabWidth: 2,
- trailingComma: 'none',
- importOrder: [
- '^(react/(.*)$)|^(react$)',
- '^(next/(.*)$)|^(next$)',
- '<THIRD_PARTY_MODULES>',
- '',
- '^types$',
- '^@/types/(.*)$',
- '^@/config/(.*)$',
- '^@/lib/(.*)$',
- '^@/hooks/(.*)$',
- '^@/components/ui/(.*)$',
- '^@/components/(.*)$',
- '^@/registry/(.*)$',
- '^@/styles/(.*)$',
- '^@/app/(.*)$',
- '',
- '^[./]',
- ],
- importOrderSeparation: false,
- importOrderSortSpecifiers: true,
- importOrderBuiltinModulesToTop: true,
- importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
- importOrderMergeDuplicateImports: true,
- importOrderCombineTypeAndValueImports: true,
-};
+ trailingComma: 'none'
+}
diff --git a/searxng-settings.yml b/searxng-settings.yml
index 685db6f3..d655ff82 100755
--- a/searxng-settings.yml
+++ b/searxng-settings.yml
@@ -32,4 +32,4 @@ server:
search:
formats:
- - json
\ No newline at end of file
+ - json
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 3d330ebb..e78e7f6d 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -11,149 +11,146 @@ const config = {
],
prefix: '',
theme: {
- container: {
- center: true,
- padding: '2rem',
- screens: {
- '2xl': '1400px'
- }
- },
- extend: {
- colors: {
- border: 'hsl(var(--border))',
- input: 'hsl(var(--input))',
- ring: 'hsl(var(--ring))',
- background: 'hsl(var(--background))',
- foreground: 'hsl(var(--foreground))',
- primary: {
- DEFAULT: 'hsl(var(--primary))',
- foreground: 'hsl(var(--primary-foreground))'
- },
- secondary: {
- DEFAULT: 'hsl(var(--secondary))',
- foreground: 'hsl(var(--secondary-foreground))'
- },
- destructive: {
- DEFAULT: 'hsl(var(--destructive))',
- foreground: 'hsl(var(--destructive-foreground))'
- },
- muted: {
- DEFAULT: 'hsl(var(--muted))',
- foreground: 'hsl(var(--muted-foreground))'
- },
- accent: {
- DEFAULT: 'hsl(var(--accent))',
- foreground: 'hsl(var(--accent-foreground))',
- blue: {
- DEFAULT: 'hsl(var(--accent-blue))',
- foreground: 'hsl(var(--accent-blue-foreground))',
- border: 'hsl(var(--accent-blue-border))'
- }
- },
- popover: {
- DEFAULT: 'hsl(var(--popover))',
- foreground: 'hsl(var(--popover-foreground))'
- },
- card: {
- DEFAULT: 'hsl(var(--card))',
- foreground: 'hsl(var(--card-foreground))'
- },
- chart: {
- '1': 'hsl(var(--chart-1))',
- '2': 'hsl(var(--chart-2))',
- '3': 'hsl(var(--chart-3))',
- '4': 'hsl(var(--chart-4))',
- '5': 'hsl(var(--chart-5))'
- },
- sidebar: {
- DEFAULT: 'hsl(var(--sidebar-background))',
- foreground: 'hsl(var(--sidebar-foreground))',
- primary: 'hsl(var(--sidebar-primary))',
- 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
- accent: 'hsl(var(--sidebar-accent))',
- 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
- border: 'hsl(var(--sidebar-border))',
- ring: 'hsl(var(--sidebar-ring))'
- }
- },
- borderRadius: {
- lg: 'var(--radius)',
- md: 'calc(var(--radius) - 2px)',
- sm: 'calc(var(--radius) - 4px)'
- },
- keyframes: {
- 'accordion-down': {
- from: {
- height: '0'
- },
- to: {
- height: 'var(--radix-accordion-content-height)'
- }
- },
- 'accordion-up': {
- from: {
- height: 'var(--radix-accordion-content-height)'
- },
- to: {
- height: '0'
- }
- },
- 'collapse-down': {
- from: {
- height: '0',
- opacity: '0'
- },
- to: {
- height: 'var(--radix-collapsible-content-height)',
- opacity: '1'
- }
- },
- 'collapse-up': {
- from: {
- height: 'var(--radix-collapsible-content-height)',
- opacity: '1'
- },
- to: {
- height: '0',
- opacity: '0'
- }
- },
- 'slide-in-right': {
- from: {
- transform: 'translateX(100%)',
- opacity: '0'
- },
- to: {
- transform: 'translateX(0)',
- opacity: '1'
- }
- },
- 'slide-out-right': {
- from: {
- transform: 'translateX(0)',
- opacity: '1'
- },
- to: {
- transform: 'translateX(100%)',
- opacity: '0'
- }
- }
- },
- animation: {
- 'accordion-down': 'accordion-down 0.2s ease-out',
- 'accordion-up': 'accordion-up 0.2s ease-out',
- 'collapse-down': 'collapse-down 0.1s ease-in-out',
- 'collapse-up': 'collapse-up 0.1s ease-in-out',
- 'slide-in-right': 'slide-in-right 0.2s ease-out',
- 'slide-out-right': 'slide-out-right 0.2s ease-out'
- },
- fontFamily: {
- sans: [
- 'var(--font-sans)',
- ...fontFamily.sans
- ]
- }
- }
+ container: {
+ center: true,
+ padding: '2rem',
+ screens: {
+ '2xl': '1400px'
+ }
+ },
+ extend: {
+ colors: {
+ border: 'hsl(var(--border))',
+ input: 'hsl(var(--input))',
+ ring: 'hsl(var(--ring))',
+ background: 'hsl(var(--background))',
+ foreground: 'hsl(var(--foreground))',
+ primary: {
+ DEFAULT: 'hsl(var(--primary))',
+ foreground: 'hsl(var(--primary-foreground))'
+ },
+ secondary: {
+ DEFAULT: 'hsl(var(--secondary))',
+ foreground: 'hsl(var(--secondary-foreground))'
+ },
+ destructive: {
+ DEFAULT: 'hsl(var(--destructive))',
+ foreground: 'hsl(var(--destructive-foreground))'
+ },
+ muted: {
+ DEFAULT: 'hsl(var(--muted))',
+ foreground: 'hsl(var(--muted-foreground))'
+ },
+ accent: {
+ DEFAULT: 'hsl(var(--accent))',
+ foreground: 'hsl(var(--accent-foreground))',
+ blue: {
+ DEFAULT: 'hsl(var(--accent-blue))',
+ foreground: 'hsl(var(--accent-blue-foreground))',
+ border: 'hsl(var(--accent-blue-border))'
+ }
+ },
+ popover: {
+ DEFAULT: 'hsl(var(--popover))',
+ foreground: 'hsl(var(--popover-foreground))'
+ },
+ card: {
+ DEFAULT: 'hsl(var(--card))',
+ foreground: 'hsl(var(--card-foreground))'
+ },
+ chart: {
+ '1': 'hsl(var(--chart-1))',
+ '2': 'hsl(var(--chart-2))',
+ '3': 'hsl(var(--chart-3))',
+ '4': 'hsl(var(--chart-4))',
+ '5': 'hsl(var(--chart-5))'
+ },
+ sidebar: {
+ DEFAULT: 'hsl(var(--sidebar-background))',
+ foreground: 'hsl(var(--sidebar-foreground))',
+ primary: 'hsl(var(--sidebar-primary))',
+ 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
+ accent: 'hsl(var(--sidebar-accent))',
+ 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
+ border: 'hsl(var(--sidebar-border))',
+ ring: 'hsl(var(--sidebar-ring))'
+ }
+ },
+ borderRadius: {
+ lg: 'var(--radius)',
+ md: 'calc(var(--radius) - 2px)',
+ sm: 'calc(var(--radius) - 4px)'
+ },
+ keyframes: {
+ 'accordion-down': {
+ from: {
+ height: '0'
+ },
+ to: {
+ height: 'var(--radix-accordion-content-height)'
+ }
+ },
+ 'accordion-up': {
+ from: {
+ height: 'var(--radix-accordion-content-height)'
+ },
+ to: {
+ height: '0'
+ }
+ },
+ 'collapse-down': {
+ from: {
+ height: '0',
+ opacity: '0'
+ },
+ to: {
+ height: 'var(--radix-collapsible-content-height)',
+ opacity: '1'
+ }
+ },
+ 'collapse-up': {
+ from: {
+ height: 'var(--radix-collapsible-content-height)',
+ opacity: '1'
+ },
+ to: {
+ height: '0',
+ opacity: '0'
+ }
+ },
+ 'slide-in-right': {
+ from: {
+ transform: 'translateX(100%)',
+ opacity: '0'
+ },
+ to: {
+ transform: 'translateX(0)',
+ opacity: '1'
+ }
+ },
+ 'slide-out-right': {
+ from: {
+ transform: 'translateX(0)',
+ opacity: '1'
+ },
+ to: {
+ transform: 'translateX(100%)',
+ opacity: '0'
+ }
+ }
+ },
+ animation: {
+ 'accordion-down': 'accordion-down 0.2s ease-out',
+ 'accordion-up': 'accordion-up 0.2s ease-out',
+ 'collapse-down': 'collapse-down 0.1s ease-in-out',
+ 'collapse-up': 'collapse-up 0.1s ease-in-out',
+ 'slide-in-right': 'slide-in-right 0.2s ease-out',
+ 'slide-out-right': 'slide-out-right 0.2s ease-out'
+ },
+ fontFamily: {
+ sans: ['var(--font-sans)', ...fontFamily.sans]
+ }
+ }
},
plugins: [require('tailwindcss-animate'), require('@tailwindcss/typography')]
} satisfies Config