Skip to content

An AI-powered search engine with a generative UI

fix: sort imports according to ESLint configuration

Yoshiki Miurac6be6a65760b
diff --git a/app/api/advanced-search/route.ts b/app/api/advanced-search/route.ts
index afa5b89e..18798722 100644
--- a/app/api/advanced-search/route.ts
+++ b/app/api/advanced-search/route.ts
@@ -1,16 +1,17 @@
import { NextResponse } from 'next/server'
+
+import { Redis } from '@upstash/redis'
import http from 'http'
+import { Agent } from 'http'
import https from 'https'
import { JSDOM, VirtualConsole } from 'jsdom'
+import { createClient } from 'redis'
+
import {
- SearXNGSearchResults,
+ SearchResultItem,
SearXNGResponse,
SearXNGResult,
- SearchResultItem
-} from '@/lib/types'
-import { Agent } from 'http'
-import { Redis } from '@upstash/redis'
-import { createClient } from 'redis'
+ SearXNGSearchResults} from '@/lib/types'
/**
* Maximum number of results to fetch from SearXNG.
diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts
index 05361305..15b13c27 100644
--- a/app/api/chat/route.ts
+++ b/app/api/chat/route.ts
@@ -1,8 +1,9 @@
+import { cookies } from 'next/headers'
+
import { getCurrentUserId } from '@/lib/auth/get-current-user'
import { createChatStreamResponse } from '@/lib/streaming/create-chat-stream-response'
import { Model } from '@/lib/types/models'
import { isProviderEnabled } from '@/lib/utils/registry'
-import { cookies } from 'next/headers'
export const maxDuration = 30
diff --git a/app/api/chats/route.ts b/app/api/chats/route.ts
index b3ff45d2..befdc9f0 100644
--- a/app/api/chats/route.ts
+++ b/app/api/chats/route.ts
@@ -1,7 +1,8 @@
+import { NextRequest, NextResponse } from 'next/server'
+
import { getChatsPage } from '@/lib/actions/chat-db'
import { getCurrentUserId } from '@/lib/auth/get-current-user'
import { Chat as DBChat } from '@/lib/db/schema'
-import { NextRequest, NextResponse } from 'next/server'
interface ChatPageResponse {
chats: DBChat[]
diff --git a/app/api/upload/route.ts b/app/api/upload/route.ts
index 2f7c82e4..2bbf5d49 100644
--- a/app/api/upload/route.ts
+++ b/app/api/upload/route.ts
@@ -1,6 +1,7 @@
+import { NextRequest, NextResponse } from 'next/server'
+
import { getCurrentUserId } from '@/lib/auth/get-current-user'
import { createClient } from '@/lib/supabase/server'
-import { NextRequest, NextResponse } from 'next/server'
const MAX_FILE_SIZE = 5 * 1024 * 1024 // 5MB
const ALLOWED_TYPES = ['image/jpeg', 'image/png', 'application/pdf']
diff --git a/app/auth/confirm/route.ts b/app/auth/confirm/route.ts
index d114e797..77f4f59c 100644
--- a/app/auth/confirm/route.ts
+++ b/app/auth/confirm/route.ts
@@ -1,8 +1,10 @@
-import { createClient } from '@/lib/supabase/server'
-import { type EmailOtpType } from '@supabase/supabase-js'
import { redirect } from 'next/navigation'
import { type NextRequest } from 'next/server'
+import { type EmailOtpType } from '@supabase/supabase-js'
+
+import { createClient } from '@/lib/supabase/server'
+
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url)
const token_hash = searchParams.get('token_hash')
diff --git a/app/auth/oauth/route.ts b/app/auth/oauth/route.ts
index f4401746..f46745eb 100644
--- a/app/auth/oauth/route.ts
+++ b/app/auth/oauth/route.ts
@@ -1,4 +1,5 @@
import { NextResponse } from 'next/server'
+
// The client you created from the Server-Side Auth instructions
import { createClient } from '@/lib/supabase/server'
diff --git a/app/layout.tsx b/app/layout.tsx
index d9820e9d..1a23b011 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,14 +1,19 @@
+import type { Metadata, Viewport } from 'next'
+import { Inter as FontSans } from 'next/font/google'
+
+import { Analytics } from '@vercel/analytics/next'
+
+import { createClient } from '@/lib/supabase/server'
+import { cn } from '@/lib/utils'
+
+import { SidebarProvider } from '@/components/ui/sidebar'
+import { Toaster } from '@/components/ui/sonner'
+
import AppSidebar from '@/components/app-sidebar'
import ArtifactRoot from '@/components/artifact/artifact-root'
import Header from '@/components/header'
import { ThemeProvider } from '@/components/theme-provider'
-import { SidebarProvider } from '@/components/ui/sidebar'
-import { Toaster } from '@/components/ui/sonner'
-import { createClient } from '@/lib/supabase/server'
-import { cn } from '@/lib/utils'
-import { Analytics } from '@vercel/analytics/next'
-import type { Metadata, Viewport } from 'next'
-import { Inter as FontSans } from 'next/font/google'
+
import './globals.css'
const fontSans = FontSans({
diff --git a/app/page.tsx b/app/page.tsx
index eba2e815..d58b1801 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,7 +1,8 @@
-import { Chat } from '@/components/chat'
import { getModels } from '@/lib/config/models'
import { generateUUID } from '@/lib/utils'
+import { Chat } from '@/components/chat'
+
export default async function Page() {
const id = generateUUID()
const models = await getModels()
diff --git a/app/search/[id]/page.tsx b/app/search/[id]/page.tsx
index 12052e08..bee02fdc 100644
--- a/app/search/[id]/page.tsx
+++ b/app/search/[id]/page.tsx
@@ -1,9 +1,12 @@
-import { Chat } from '@/components/chat'
+import { notFound, redirect } from 'next/navigation'
+
+import { UIMessage } from 'ai'
+
import { getChat } from '@/lib/actions/chat-db'
import { getCurrentUserId } from '@/lib/auth/get-current-user'
import { getModels } from '@/lib/config/models'
-import { UIMessage } from 'ai'
-import { notFound, redirect } from 'next/navigation'
+
+import { Chat } from '@/components/chat'
export const maxDuration = 60
diff --git a/app/search/page.tsx b/app/search/page.tsx
index bba3b14b..3c99e38c 100644
--- a/app/search/page.tsx
+++ b/app/search/page.tsx
@@ -1,7 +1,9 @@
-import { Chat } from '@/components/chat'
+import { redirect } from 'next/navigation'
+
import { getModels } from '@/lib/config/models'
import { generateUUID } from '@/lib/utils'
-import { redirect } from 'next/navigation'
+
+import { Chat } from '@/components/chat'
export const maxDuration = 60
diff --git a/components/answer-section.tsx b/components/answer-section.tsx
index be7e49e5..340be89a 100644
--- a/components/answer-section.tsx
+++ b/components/answer-section.tsx
@@ -2,6 +2,7 @@
import { UseChatHelpers } from '@ai-sdk/react'
import { ChatRequestOptions } from 'ai'
+
import { CollapsibleMessage } from './collapsible-message'
import { DefaultSkeleton } from './default-skeleton'
import { BotMessage } from './message'
diff --git a/components/app-sidebar.tsx b/components/app-sidebar.tsx
index bc667ca1..7b50f4eb 100644
--- a/components/app-sidebar.tsx
+++ b/components/app-sidebar.tsx
@@ -1,3 +1,10 @@
+import { Suspense } from 'react'
+import Link from 'next/link'
+
+import { Plus } from 'lucide-react'
+
+import { cn } from '@/lib/utils'
+
import {
Sidebar,
SidebarContent,
@@ -8,10 +15,7 @@ import {
SidebarRail,
SidebarTrigger
} from '@/components/ui/sidebar'
-import { cn } from '@/lib/utils'
-import { Plus } from 'lucide-react'
-import Link from 'next/link'
-import { Suspense } from 'react'
+
import { ChatHistorySection } from './sidebar/chat-history-section'
import { ChatHistorySkeleton } from './sidebar/chat-history-skeleton'
import { IconLogo } from './ui/icons'
diff --git a/components/artifact/artifact-content.tsx b/components/artifact/artifact-content.tsx
index ad912e20..4adb0738 100644
--- a/components/artifact/artifact-content.tsx
+++ b/components/artifact/artifact-content.tsx
@@ -1,6 +1,7 @@
'use client'
import { Part } from '@/components/artifact/artifact-context'
+
import { ReasoningContent } from './reasoning-content'
import { ToolInvocationContent } from './tool-invocation-content'
diff --git a/components/artifact/artifact-context.tsx b/components/artifact/artifact-context.tsx
index d24b1d9b..1d2b7ff2 100644
--- a/components/artifact/artifact-context.tsx
+++ b/components/artifact/artifact-context.tsx
@@ -1,6 +1,5 @@
'use client'
-import type { ToolInvocation } from 'ai'
import {
createContext,
ReactNode,
@@ -9,6 +8,9 @@ import {
useEffect,
useReducer
} from 'react'
+
+import type { ToolInvocation } from 'ai'
+
import { useSidebar } from '../ui/sidebar'
// Part types as seen in render-message.tsx
diff --git a/components/artifact/artifact-root.tsx b/components/artifact/artifact-root.tsx
index b79464c9..4d2ad77d 100644
--- a/components/artifact/artifact-root.tsx
+++ b/components/artifact/artifact-root.tsx
@@ -1,6 +1,7 @@
'use client'
import { ReactNode } from 'react'
+
import { ArtifactProvider } from './artifact-context'
import { ChatArtifactContainer } from './chat-artifact-container'
diff --git a/components/artifact/chat-artifact-container.tsx b/components/artifact/chat-artifact-container.tsx
index f5811648..5b8b19da 100644
--- a/components/artifact/chat-artifact-container.tsx
+++ b/components/artifact/chat-artifact-container.tsx
@@ -1,16 +1,20 @@
'use client'
-import { InspectorDrawer } from '@/components/inspector/inspector-drawer'
-import { InspectorPanel } from '@/components/inspector/inspector-panel'
+import React, { useEffect, useState } from 'react'
+
+import { useMediaQuery } from '@/lib/hooks/use-media-query'
+import { cn } from '@/lib/utils'
+
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup
} from '@/components/ui/resizable'
import { SidebarTrigger, useSidebar } from '@/components/ui/sidebar'
-import { useMediaQuery } from '@/lib/hooks/use-media-query'
-import { cn } from '@/lib/utils'
-import React, { useEffect, useState } from 'react'
+
+import { InspectorDrawer } from '@/components/inspector/inspector-drawer'
+import { InspectorPanel } from '@/components/inspector/inspector-panel'
+
import { useArtifact } from './artifact-context'
export function ChatArtifactContainer({
children
diff --git a/components/artifact/reasoning-content.tsx b/components/artifact/reasoning-content.tsx
index f2f4fe56..ecfed9d7 100644
--- a/components/artifact/reasoning-content.tsx
+++ b/components/artifact/reasoning-content.tsx
@@ -1,7 +1,9 @@
'use client'
-import { cn } from '@/lib/utils'
import remarkGfm from 'remark-gfm'
+
+import { cn } from '@/lib/utils'
+
import { MemoizedReactMarkdown } from '../ui/markdown'
export function ReasoningContent({ reasoning }: { reasoning: string }) {
diff --git a/components/artifact/retrieve-artifact-content.tsx b/components/artifact/retrieve-artifact-content.tsx
index 856efdc3..3fe2dfdb 100644
--- a/components/artifact/retrieve-artifact-content.tsx
+++ b/components/artifact/retrieve-artifact-content.tsx
@@ -1,12 +1,15 @@
'use client'
-import { SearchResults } from '@/components/search-results'
-import { Section, ToolArgsSection } from '@/components/section'
+import type { ToolInvocation } from 'ai'
+
import type {
SearchResultItem,
SearchResults as TypeSearchResults
} from '@/lib/types/index'
-import type { ToolInvocation } from 'ai'
+
+import { SearchResults } from '@/components/search-results'
+import { Section, ToolArgsSection } from '@/components/section'
+
import { MemoizedReactMarkdown } from '../ui/markdown'
const MAX_CONTENT_LENGTH = 1000
diff --git a/components/artifact/search-artifact-content.tsx b/components/artifact/search-artifact-content.tsx
index 39429096..d1ee1e70 100644
--- a/components/artifact/search-artifact-content.tsx
+++ b/components/artifact/search-artifact-content.tsx
@@ -1,10 +1,12 @@
'use client'
+import type { ToolInvocation } from 'ai'
+
+import type { SearchResults as TypeSearchResults } from '@/lib/types'
+
import { SearchResults } from '@/components/search-results'
import { SearchResultsImageSection } from '@/components/search-results-image'
import { Section, ToolArgsSection } from '@/components/section'
-import type { SearchResults as TypeSearchResults } from '@/lib/types'
-import type { ToolInvocation } from 'ai'
export function SearchArtifactContent({ tool }: { tool: ToolInvocation }) {
const searchResults: TypeSearchResults =
diff --git a/components/artifact/tool-invocation-content.tsx b/components/artifact/tool-invocation-content.tsx
index 25d1550c..f4f52b36 100644
--- a/components/artifact/tool-invocation-content.tsx
+++ b/components/artifact/tool-invocation-content.tsx
@@ -1,9 +1,10 @@
'use client'
+import type { ToolInvocation } from 'ai'
+
import { RetrieveArtifactContent } from '@/components/artifact/retrieve-artifact-content'
import { SearchArtifactContent } from '@/components/artifact/search-artifact-content'
import { VideoSearchArtifactContent } from '@/components/artifact/video-search-artifact-content'
-import type { ToolInvocation } from 'ai'
export function ToolInvocationContent({
toolInvocation
diff --git a/components/artifact/video-search-artifact-content.tsx b/components/artifact/video-search-artifact-content.tsx
index 7889597a..a82beab4 100644
--- a/components/artifact/video-search-artifact-content.tsx
+++ b/components/artifact/video-search-artifact-content.tsx
@@ -1,12 +1,14 @@
'use client'
-import { ToolArgsSection } from '@/components/section'
-import { VideoResultGrid } from '@/components/video-result-grid'
+import type { ToolInvocation } from 'ai'
+
import {
type SerperSearchResultItem,
type SerperSearchResults
} from '@/lib/types'
-import type { ToolInvocation } from 'ai'
+
+import { ToolArgsSection } from '@/components/section'
+import { VideoResultGrid } from '@/components/video-result-grid'
export function VideoSearchArtifactContent({ tool }: { tool: ToolInvocation }) {
const videoResults: SerperSearchResults | undefined =
diff --git a/components/chat-messages.tsx b/components/chat-messages.tsx
index df565067..3dac5cf5 100644
--- a/components/chat-messages.tsx
+++ b/components/chat-messages.tsx
@@ -1,9 +1,12 @@
'use client'
-import { cn } from '@/lib/utils'
+import { useState } from 'react'
+
import { UseChatHelpers } from '@ai-sdk/react'
import { UIMessage } from 'ai'
-import { useState } from 'react'
+
+import { cn } from '@/lib/utils'
+
import { DefaultSkeleton } from './default-skeleton'
import { RenderMessage } from './render-message'
diff --git a/components/chat-panel.tsx b/components/chat-panel.tsx
index 80f43766..a6f989bf 100644
--- a/components/chat-panel.tsx
+++ b/components/chat-panel.tsx
@@ -1,21 +1,24 @@
'use client'
-import { UploadedFile } from '@/lib/types'
-import { Model } from '@/lib/types/models'
-import { cn } from '@/lib/utils'
-import { UIMessage, UseChatHelpers } from '@ai-sdk/react'
-import { ArrowUp, ChevronDown, MessageCirclePlus, Square } from 'lucide-react'
-import { useRouter } from 'next/navigation'
import { useCallback, useEffect, useRef, useState } from 'react'
import Textarea from 'react-textarea-autosize'
+import { useRouter } from 'next/navigation'
+
+import { UIMessage, UseChatHelpers } from '@ai-sdk/react'
+import { ArrowUp, ChevronDown, MessageCirclePlus, Square } from 'lucide-react'
import { toast } from 'sonner'
+
+import { UploadedFile } from '@/lib/types'
+import { Model } from '@/lib/types/models'
+import { cn } from '@/lib/utils'
+
import { useArtifact } from './artifact/artifact-context'
+import { Button } from './ui/button'
+import { IconLogo } from './ui/icons'
import { EmptyScreen } from './empty-screen'
import { FileUploadButton } from './file-upload-button'
import { ModelSelector } from './model-selector'
import { SearchModeToggle } from './search-mode-toggle'
-import { Button } from './ui/button'
-import { IconLogo } from './ui/icons'
import { UploadedFileList } from './uploaded-file-list'
interface ChatPanelProps {
diff --git a/components/chat-share.tsx b/components/chat-share.tsx
index abd2241b..be170ce1 100644
--- a/components/chat-share.tsx
+++ b/components/chat-share.tsx
@@ -1,11 +1,14 @@
'use client'
+import { useState, useTransition } from 'react'
+
+import { Share } from 'lucide-react'
+import { toast } from 'sonner'
+
import { shareChat } from '@/lib/actions/chat-db'
import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard'
import { cn } from '@/lib/utils'
-import { Share } from 'lucide-react'
-import { useState, useTransition } from 'react'
-import { toast } from 'sonner'
+
import { Button } from './ui/button'
import {
Dialog,
diff --git a/components/chat.tsx b/components/chat.tsx
index 5e5cd70f..60157cea 100644
--- a/components/chat.tsx
+++ b/components/chat.tsx
@@ -1,15 +1,19 @@
'use client'
-import { useFileDropzone } from '@/hooks/use-file-dropzone'
+import { useEffect, useMemo, useRef, useState } from 'react'
+
+import { useChat } from '@ai-sdk/react'
+import { defaultChatStore,FileUIPart, UIMessage } from 'ai'
+import { toast } from 'sonner'
+import { z } from 'zod'
+
import { deleteTrailingMessages } from '@/lib/actions/chat-db'
import { UploadedFile } from '@/lib/types'
import { Model } from '@/lib/types/models'
import { cn, generateUUID } from '@/lib/utils'
-import { useChat } from '@ai-sdk/react'
-import { FileUIPart, UIMessage, defaultChatStore } from 'ai'
-import { useEffect, useMemo, useRef, useState } from 'react'
-import { toast } from 'sonner'
-import { z } from 'zod'
+
+import { useFileDropzone } from '@/hooks/use-file-dropzone'
+
import { ChatMessages } from './chat-messages'
import { ChatPanel } from './chat-panel'
import { DragOverlay } from './drag-overlay'
diff --git a/components/collapsible-message.tsx b/components/collapsible-message.tsx
index f2f71742..ced06c7b 100644
--- a/components/collapsible-message.tsx
+++ b/components/collapsible-message.tsx
@@ -1,6 +1,7 @@
-import { cn } from '@/lib/utils'
import { ChevronDown } from 'lucide-react'
-import { CurrentUserAvatar } from './current-user-avatar'
+
+import { cn } from '@/lib/utils'
+
import {
Collapsible,
CollapsibleContent,
@@ -8,6 +9,7 @@ import {
} from './ui/collapsible'
import { IconLogo } from './ui/icons'
import { Separator } from './ui/separator'
+import { CurrentUserAvatar } from './current-user-avatar'
interface CollapsibleMessageProps {
children: React.ReactNode
diff --git a/components/current-user-avatar.tsx b/components/current-user-avatar.tsx
index 95715b2e..08f3d878 100644
--- a/components/current-user-avatar.tsx
+++ b/components/current-user-avatar.tsx
@@ -1,9 +1,11 @@
'use client'
-import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
+import { User2 } from 'lucide-react'
+
import { useCurrentUserImage } from '@/hooks/use-current-user-image'
import { useCurrentUserName } from '@/hooks/use-current-user-name'
-import { User2 } from 'lucide-react'
+
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
export const CurrentUserAvatar = () => {
const profileImage = useCurrentUserImage()
diff --git a/components/custom-link.tsx b/components/custom-link.tsx
index 51311036..16d971c3 100644
--- a/components/custom-link.tsx
+++ b/components/custom-link.tsx
@@ -1,6 +1,7 @@
-import { cn } from '@/lib/utils'
import { AnchorHTMLAttributes, DetailedHTMLProps, ReactNode } from 'react'
+import { cn } from '@/lib/utils'
+
type CustomLinkProps = Omit<
DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>,
'ref'
diff --git a/components/drag-overlay.tsx b/components/drag-overlay.tsx
index d4149913..54fc43fb 100644
--- a/components/drag-overlay.tsx
+++ b/components/drag-overlay.tsx
@@ -1,7 +1,8 @@
'use client'
-import { cn } from '@/lib/utils'
import { UploadCloud } from 'lucide-react'
+import { cn } from '@/lib/utils'
+
export function DragOverlay({ visible }: { visible: boolean }) {
return (
<div
diff --git a/components/empty-screen.tsx b/components/empty-screen.tsx
index 84911417..45704089 100644
--- a/components/empty-screen.tsx
+++ b/components/empty-screen.tsx
@@ -1,6 +1,7 @@
-import { Button } from '@/components/ui/button'
import { ArrowRight } from 'lucide-react'
+import { Button } from '@/components/ui/button'
+
const exampleMessages = [
{
heading: 'What is DeepSeek R1?',
diff --git a/components/external-link-items.tsx b/components/external-link-items.tsx
index 66481db5..f4e26838 100644
--- a/components/external-link-items.tsx
+++ b/components/external-link-items.tsx
@@ -1,8 +1,9 @@
'use client'
-import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
-import Link from 'next/link'
import { SiDiscord, SiGithub, SiX } from 'react-icons/si'
+import Link from 'next/link'
+
+import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
const externalLinks = [
{
diff --git a/components/file-upload-button.tsx b/components/file-upload-button.tsx
index 08af0369..13441990 100644
--- a/components/file-upload-button.tsx
+++ b/components/file-upload-button.tsx
@@ -1,9 +1,12 @@
'use client'
-import { cn } from '@/lib/utils'
-import { Paperclip } from 'lucide-react'
import { useRef, useState } from 'react'
+
+import { Paperclip } from 'lucide-react'
import { toast } from 'sonner'
+
+import { cn } from '@/lib/utils'
+
import { Button } from './ui/button'
const allowedImageTypes = ['image/png', 'image/jpeg', 'image/gif', 'image/webp']
diff --git a/components/forgot-password-form.tsx b/components/forgot-password-form.tsx
index e975cacb..ed62f825 100644
--- a/components/forgot-password-form.tsx
+++ b/components/forgot-password-form.tsx
@@ -1,7 +1,11 @@
'use client'
-import { cn } from '@/lib/utils/index'
+import { useState } from 'react'
+import Link from 'next/link'
+
import { createClient } from '@/lib/supabase/client'
+import { cn } from '@/lib/utils/index'
+
import { Button } from '@/components/ui/button'
import {
Card,
@@ -12,8 +16,6 @@ import {
} 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,
diff --git a/components/guest-menu.tsx b/components/guest-menu.tsx
index 714201ef..23787358 100644
--- a/components/guest-menu.tsx
+++ b/components/guest-menu.tsx
@@ -1,5 +1,14 @@
'use client'
+import Link from 'next/link'
+
+import {
+ Link2,
+ LogIn,
+ Palette,
+ Settings2 // Or EllipsisVertical, etc.
+} from 'lucide-react'
+
import { Button } from '@/components/ui/button'
import {
DropdownMenu,
@@ -11,13 +20,7 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
-import {
- Link2,
- LogIn,
- Palette,
- Settings2 // Or EllipsisVertical, etc.
-} from 'lucide-react'
-import Link from 'next/link'
+
import { ExternalLinkItems } from './external-link-items'
import { ThemeMenuItems } from './theme-menu-items'
diff --git a/components/header.tsx b/components/header.tsx
index b4beb6e7..f1c4cfd8 100644
--- a/components/header.tsx
+++ b/components/header.tsx
@@ -1,10 +1,14 @@
'use client'
-import { useSidebar } from '@/components/ui/sidebar'
-import { cn } from '@/lib/utils'
-import { User } from '@supabase/supabase-js'
// import Link from 'next/link' // No longer needed directly here for Sign In button
import React from 'react'
+
+import { User } from '@supabase/supabase-js'
+
+import { cn } from '@/lib/utils'
+
+import { useSidebar } from '@/components/ui/sidebar'
+
// import { Button } from './ui/button' // No longer needed directly here for Sign In button
import GuestMenu from './guest-menu' // Import the new GuestMenu component
import UserMenu from './user-menu'
diff --git a/components/inspector/inspector-drawer.tsx b/components/inspector/inspector-drawer.tsx
index 0834506f..5ae15099 100644
--- a/components/inspector/inspector-drawer.tsx
+++ b/components/inspector/inspector-drawer.tsx
@@ -1,9 +1,13 @@
'use client'
-import { useArtifact } from '@/components/artifact/artifact-context'
-import { Drawer, DrawerContent, DrawerTitle } from '@/components/ui/drawer'
-import { useMediaQuery } from '@/lib/hooks/use-media-query'
import { VisuallyHidden } from '@radix-ui/react-visually-hidden'
+
+import { useMediaQuery } from '@/lib/hooks/use-media-query'
+
+import { Drawer, DrawerContent, DrawerTitle } from '@/components/ui/drawer'
+
+import { useArtifact } from '@/components/artifact/artifact-context'
+
import { InspectorPanel } from './inspector-panel'
export function InspectorDrawer() {
diff --git a/components/inspector/inspector-panel.tsx b/components/inspector/inspector-panel.tsx
index 841d903e..9dd860d8 100644
--- a/components/inspector/inspector-panel.tsx
+++ b/components/inspector/inspector-panel.tsx
@@ -1,17 +1,19 @@
'use client'
-import { ArtifactContent } from '@/components/artifact/artifact-content'
-import { useArtifact } from '@/components/artifact/artifact-context'
+import { LightbulbIcon, MessageSquare, Minimize2, Wrench } from 'lucide-react'
+
import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator'
-import { TooltipButton } from '@/components/ui/tooltip-button'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger
} from '@/components/ui/tooltip'
-import { LightbulbIcon, MessageSquare, Minimize2, Wrench } from 'lucide-react'
+import { TooltipButton } from '@/components/ui/tooltip-button'
+
+import { ArtifactContent } from '@/components/artifact/artifact-content'
+import { useArtifact } from '@/components/artifact/artifact-context'
export function InspectorPanel() {
const { state, close } = useArtifact()
diff --git a/components/login-form.tsx b/components/login-form.tsx
index 089154ac..8c592cf5 100644
--- a/components/login-form.tsx
+++ b/components/login-form.tsx
@@ -1,5 +1,12 @@
'use client'
+import { useState } from 'react'
+import Link from 'next/link'
+import { useRouter } from 'next/navigation'
+
+import { createClient } from '@/lib/supabase/client'
+import { cn } from '@/lib/utils/index'
+
import { Button } from '@/components/ui/button'
import {
Card,
@@ -11,11 +18,6 @@ import {
import { IconLogo } from '@/components/ui/icons'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
-import { createClient } from '@/lib/supabase/client'
-import { cn } from '@/lib/utils/index'
-import Link from 'next/link'
-import { useRouter } from 'next/navigation'
-import { useState } from 'react'
export function LoginForm({
className,
diff --git a/components/message-actions.tsx b/components/message-actions.tsx
index e46c286d..9d463e4b 100644
--- a/components/message-actions.tsx
+++ b/components/message-actions.tsx
@@ -1,12 +1,14 @@
'use client'
-import { cn } from '@/lib/utils'
import { UseChatHelpers } from '@ai-sdk/react'
import { Copy } from 'lucide-react'
import { toast } from 'sonner'
+
+import { cn } from '@/lib/utils'
+
+import { Button } from './ui/button'
import { ChatShare } from './chat-share'
import { RetryButton } from './retry-button'
-import { Button } from './ui/button'
interface MessageActionsProps {
message: string
diff --git a/components/message.tsx b/components/message.tsx
index d52a4990..08165b03 100644
--- a/components/message.tsx
+++ b/components/message.tsx
@@ -1,14 +1,17 @@
'use client'
-import { cn } from '@/lib/utils'
-import 'katex/dist/katex.min.css'
import rehypeExternalLinks from 'rehype-external-links'
import rehypeKatex from 'rehype-katex'
import remarkGfm from 'remark-gfm'
import remarkMath from 'remark-math'
-import { Citing } from './custom-link'
+
+import { cn } from '@/lib/utils'
+
import { CodeBlock } from './ui/codeblock'
import { MemoizedReactMarkdown } from './ui/markdown'
+import { Citing } from './custom-link'
+
+import 'katex/dist/katex.min.css'
export function BotMessage({
message,
diff --git a/components/model-selector.tsx b/components/model-selector.tsx
index 4404f48c..f3b8b6eb 100644
--- a/components/model-selector.tsx
+++ b/components/model-selector.tsx
@@ -1,12 +1,16 @@
'use client'
+import { useEffect, useState } from 'react'
+import Image from 'next/image'
+
+import { Check, ChevronsUpDown, Lightbulb } from 'lucide-react'
+
import { Model } from '@/lib/types/models'
import { getCookie, setCookie } from '@/lib/utils/cookies'
import { isReasoningModel } from '@/lib/utils/registry'
-import { Check, ChevronsUpDown, Lightbulb } from 'lucide-react'
-import Image from 'next/image'
-import { useEffect, useState } from 'react'
+
import { createModelId } from '../lib/utils'
+
import { Button } from './ui/button'
import {
Command,
diff --git a/components/question-confirmation.tsx b/components/question-confirmation.tsx
index ee7db408..0a327996 100644
--- a/components/question-confirmation.tsx
+++ b/components/question-confirmation.tsx
@@ -1,12 +1,14 @@
'use client'
+import { useState } from 'react'
+
+import { ToolInvocation } from 'ai'
+import { ArrowRight, Check, SkipForward } from 'lucide-react'
+
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Checkbox } from '@/components/ui/checkbox'
import { Input } from '@/components/ui/input'
-import { ToolInvocation } from 'ai'
-import { ArrowRight, Check, SkipForward } from 'lucide-react'
-import { useState } from 'react'
interface QuestionConfirmationProps {
toolInvocation: ToolInvocation
diff --git a/components/reasoning-section.tsx b/components/reasoning-section.tsx
index 5fb098d9..22c8c2d9 100644
--- a/components/reasoning-section.tsx
+++ b/components/reasoning-section.tsx
@@ -1,11 +1,13 @@
'use client'
-import { Badge } from '@/components/ui/badge'
import { Check, Lightbulb, Loader2 } from 'lucide-react'
+
+import { Badge } from '@/components/ui/badge'
+
+import { StatusIndicator } from './ui/status-indicator'
import { CollapsibleMessage } from './collapsible-message'
import { DefaultSkeleton } from './default-skeleton'
import { BotMessage } from './message'
-import { StatusIndicator } from './ui/status-indicator'
interface ReasoningContent {
reasoning: string
diff --git a/components/related-questions.tsx b/components/related-questions.tsx
index bc0a89e0..43a17a87 100644
--- a/components/related-questions.tsx
+++ b/components/related-questions.tsx
@@ -1,14 +1,17 @@
'use client'
-import { Related } from '@/lib/schema/related'
+import React from 'react'
+
import { UseChatHelpers } from '@ai-sdk/react'
import { ToolInvocation } from 'ai'
import { ArrowRight } from 'lucide-react'
-import React from 'react'
-import { CollapsibleMessage } from './collapsible-message'
-import { Section } from './section'
+
+import { Related } from '@/lib/schema/related'
+
import { Button } from './ui/button'
import { Skeleton } from './ui/skeleton'
+import { CollapsibleMessage } from './collapsible-message'
+import { Section } from './section'
export interface RelatedQuestionsProps {
tool: ToolInvocation
diff --git a/components/render-message.tsx b/components/render-message.tsx
index 3be8473c..7701f97a 100644
--- a/components/render-message.tsx
+++ b/components/render-message.tsx
@@ -1,4 +1,5 @@
import { UIMessage, UseChatHelpers } from '@ai-sdk/react'
+
import { AnswerSection } from './answer-section'
import { ReasoningSection } from './reasoning-section'
import { ToolSection } from './tool-section'
diff --git a/components/retrieve-section.tsx b/components/retrieve-section.tsx
index 79030349..ed467fa8 100644
--- a/components/retrieve-section.tsx
+++ b/components/retrieve-section.tsx
@@ -1,11 +1,14 @@
'use client'
+import { UseChatHelpers } from '@ai-sdk/react'
+import { ToolInvocation } from 'ai'
+
+import { SearchResults as SearchResultsType } from '@/lib/types'
+
import { useArtifact } from '@/components/artifact/artifact-context'
import { SearchResults } from '@/components/search-results'
import { Section, ToolArgsSection } from '@/components/section'
-import { SearchResults as SearchResultsType } from '@/lib/types'
-import { UseChatHelpers } from '@ai-sdk/react'
-import { ToolInvocation } from 'ai'
+
import { CollapsibleMessage } from './collapsible-message'
import { DefaultSkeleton } from './default-skeleton'
diff --git a/components/retry-button.tsx b/components/retry-button.tsx
index d90e529d..48f44306 100644
--- a/components/retry-button.tsx
+++ b/components/retry-button.tsx
@@ -1,6 +1,7 @@
'use client'
import { RotateCcw } from 'lucide-react'
+
import { Button } from './ui/button'
interface RetryButtonProps {
diff --git a/components/search-mode-toggle.tsx b/components/search-mode-toggle.tsx
index 5aeea26d..a042a685 100644
--- a/components/search-mode-toggle.tsx
+++ b/components/search-mode-toggle.tsx
@@ -1,9 +1,12 @@
'use client'
+import { useEffect, useState } from 'react'
+
+import { Globe } from 'lucide-react'
+
import { cn } from '@/lib/utils'
import { getCookie, setCookie } from '@/lib/utils/cookies'
-import { Globe } from 'lucide-react'
-import { useEffect, useState } from 'react'
+
import { Toggle } from './ui/toggle'
export function SearchModeToggle() {
diff --git a/components/search-results-image.tsx b/components/search-results-image.tsx
index f032a2d4..00ba7ad8 100644
--- a/components/search-results-image.tsx
+++ b/components/search-results-image.tsx
@@ -1,6 +1,12 @@
/* eslint-disable @next/next/no-img-element */
'use client'
+import { useEffect, useState } from 'react'
+
+import { PlusCircle } from 'lucide-react'
+
+import { SearchResultImage } from '@/lib/types'
+
import {
Carousel,
type CarouselApi,
@@ -17,9 +23,6 @@ import {
DialogTitle,
DialogTrigger
} from '@/components/ui/dialog'
-import { SearchResultImage } from '@/lib/types'
-import { PlusCircle } from 'lucide-react'
-import { useEffect, useState } from 'react'
interface SearchResultsImageSectionProps {
images: SearchResultImage[]
diff --git a/components/search-results.tsx b/components/search-results.tsx
index 1cc08c7e..890b4d3a 100644
--- a/components/search-results.tsx
+++ b/components/search-results.tsx
@@ -1,11 +1,13 @@
'use client'
+import { useState } from 'react'
+import Link from 'next/link'
+
+import { SearchResultItem } from '@/lib/types'
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Button } from '@/components/ui/button'
import { Card, CardContent } from '@/components/ui/card'
-import { SearchResultItem } from '@/lib/types'
-import Link from 'next/link'
-import { useState } from 'react'
export interface SearchResultsProps {
results: SearchResultItem[]
diff --git a/components/search-section.tsx b/components/search-section.tsx
index abfe8636..fc43e653 100644
--- a/components/search-section.tsx
+++ b/components/search-section.tsx
@@ -1,9 +1,12 @@
'use client'
-import { useArtifact } from '@/components/artifact/artifact-context'
-import type { SearchResults as TypeSearchResults } from '@/lib/types'
import { UseChatHelpers } from '@ai-sdk/react'
import { ToolInvocation } from 'ai'
+
+import type { SearchResults as TypeSearchResults } from '@/lib/types'
+
+import { useArtifact } from '@/components/artifact/artifact-context'
+
import { CollapsibleMessage } from './collapsible-message'
import { SearchSkeleton } from './default-skeleton'
import { SearchResults } from './search-results'
diff --git a/components/section.tsx b/components/section.tsx
index 973a412e..55c5751d 100644
--- a/components/section.tsx
+++ b/components/section.tsx
@@ -1,6 +1,7 @@
'use client'
-import { cn } from '@/lib/utils'
+import React from 'react'
+
import {
BookCheck,
Check,
@@ -12,11 +13,13 @@ import {
Repeat2,
Search
} from 'lucide-react'
-import React from 'react'
-import { ToolBadge } from './tool-badge'
+
+import { cn } from '@/lib/utils'
+
import { Badge } from './ui/badge'
import { Separator } from './ui/separator'
import { StatusIndicator } from './ui/status-indicator'
+import { ToolBadge } from './tool-badge'
type SectionProps = {
children: React.ReactNode
diff --git a/components/sidebar/chat-history-client.tsx b/components/sidebar/chat-history-client.tsx
index 68995f62..a22da926 100644
--- a/components/sidebar/chat-history-client.tsx
+++ b/components/sidebar/chat-history-client.tsx
@@ -1,13 +1,17 @@
'use client'
+import { useCallback, useEffect, useRef, useState, useTransition } from 'react'
+
+import { toast } from 'sonner'
+
+import { Chat as DBChat } from '@/lib/db/schema'
+
import {
SidebarGroup,
SidebarGroupLabel,
SidebarMenu
} from '@/components/ui/sidebar'
-import { Chat as DBChat } from '@/lib/db/schema'
-import { useCallback, useEffect, useRef, useState, useTransition } from 'react'
-import { toast } from 'sonner'
+
import { ChatHistorySkeleton } from './chat-history-skeleton'
import { ChatMenuItem } from './chat-menu-item'
import { ClearHistoryAction } from './clear-history-action'
diff --git a/components/sidebar/chat-menu-item.tsx b/components/sidebar/chat-menu-item.tsx
index 8cabead9..6b94d723 100644
--- a/components/sidebar/chat-menu-item.tsx
+++ b/components/sidebar/chat-menu-item.tsx
@@ -1,5 +1,15 @@
'use client'
+import { useCallback, useState, useTransition } from 'react'
+import Link from 'next/link'
+import { usePathname, useRouter } from 'next/navigation'
+
+import { MoreHorizontal, Trash2 } from 'lucide-react'
+import { toast } from 'sonner'
+
+import { deleteChat } from '@/lib/actions/chat-db'
+import { Chat as DBChat } from '@/lib/db/schema'
+
import {
AlertDialog,
AlertDialogAction,
@@ -22,13 +32,7 @@ import {
SidebarMenuButton,
SidebarMenuItem
} from '@/components/ui/sidebar'
-import { deleteChat } from '@/lib/actions/chat-db'
-import { Chat as DBChat } from '@/lib/db/schema'
-import { MoreHorizontal, Trash2 } from 'lucide-react'
-import Link from 'next/link'
-import { usePathname, useRouter } from 'next/navigation'
-import { useCallback, useState, useTransition } from 'react'
-import { toast } from 'sonner'
+
import { Spinner } from '../ui/spinner'
interface ChatMenuItemProps {
diff --git a/components/sidebar/clear-history-action.tsx b/components/sidebar/clear-history-action.tsx
index caadd1bb..bc3f3655 100644
--- a/components/sidebar/clear-history-action.tsx
+++ b/components/sidebar/clear-history-action.tsx
@@ -1,5 +1,13 @@
'use client'
+import { useCallback, useState, useTransition } from 'react'
+import { useRouter } from 'next/navigation'
+
+import { MoreHorizontal, Trash2 } from 'lucide-react'
+import { toast } from 'sonner'
+
+import { clearChats } from '@/lib/actions/chat-db'
+
import {
AlertDialog,
AlertDialogAction,
@@ -19,11 +27,6 @@ import {
} from '@/components/ui/dropdown-menu'
import { SidebarGroupAction } from '@/components/ui/sidebar'
import { Spinner } from '@/components/ui/spinner'
-import { clearChats } from '@/lib/actions/chat-db'
-import { MoreHorizontal, Trash2 } from 'lucide-react'
-import { useRouter } from 'next/navigation'
-import { useCallback, useState, useTransition } from 'react'
-import { toast } from 'sonner'
interface ClearHistoryActionProps {
empty: boolean
diff --git a/components/sign-up-form.tsx b/components/sign-up-form.tsx
index 1ff06cb7..75173ef6 100644
--- a/components/sign-up-form.tsx
+++ b/components/sign-up-form.tsx
@@ -1,5 +1,12 @@
'use client'
+import { useState } from 'react'
+import Link from 'next/link'
+import { useRouter } from 'next/navigation'
+
+import { createClient } from '@/lib/supabase/client'
+import { cn } from '@/lib/utils/index'
+
import { Button } from '@/components/ui/button'
import {
Card,
@@ -11,11 +18,6 @@ import {
import { IconLogo } from '@/components/ui/icons'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
-import { createClient } from '@/lib/supabase/client'
-import { cn } from '@/lib/utils/index'
-import Link from 'next/link'
-import { useRouter } from 'next/navigation'
-import { useState } from 'react'
export function SignUpForm({
className,
diff --git a/components/theme-menu-items.tsx b/components/theme-menu-items.tsx
index 4960eab0..0c5b99df 100644
--- a/components/theme-menu-items.tsx
+++ b/components/theme-menu-items.tsx
@@ -1,9 +1,11 @@
'use client'
-import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
-import { Laptop, Moon, Sun } from 'lucide-react'
import { useTheme } from 'next-themes'
+import { Laptop, Moon, Sun } from 'lucide-react'
+
+import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
+
export function ThemeMenuItems() {
const { setTheme } = useTheme()
diff --git a/components/tool-badge.tsx b/components/tool-badge.tsx
index 3a094428..d7b405de 100644
--- a/components/tool-badge.tsx
+++ b/components/tool-badge.tsx
@@ -1,5 +1,7 @@
-import { Film, Link, Search } from 'lucide-react'
import React from 'react'
+
+import { Film, Link, Search } from 'lucide-react'
+
import { Badge } from './ui/badge'
type ToolBadgeProps = {
diff --git a/components/tool-section.tsx b/components/tool-section.tsx
index 432c37bd..a829de46 100644
--- a/components/tool-section.tsx
+++ b/components/tool-section.tsx
@@ -2,6 +2,7 @@
import { UseChatHelpers } from '@ai-sdk/react'
import { ToolInvocation } from 'ai'
+
import { QuestionConfirmation } from './question-confirmation'
import { RelatedQuestions } from './related-questions'
import RetrieveSection from './retrieve-section'
diff --git a/components/ui/alert-dialog.tsx b/components/ui/alert-dialog.tsx
index ab74973d..d4f3a475 100644
--- a/components/ui/alert-dialog.tsx
+++ b/components/ui/alert-dialog.tsx
@@ -1,9 +1,11 @@
'use client'
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'
const AlertDialog = AlertDialogPrimitive.Root
@@ -128,14 +130,13 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
export {
AlertDialog,
- AlertDialogPortal,
- AlertDialogOverlay,
- AlertDialogTrigger,
+ AlertDialogAction,
+ AlertDialogCancel,
AlertDialogContent,
- AlertDialogHeader,
+ AlertDialogDescription,
AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogOverlay,
+ AlertDialogPortal,
AlertDialogTitle,
- AlertDialogDescription,
- AlertDialogAction,
- AlertDialogCancel
-}
+ AlertDialogTrigger}
diff --git a/components/ui/avatar.tsx b/components/ui/avatar.tsx
index 1a5543ea..48d774c5 100644
--- a/components/ui/avatar.tsx
+++ b/components/ui/avatar.tsx
@@ -1,8 +1,9 @@
'use client'
-import * as AvatarPrimitive from '@radix-ui/react-avatar'
import * as React from 'react'
+import * as AvatarPrimitive from '@radix-ui/react-avatar'
+
import { cn } from '@/lib/utils/index'
const Avatar = React.forwardRef<
diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx
index d9a84b39..45ea791f 100644
--- a/components/ui/badge.tsx
+++ b/components/ui/badge.tsx
@@ -1,4 +1,5 @@
import * as React from 'react'
+
import { cva, type VariantProps } from 'class-variance-authority'
import { cn } from '@/lib/utils'
diff --git a/components/ui/button.tsx b/components/ui/button.tsx
index 72889051..7a9b8bf6 100644
--- a/components/ui/button.tsx
+++ b/components/ui/button.tsx
@@ -1,4 +1,5 @@
import * as React from 'react'
+
import { Slot } from '@radix-ui/react-slot'
import { cva, type VariantProps } from 'class-variance-authority'
diff --git a/components/ui/card.tsx b/components/ui/card.tsx
index f9a373cc..626c75b7 100644
--- a/components/ui/card.tsx
+++ b/components/ui/card.tsx
@@ -76,4 +76,4 @@ const CardFooter = React.forwardRef<
))
CardFooter.displayName = 'CardFooter'
-export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
+export { Card, CardContent,CardDescription, CardFooter, CardHeader, CardTitle }
diff --git a/components/ui/carousel.tsx b/components/ui/carousel.tsx
index 52f8fcff..36c3cb6c 100644
--- a/components/ui/carousel.tsx
+++ b/components/ui/carousel.tsx
@@ -1,12 +1,14 @@
'use client'
import * as React from 'react'
+
import useEmblaCarousel, {
type UseEmblaCarouselType
} from 'embla-carousel-react'
import { ArrowLeft, ArrowRight } from 'lucide-react'
import { cn } from '@/lib/utils'
+
import { Button } from '@/components/ui/button'
type CarouselApi = UseEmblaCarouselType[1]
@@ -253,10 +255,9 @@ const CarouselNext = React.forwardRef<
CarouselNext.displayName = 'CarouselNext'
export {
- type CarouselApi,
Carousel,
+ type CarouselApi,
CarouselContent,
CarouselItem,
- CarouselPrevious,
- CarouselNext
-}
+ CarouselNext,
+ CarouselPrevious}
diff --git a/components/ui/checkbox.tsx b/components/ui/checkbox.tsx
index 774ee9ee..1470fbbe 100644
--- a/components/ui/checkbox.tsx
+++ b/components/ui/checkbox.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
import { Check } from 'lucide-react'
diff --git a/components/ui/codeblock.tsx b/components/ui/codeblock.tsx
index ac353da6..b3f4606b 100644
--- a/components/ui/codeblock.tsx
+++ b/components/ui/codeblock.tsx
@@ -7,11 +7,13 @@ import { FC, memo } from 'react'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import { coldarkDark } from 'react-syntax-highlighter/dist/cjs/styles/prism'
-import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard'
-import { Button } from '@/components/ui/button'
import { generateId } from 'ai'
import { Check, Copy, Download } from 'lucide-react'
+import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard'
+
+import { Button } from '@/components/ui/button'
+
interface Props {
language: string
value: string
diff --git a/components/ui/collapsible.tsx b/components/ui/collapsible.tsx
index 1bbaed5a..af841442 100644
--- a/components/ui/collapsible.tsx
+++ b/components/ui/collapsible.tsx
@@ -8,4 +8,4 @@ const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
-export { Collapsible, CollapsibleTrigger, CollapsibleContent }
+export { Collapsible, CollapsibleContent,CollapsibleTrigger }
diff --git a/components/ui/command.tsx b/components/ui/command.tsx
index d1c24af4..3ef6a4b2 100644
--- a/components/ui/command.tsx
+++ b/components/ui/command.tsx
@@ -1,11 +1,13 @@
'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 { cn } from '@/lib/utils'
+
import { Dialog, DialogContent } from '@/components/ui/dialog'
const Command = React.forwardRef<
@@ -143,11 +145,10 @@ CommandShortcut.displayName = 'CommandShortcut'
export {
Command,
CommandDialog,
- CommandInput,
- CommandList,
CommandEmpty,
CommandGroup,
+ CommandInput,
CommandItem,
- CommandShortcut,
- CommandSeparator
-}
+ CommandList,
+ CommandSeparator,
+ CommandShortcut}
diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx
index 5509e2dd..3800dce8 100644
--- a/components/ui/dialog.tsx
+++ b/components/ui/dialog.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
import { X } from 'lucide-react'
@@ -110,13 +111,12 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName
export {
Dialog,
- DialogPortal,
- DialogOverlay,
DialogClose,
- DialogTrigger,
DialogContent,
- DialogHeader,
+ DialogDescription,
DialogFooter,
+ DialogHeader,
+ DialogOverlay,
+ DialogPortal,
DialogTitle,
- DialogDescription
-}
+ DialogTrigger}
diff --git a/components/ui/drawer.tsx b/components/ui/drawer.tsx
index 16506c1b..2395bf5c 100644
--- a/components/ui/drawer.tsx
+++ b/components/ui/drawer.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import { Drawer as DrawerPrimitive } from 'vaul'
import { cn } from '@/lib/utils/index'
@@ -106,13 +107,12 @@ DrawerDescription.displayName = DrawerPrimitive.Description.displayName
export {
Drawer,
- DrawerPortal,
- DrawerOverlay,
- DrawerTrigger,
DrawerClose,
DrawerContent,
- DrawerHeader,
+ DrawerDescription,
DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ DrawerPortal,
DrawerTitle,
- DrawerDescription
-}
+ DrawerTrigger}
diff --git a/components/ui/dropdown-menu.tsx b/components/ui/dropdown-menu.tsx
index b0744124..0294c24f 100644
--- a/components/ui/dropdown-menu.tsx
+++ b/components/ui/dropdown-menu.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
import { Check, ChevronRight, Circle } from 'lucide-react'
@@ -183,18 +184,17 @@ DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'
export {
DropdownMenu,
- DropdownMenuTrigger,
+ DropdownMenuCheckboxItem,
DropdownMenuContent,
+ DropdownMenuGroup,
DropdownMenuItem,
- DropdownMenuCheckboxItem,
- DropdownMenuRadioItem,
DropdownMenuLabel,
+ DropdownMenuPortal,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuShortcut,
- DropdownMenuGroup,
- DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
- DropdownMenuRadioGroup
-}
+ DropdownMenuTrigger}
diff --git a/components/ui/label.tsx b/components/ui/label.tsx
index 5f2488bd..adeda93e 100644
--- a/components/ui/label.tsx
+++ b/components/ui/label.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as LabelPrimitive from '@radix-ui/react-label'
import { cva, type VariantProps } from 'class-variance-authority'
diff --git a/components/ui/popover.tsx b/components/ui/popover.tsx
index 1903cfa7..a2c6b78b 100644
--- a/components/ui/popover.tsx
+++ b/components/ui/popover.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as PopoverPrimitive from '@radix-ui/react-popover'
import { cn } from '@/lib/utils'
@@ -28,4 +29,4 @@ const PopoverContent = React.forwardRef<
))
PopoverContent.displayName = PopoverPrimitive.Content.displayName
-export { Popover, PopoverTrigger, PopoverContent }
+export { Popover, PopoverContent,PopoverTrigger }
diff --git a/components/ui/resizable.tsx b/components/ui/resizable.tsx
index aaad6fb4..9aff8691 100644
--- a/components/ui/resizable.tsx
+++ b/components/ui/resizable.tsx
@@ -1,8 +1,9 @@
'use client'
-import { GripVertical } from 'lucide-react'
import * as ResizablePrimitive from 'react-resizable-panels'
+import { GripVertical } from 'lucide-react'
+
import { cn } from '@/lib/utils/index'
const ResizablePanelGroup = ({
diff --git a/components/ui/select.tsx b/components/ui/select.tsx
index aed4c298..5826b9ef 100644
--- a/components/ui/select.tsx
+++ b/components/ui/select.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as SelectPrimitive from '@radix-ui/react-select'
import { Check, ChevronDown, ChevronUp } from 'lucide-react'
@@ -148,13 +149,12 @@ SelectSeparator.displayName = SelectPrimitive.Separator.displayName
export {
Select,
- SelectGroup,
- SelectValue,
- SelectTrigger,
SelectContent,
- SelectLabel,
+ SelectGroup,
SelectItem,
- SelectSeparator,
+ SelectLabel,
+ SelectScrollDownButton,
SelectScrollUpButton,
- SelectScrollDownButton
-}
+ SelectSeparator,
+ SelectTrigger,
+ SelectValue}
diff --git a/components/ui/separator.tsx b/components/ui/separator.tsx
index beb7809d..a489c61f 100644
--- a/components/ui/separator.tsx
+++ b/components/ui/separator.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as SeparatorPrimitive from '@radix-ui/react-separator'
import { cn } from '@/lib/utils/index'
diff --git a/components/ui/sheet.tsx b/components/ui/sheet.tsx
index 2bacf2de..0c5bf732 100644
--- a/components/ui/sheet.tsx
+++ b/components/ui/sheet.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as SheetPrimitive from '@radix-ui/react-dialog'
import { cva, type VariantProps } from 'class-variance-authority'
import { X } from 'lucide-react'
@@ -128,13 +129,12 @@ SheetDescription.displayName = SheetPrimitive.Description.displayName
export {
Sheet,
- SheetPortal,
- SheetOverlay,
- SheetTrigger,
SheetClose,
SheetContent,
- SheetHeader,
+ SheetDescription,
SheetFooter,
+ SheetHeader,
+ SheetOverlay,
+ SheetPortal,
SheetTitle,
- SheetDescription
-}
+ SheetTrigger}
diff --git a/components/ui/sidebar.tsx b/components/ui/sidebar.tsx
index 5de2fa89..968ce018 100644
--- a/components/ui/sidebar.tsx
+++ b/components/ui/sidebar.tsx
@@ -1,9 +1,14 @@
'use client'
+import * as React from 'react'
+
import { Slot } from '@radix-ui/react-slot'
-import { VariantProps, cva } from 'class-variance-authority'
+import { cva,VariantProps } from 'class-variance-authority'
import { PanelLeft } from 'lucide-react'
-import * as React from 'react'
+
+import { cn } from '@/lib/utils/index'
+
+import { useIsMobile } from '@/hooks/use-mobile'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
@@ -22,8 +27,6 @@ import {
TooltipProvider,
TooltipTrigger
} from '@/components/ui/tooltip'
-import { useIsMobile } from '@/hooks/use-mobile'
-import { cn } from '@/lib/utils/index'
const SIDEBAR_COOKIE_NAME = 'sidebar_state'
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
diff --git a/components/ui/slider.tsx b/components/ui/slider.tsx
index de1747ce..a41d1a13 100644
--- a/components/ui/slider.tsx
+++ b/components/ui/slider.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as SliderPrimitive from '@radix-ui/react-slider'
import { cn } from '@/lib/utils'
diff --git a/components/ui/sonner.tsx b/components/ui/sonner.tsx
index 1053bd8d..a766fcee 100644
--- a/components/ui/sonner.tsx
+++ b/components/ui/sonner.tsx
@@ -1,6 +1,7 @@
'use client'
import { useTheme } from 'next-themes'
+
import { Toaster as Sonner } from 'sonner'
type ToasterProps = React.ComponentProps<typeof Sonner>
diff --git a/components/ui/spinner.tsx b/components/ui/spinner.tsx
index 1cf111dc..07bf01a2 100644
--- a/components/ui/spinner.tsx
+++ b/components/ui/spinner.tsx
@@ -1,6 +1,7 @@
// Based on: https://github.com/vercel/ai/blob/main/examples/next-ai-rsc/components/llm-stocks/spinner.tsx
import { cn } from '@/lib/utils'
+
import { IconLogo } from './icons'
interface SpinnerProps extends React.SVGProps<SVGSVGElement> {}
diff --git a/components/ui/status-indicator.tsx b/components/ui/status-indicator.tsx
index d654f236..42a7839d 100644
--- a/components/ui/status-indicator.tsx
+++ b/components/ui/status-indicator.tsx
@@ -1,6 +1,7 @@
-import { LucideIcon } from 'lucide-react'
import { ReactNode } from 'react'
+import { LucideIcon } from 'lucide-react'
+
interface StatusIndicatorProps {
icon: LucideIcon
iconClassName?: string
diff --git a/components/ui/switch.tsx b/components/ui/switch.tsx
index 22432b9c..056d4402 100644
--- a/components/ui/switch.tsx
+++ b/components/ui/switch.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as SwitchPrimitives from '@radix-ui/react-switch'
import { cn } from '@/lib/utils'
diff --git a/components/ui/toggle.tsx b/components/ui/toggle.tsx
index dbd978cc..92b95376 100644
--- a/components/ui/toggle.tsx
+++ b/components/ui/toggle.tsx
@@ -1,8 +1,9 @@
'use client'
+import * as React from 'react'
+
import * as TogglePrimitive from '@radix-ui/react-toggle'
import { cva, type VariantProps } from 'class-variance-authority'
-import * as React from 'react'
import { cn } from '@/lib/utils'
diff --git a/components/ui/tooltip-button.tsx b/components/ui/tooltip-button.tsx
index 85862ba7..30dc5945 100644
--- a/components/ui/tooltip-button.tsx
+++ b/components/ui/tooltip-button.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import { Button, ButtonProps } from '@/components/ui/button'
import {
Tooltip,
diff --git a/components/ui/tooltip.tsx b/components/ui/tooltip.tsx
index 6e12f6b5..22dc2d6f 100644
--- a/components/ui/tooltip.tsx
+++ b/components/ui/tooltip.tsx
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
import { cn } from '@/lib/utils/index'
@@ -27,4 +28,4 @@ const TooltipContent = React.forwardRef<
))
TooltipContent.displayName = TooltipPrimitive.Content.displayName
-export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
+export { Tooltip, TooltipContent, TooltipProvider,TooltipTrigger }
diff --git a/components/update-password-form.tsx b/components/update-password-form.tsx
index b82827d6..70cc4e7a 100644
--- a/components/update-password-form.tsx
+++ b/components/update-password-form.tsx
@@ -1,5 +1,11 @@
'use client'
+import { useState } from 'react'
+import { useRouter } from 'next/navigation'
+
+import { createClient } from '@/lib/supabase/client'
+import { cn } from '@/lib/utils/index'
+
import { Button } from '@/components/ui/button'
import {
Card,
@@ -10,10 +16,6 @@ import {
} from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
-import { createClient } from '@/lib/supabase/client'
-import { cn } from '@/lib/utils/index'
-import { useRouter } from 'next/navigation'
-import { useState } from 'react'
export function UpdatePasswordForm({
className,
diff --git a/components/uploaded-file-list.tsx b/components/uploaded-file-list.tsx
index 19f124e6..6fd3d9e7 100644
--- a/components/uploaded-file-list.tsx
+++ b/components/uploaded-file-list.tsx
@@ -1,9 +1,11 @@
'use client'
-import { UploadedFile } from '@/lib/types'
-import { Loader2, X } from 'lucide-react'
-import Image from 'next/image'
import React from 'react'
+import Image from 'next/image'
+
+import { Loader2, X } from 'lucide-react'
+
+import { UploadedFile } from '@/lib/types'
interface UploadedFileListProps {
files: UploadedFile[]
diff --git a/components/user-file-section.tsx b/components/user-file-section.tsx
index 8155bf66..6274f428 100644
--- a/components/user-file-section.tsx
+++ b/components/user-file-section.tsx
@@ -1,4 +1,5 @@
import React from 'react'
+
import { AttachmentPreview } from './attachment-preview'
interface UserFileSectionProps {
diff --git a/components/user-menu.tsx b/components/user-menu.tsx
index d555a35b..f43bea97 100644
--- a/components/user-menu.tsx
+++ b/components/user-menu.tsx
@@ -1,5 +1,12 @@
'use client'
+import { useRouter } from 'next/navigation'
+
+import { User } from '@supabase/supabase-js'
+import { Link2, LogOut, Palette } from 'lucide-react'
+
+import { createClient } from '@/lib/supabase/client'
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import {
DropdownMenu,
@@ -12,13 +19,10 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
-import { createClient } from '@/lib/supabase/client'
-import { User } from '@supabase/supabase-js'
-import { Link2, LogOut, Palette } from 'lucide-react'
-import { useRouter } from 'next/navigation'
+
+import { Button } from './ui/button'
import { ExternalLinkItems } from './external-link-items'
import { ThemeMenuItems } from './theme-menu-items'
-import { Button } from './ui/button'
interface UserMenuProps {
user: User
diff --git a/components/user-text-section.tsx b/components/user-text-section.tsx
index ecc9a9e7..93303996 100644
--- a/components/user-text-section.tsx
+++ b/components/user-text-section.tsx
@@ -1,11 +1,14 @@
'use client'
-import { cn } from '@/lib/utils'
-import { Pencil } from 'lucide-react'
import React, { useState } from 'react'
import TextareaAutosize from 'react-textarea-autosize'
-import { CollapsibleMessage } from './collapsible-message'
+
+import { Pencil } from 'lucide-react'
+
+import { cn } from '@/lib/utils'
+
import { Button } from './ui/button'
+import { CollapsibleMessage } from './collapsible-message'
interface UserTextSectionProps {
content: string
diff --git a/components/video-carousel-dialog.tsx b/components/video-carousel-dialog.tsx
index 2c7f6871..c2890495 100644
--- a/components/video-carousel-dialog.tsx
+++ b/components/video-carousel-dialog.tsx
@@ -1,5 +1,9 @@
'use client'
+import { useEffect, useRef, useState } from 'react'
+
+import { SerperSearchResultItem } from '@/lib/types'
+
import {
Carousel,
type CarouselApi,
@@ -16,8 +20,6 @@ import {
DialogTitle,
DialogTrigger
} from '@/components/ui/dialog'
-import { SerperSearchResultItem } from '@/lib/types'
-import { useEffect, useRef, useState } from 'react'
interface VideoCarouselDialogProps {
children: React.ReactNode
diff --git a/components/video-result-grid.tsx b/components/video-result-grid.tsx
index 0170ef27..6da25511 100644
--- a/components/video-result-grid.tsx
+++ b/components/video-result-grid.tsx
@@ -1,10 +1,14 @@
'use client'
+import Image from 'next/image'
+
+import { PlusCircle } from 'lucide-react'
+
+import { SerperSearchResultItem } from '@/lib/types'
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Card, CardContent } from '@/components/ui/card'
-import { SerperSearchResultItem } from '@/lib/types'
-import { PlusCircle } from 'lucide-react'
-import Image from 'next/image'
+
import { VideoCarouselDialog } from './video-carousel-dialog'
interface VideoResultGridProps {
diff --git a/components/video-search-results.tsx b/components/video-search-results.tsx
index 14293c53..f754b499 100644
--- a/components/video-search-results.tsx
+++ b/components/video-search-results.tsx
@@ -2,6 +2,7 @@
'use client'
import { SerperSearchResultItem, SerperSearchResults } from '@/lib/types'
+
import { VideoResultGrid } from './video-result-grid'
export interface VideoSearchResultsProps {
diff --git a/components/video-search-section.tsx b/components/video-search-section.tsx
index 95d15254..424438ff 100644
--- a/components/video-search-section.tsx
+++ b/components/video-search-section.tsx
@@ -1,9 +1,12 @@
'use client'
-import { useArtifact } from '@/components/artifact/artifact-context'
-import type { SerperSearchResults } from '@/lib/types'
import { UseChatHelpers } from '@ai-sdk/react'
import { ToolInvocation } from 'ai'
+
+import type { SerperSearchResults } from '@/lib/types'
+
+import { useArtifact } from '@/components/artifact/artifact-context'
+
import { CollapsibleMessage } from './collapsible-message'
import { DefaultSkeleton } from './default-skeleton'
import { Section, ToolArgsSection } from './section'
diff --git a/lib/actions/__tests__/chat-db.test.ts b/lib/actions/__tests__/chat-db.test.ts
index f52f34b2..80e8eaa3 100644
--- a/lib/actions/__tests__/chat-db.test.ts
+++ b/lib/actions/__tests__/chat-db.test.ts
@@ -1,6 +1,7 @@
-import { generateUUID } from '@/lib/utils' // Import the UUID generator
import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { generateUUID } from '@/lib/utils' // Import the UUID generator
+
// Mock target modules first
vi.mock('@/lib/db/chat', () => ({
clearChats: vi.fn(),
@@ -22,6 +23,7 @@ vi.mock('@/lib/auth/get-current-user', () => ({
import { getCurrentUserId } from '@/lib/auth/get-current-user'
import * as chatDb from '@/lib/db/chat'
import type { Chat as DBChat, Message as DBMessage } from '@/lib/db/schema' // Import DB schema types for test data
+
import {
clearChats,
deleteChat,
diff --git a/lib/actions/chat-db.ts b/lib/actions/chat-db.ts
index c23bd3ae..8b325558 100644
--- a/lib/actions/chat-db.ts
+++ b/lib/actions/chat-db.ts
@@ -1,11 +1,13 @@
'use server'
+import { revalidateTag, unstable_cache } from 'next/cache'
+
+import { UIMessage } from '@ai-sdk/react' // Import UIMessage
+
import { getCurrentUserId } from '@/lib/auth/get-current-user' // Import getCurrentUserId
import * as chatDb from '@/lib/db/chat'
import { type Chat as DBChat, type Message as DBMessage } from '@/lib/db/schema' // Import DB schema types
import { getTextFromParts } from '@/lib/utils/message-utils' // Corrected import path
-import { UIMessage } from '@ai-sdk/react' // Import UIMessage
-import { revalidateTag, unstable_cache } from 'next/cache'
// Get all chats for a user
export async function getChats(userId: string) {
diff --git a/lib/agents/generate-related-questions.ts b/lib/agents/generate-related-questions.ts
index 7301f8d9..59940920 100644
--- a/lib/agents/generate-related-questions.ts
+++ b/lib/agents/generate-related-questions.ts
@@ -1,5 +1,6 @@
import { generateObject, ModelMessage, streamText, tool } from 'ai'
import { z } from 'zod'
+
import { relatedSchema } from '../schema/related'
import { getModel } from '../utils/registry'
diff --git a/lib/agents/researcher.ts b/lib/agents/researcher.ts
index bcf2714d..89e18655 100644
--- a/lib/agents/researcher.ts
+++ b/lib/agents/researcher.ts
@@ -1,4 +1,5 @@
import { ModelMessage, smoothStream, streamText } from 'ai'
+
import { createQuestionTool } from '../tools/question'
import { retrieveTool } from '../tools/retrieve'
import { createSearchTool } from '../tools/search'
diff --git a/lib/agents/title-generator.ts b/lib/agents/title-generator.ts
index 4b22aeb5..fdec690d 100644
--- a/lib/agents/title-generator.ts
+++ b/lib/agents/title-generator.ts
@@ -1,4 +1,5 @@
import { generateText } from 'ai'
+
import { getModel } from '../utils/registry'
interface GenerateChatTitleParams {
diff --git a/lib/config/models.ts b/lib/config/models.ts
index 5dd043bd..9e702a9c 100644
--- a/lib/config/models.ts
+++ b/lib/config/models.ts
@@ -1,5 +1,7 @@
-import { Model } from '@/lib/types/models'
import { unstable_cache } from 'next/cache'
+
+import { Model } from '@/lib/types/models'
+
import defaultModels from './default-models.json'
export function validateModel(model: any): model is Model {
diff --git a/lib/db/chat.ts b/lib/db/chat.ts
index 375e6218..f8d883a6 100644
--- a/lib/db/chat.ts
+++ b/lib/db/chat.ts
@@ -1,7 +1,9 @@
-import { and, desc, eq, gte, inArray } from 'drizzle-orm'
import { revalidatePath } from 'next/cache'
+
+import { and, desc, eq, gte, inArray } from 'drizzle-orm'
+
+import { type Chat, chats, type Message,messages } from './schema'
import { db } from '.'
-import { chats, messages, type Chat, type Message } from './schema'
// Create a new chat
export async function createChat({
diff --git a/lib/db/index.ts b/lib/db/index.ts
index 7fe39161..b81415c0 100644
--- a/lib/db/index.ts
+++ b/lib/db/index.ts
@@ -1,5 +1,6 @@
import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
+
import * as schema from './schema'
// For server-side usage only
diff --git a/lib/db/migrate.ts b/lib/db/migrate.ts
index e2144a09..b6e89b98 100644
--- a/lib/db/migrate.ts
+++ b/lib/db/migrate.ts
@@ -1,8 +1,9 @@
-import 'dotenv/config'
import { drizzle } from 'drizzle-orm/postgres-js'
import { migrate } from 'drizzle-orm/postgres-js/migrator'
import postgres from 'postgres'
+import 'dotenv/config'
+
// This script is used to run migrations on the database
// Run it with: bun run lib/db/migrate.ts
diff --git a/lib/streaming/create-chat-stream-response.ts b/lib/streaming/create-chat-stream-response.ts
index 1f8cd801..875084d4 100644
--- a/lib/streaming/create-chat-stream-response.ts
+++ b/lib/streaming/create-chat-stream-response.ts
@@ -1,4 +1,3 @@
-import { researcher } from '@/lib/agents/researcher'
import {
appendClientMessage,
convertToModelMessages,
@@ -7,12 +6,16 @@ import {
UIMessage,
UIMessageStreamWriter
} from 'ai'
+
+import { researcher } from '@/lib/agents/researcher'
+
import { saveChatMessage, saveSingleMessage } from '../actions/chat-db'
import { generateRelatedQuestions } from '../agents/generate-related-questions'
import { generateChatTitle } from '../agents/title-generator'
import { getChat, getChatMessages } from '../db/chat'
import { generateUUID } from '../utils'
import { getTextFromParts, mergeUIMessages } from '../utils/message-utils'
+
import { BaseStreamConfig } from './types'
export async function createChatStreamResponse(
diff --git a/lib/streaming/types.ts b/lib/streaming/types.ts
index 97c3ce0c..abb40b04 100644
--- a/lib/streaming/types.ts
+++ b/lib/streaming/types.ts
@@ -1,4 +1,5 @@
import { UIMessage } from '@ai-sdk/react'
+
import { Model } from '../types/models'
export interface BaseStreamConfig {
diff --git a/lib/supabase/middleware.ts b/lib/supabase/middleware.ts
index b4ee9c54..b196325b 100644
--- a/lib/supabase/middleware.ts
+++ b/lib/supabase/middleware.ts
@@ -1,5 +1,6 @@
+import { type NextRequest,NextResponse } from 'next/server'
+
import { createServerClient } from '@supabase/ssr'
-import { NextResponse, type NextRequest } from 'next/server'
export async function updateSession(request: NextRequest) {
let supabaseResponse = NextResponse.next({
diff --git a/lib/supabase/server.ts b/lib/supabase/server.ts
index 380f6897..71948b9b 100644
--- a/lib/supabase/server.ts
+++ b/lib/supabase/server.ts
@@ -1,6 +1,7 @@
-import { createServerClient } from '@supabase/ssr'
import { cookies } from 'next/headers'
+import { createServerClient } from '@supabase/ssr'
+
export async function createClient() {
const cookieStore = await cookies()
diff --git a/lib/tools/question.ts b/lib/tools/question.ts
index 669b86ba..1a6972a3 100644
--- a/lib/tools/question.ts
+++ b/lib/tools/question.ts
@@ -1,6 +1,7 @@
-import { getQuestionSchemaForModel } from '@/lib/schema/question'
import { tool } from 'ai'
+import { getQuestionSchemaForModel } from '@/lib/schema/question'
+
/**
* Creates a question tool with the appropriate schema for the specified model.
*/
diff --git a/lib/tools/retrieve.ts b/lib/tools/retrieve.ts
index 1d1a9e9d..af1ca62f 100644
--- a/lib/tools/retrieve.ts
+++ b/lib/tools/retrieve.ts
@@ -1,4 +1,5 @@
import { tool } from 'ai'
+
import { retrieveSchema } from '@/lib/schema/retrieve'
import { SearchResults as SearchResultsType } from '@/lib/types'
diff --git a/lib/tools/search.ts b/lib/tools/search.ts
index 77e4a3e6..f4bffdd5 100644
--- a/lib/tools/search.ts
+++ b/lib/tools/search.ts
@@ -1,12 +1,13 @@
+import { tool } from 'ai'
+
import { getSearchSchemaForModel } from '@/lib/schema/search'
import { SearchResults } from '@/lib/types'
import { getBaseUrlString } from '@/lib/utils/url'
-import { tool } from 'ai'
+
import {
+ createSearchProvider,
DEFAULT_PROVIDER,
- SearchProviderType,
- createSearchProvider
-} from './search/providers'
+ SearchProviderType} from './search/providers'
/**
* Creates a search tool with the appropriate schema for the given model.
diff --git a/lib/tools/search/providers/exa.ts b/lib/tools/search/providers/exa.ts
index a2145d19..be8239d6 100644
--- a/lib/tools/search/providers/exa.ts
+++ b/lib/tools/search/providers/exa.ts
@@ -1,5 +1,7 @@
-import { SearchResults } from '@/lib/types'
import Exa from 'exa-js'
+
+import { SearchResults } from '@/lib/types'
+
import { BaseSearchProvider } from './base'
export class ExaSearchProvider extends BaseSearchProvider {
diff --git a/lib/tools/search/providers/searxng.ts b/lib/tools/search/providers/searxng.ts
index 5314d292..4dacd79e 100644
--- a/lib/tools/search/providers/searxng.ts
+++ b/lib/tools/search/providers/searxng.ts
@@ -4,6 +4,7 @@ import {
SearXNGResponse,
SearXNGResult
} from '@/lib/types'
+
import { BaseSearchProvider } from './base'
export class SearXNGSearchProvider extends BaseSearchProvider {
diff --git a/lib/tools/search/providers/tavily.ts b/lib/tools/search/providers/tavily.ts
index 967077ec..65b30975 100644
--- a/lib/tools/search/providers/tavily.ts
+++ b/lib/tools/search/providers/tavily.ts
@@ -1,5 +1,6 @@
import { SearchResultImage, SearchResults } from '@/lib/types'
import { sanitizeUrl } from '@/lib/utils'
+
import { BaseSearchProvider } from './base'
export class TavilySearchProvider extends BaseSearchProvider {
diff --git a/lib/tools/video-search.ts b/lib/tools/video-search.ts
index 89834eaf..ebe3255e 100644
--- a/lib/tools/video-search.ts
+++ b/lib/tools/video-search.ts
@@ -1,6 +1,7 @@
-import { getSearchSchemaForModel } from '@/lib/schema/search'
import { tool } from 'ai'
+import { getSearchSchemaForModel } from '@/lib/schema/search'
+
/**
* Creates a video search tool with the appropriate schema for the model.
*/
diff --git a/lib/utils/context-window.ts b/lib/utils/context-window.ts
index 23dafa1e..ef817377 100644
--- a/lib/utils/context-window.ts
+++ b/lib/utils/context-window.ts
@@ -1,4 +1,5 @@
import { ModelMessage } from 'ai'
+
import { Model } from '../types/models'
const DEFAULT_CONTEXT_WINDOW = 128_000
diff --git a/lib/utils/index.ts b/lib/utils/index.ts
index 5f9a0693..c6b77c52 100644
--- a/lib/utils/index.ts
+++ b/lib/utils/index.ts
@@ -1,7 +1,8 @@
-import { type Model } from '@/lib/types/models'
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
+import { type Model } from '@/lib/types/models'
+
// Function to generate a UUID
export function generateUUID(): string {
// Generate UUIDv4
diff --git a/lib/utils/message-utils.ts b/lib/utils/message-utils.ts
index e7710369..137c40d3 100644
--- a/lib/utils/message-utils.ts
+++ b/lib/utils/message-utils.ts
@@ -1,6 +1,7 @@
-import { type Message as DBMessage } from '@/lib/db/schema'
import { ModelMessage, UIMessage } from 'ai'
+import { type Message as DBMessage } from '@/lib/db/schema'
+
// Interface matching the expected DB message input format
interface DatabaseMessageInput {
role: DBMessage['role']