Skip to content

An AI-powered search engine with a generative UI

chore: format code and fix line endings

Yoshiki Miuraf54e827ecaed
diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts
index e2fcef5b..016e7f0e 100644
--- a/app/api/chat/route.ts
+++ b/app/api/chat/route.ts
@@ -66,7 +66,7 @@ export async function POST(req: Request) {
}
const cookieStore = await cookies()
-
+
// Select the appropriate model based on configuration and user preferences
const selectedModel = selectModel({
cookieStore,
diff --git a/app/globals.css b/app/globals.css
index 191bfe50..cb0959d9 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -297,7 +297,11 @@
@keyframes enter {
from {
opacity: var(--enter-opacity, 1);
- transform: translate(var(--enter-translate-x, 0), var(--enter-translate-y, 0)) scale(var(--enter-scale, 1));
+ transform: translate(
+ var(--enter-translate-x, 0),
+ var(--enter-translate-y, 0)
+ )
+ scale(var(--enter-scale, 1));
}
to {
opacity: 1;
@@ -312,7 +316,8 @@
}
to {
opacity: var(--exit-opacity, 1);
- transform: translate(var(--exit-translate-x, 0), var(--exit-translate-y, 0)) scale(var(--exit-scale, 1));
+ transform: translate(var(--exit-translate-x, 0), var(--exit-translate-y, 0))
+ scale(var(--exit-scale, 1));
}
}
diff --git a/components/chat-panel.tsx b/components/chat-panel.tsx
index 8054263f..6354a710 100644
--- a/components/chat-panel.tsx
+++ b/components/chat-panel.tsx
@@ -1,8 +1,8 @@
'use client'
+import { useRouter } from 'next/navigation'
import { useCallback, useEffect, useRef, useState } from 'react'
import Textarea from 'react-textarea-autosize'
-import { useRouter } from 'next/navigation'
import { UseChatHelpers } from '@ai-sdk/react'
import { ArrowUp, ChevronDown, MessageCirclePlus, Square } from 'lucide-react'
@@ -13,13 +13,13 @@ import type { UIDataTypes, UIMessage, UITools } from '@/lib/types/ai'
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 { ActionButtons } from './action-buttons'
+import { useArtifact } from './artifact/artifact-context'
import { FileUploadButton } from './file-upload-button'
import { ModelSelector } from './model-selector'
import { SearchModeSelector } from './search-mode-selector'
+import { Button } from './ui/button'
+import { IconLogo } from './ui/icons'
import { UploadedFileList } from './uploaded-file-list'
// Constants for timing delays
@@ -271,7 +271,6 @@ export function ChatPanel({
<Button
type={isLoading ? 'button' : 'submit'}
size={'icon'}
- variant={'outline'}
className={cn(isLoading && 'animate-pulse', 'rounded-full')}
disabled={
(input.length === 0 && !isLoading) ||
diff --git a/components/chat.tsx b/components/chat.tsx
index 17b7d6f2..d1b8e448 100644
--- a/components/chat.tsx
+++ b/components/chat.tsx
@@ -65,7 +65,7 @@ export function Chat({
// Get search mode from cookie
const [searchMode, setSearchMode] = useState<SearchMode>('auto')
-
+
useEffect(() => {
const savedMode = getCookie('searchMode')
if (savedMode && ['quick', 'planning', 'auto'].includes(savedMode)) {
diff --git a/components/search-mode-selector.tsx b/components/search-mode-selector.tsx
index 27581493..d8b69fa1 100644
--- a/components/search-mode-selector.tsx
+++ b/components/search-mode-selector.tsx
@@ -34,7 +34,9 @@ export function SearchModeSelector() {
setOpen(false)
}
- const selectedMode = SEARCH_MODE_CONFIGS.find(config => config.value === value)
+ const selectedMode = SEARCH_MODE_CONFIGS.find(
+ config => config.value === value
+ )
const Icon = selectedMode?.icon
return (
diff --git a/components/ui/dropdown-menu.tsx b/components/ui/dropdown-menu.tsx
index a79bbf7d..2f050d71 100644
--- a/components/ui/dropdown-menu.tsx
+++ b/components/ui/dropdown-menu.tsx
@@ -1,11 +1,11 @@
-"use client"
+'use client'
-import * as React from "react"
+import * as React from 'react'
-import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
-import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
+import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
+import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react'
-import { cn } from "@/lib/utils/index"
+import { cn } from '@/lib/utils/index'
function DropdownMenu({
...props
@@ -43,7 +43,7 @@ function DropdownMenuContent({
data-slot="dropdown-menu-content"
sideOffset={sideOffset}
className={cn(
- "bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
+ 'bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
className
)}
{...props}
@@ -63,11 +63,11 @@ function DropdownMenuGroup({
function DropdownMenuItem({
className,
inset,
- variant = "default",
+ variant = 'default',
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean
- variant?: "default" | "destructive"
+ variant?: 'default' | 'destructive'
}) {
return (
<DropdownMenuPrimitive.Item
@@ -156,7 +156,7 @@ function DropdownMenuLabel({
data-slot="dropdown-menu-label"
data-inset={inset}
className={cn(
- "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
+ 'px-2 py-1.5 text-sm font-medium data-[inset]:pl-8',
className
)}
{...props}
@@ -171,7 +171,7 @@ function DropdownMenuSeparator({
return (
<DropdownMenuPrimitive.Separator
data-slot="dropdown-menu-separator"
- className={cn("bg-border -mx-1 my-1 h-px", className)}
+ className={cn('bg-border -mx-1 my-1 h-px', className)}
{...props}
/>
)
@@ -180,12 +180,12 @@ function DropdownMenuSeparator({
function DropdownMenuShortcut({
className,
...props
-}: React.ComponentProps<"span">) {
+}: React.ComponentProps<'span'>) {
return (
<span
data-slot="dropdown-menu-shortcut"
className={cn(
- "text-muted-foreground ml-auto text-xs tracking-widest",
+ 'text-muted-foreground ml-auto text-xs tracking-widest',
className
)}
{...props}
@@ -212,7 +212,7 @@ function DropdownMenuSubTrigger({
data-slot="dropdown-menu-sub-trigger"
data-inset={inset}
className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
+ 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8',
className
)}
{...props}
@@ -232,7 +232,7 @@ function DropdownMenuSubContent({
<DropdownMenuPrimitive.SubContent
data-slot="dropdown-menu-sub-content"
className={cn(
- "bg-popover text-popover-foreground 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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
+ 'bg-popover text-popover-foreground 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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
className
)}
{...props}
@@ -256,5 +256,5 @@ export {
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
- DropdownMenuTrigger,
+ DropdownMenuTrigger
}
diff --git a/lib/agents/prompts/search-mode-prompts.ts b/lib/agents/prompts/search-mode-prompts.ts
index 08de9bef..5c3845c2 100644
--- a/lib/agents/prompts/search-mode-prompts.ts
+++ b/lib/agents/prompts/search-mode-prompts.ts
@@ -119,4 +119,4 @@ For complex queries requiring systematic investigation:
- Simple queries (2-3 searches) do NOT need task tracking
- Update task progress after every 2-3 tool calls
- Mark all tasks as completed before finishing your work
-`
\ No newline at end of file
+`
diff --git a/lib/agents/researcher.ts b/lib/agents/researcher.ts
index 790c29bc..852bfe15 100644
--- a/lib/agents/researcher.ts
+++ b/lib/agents/researcher.ts
@@ -22,7 +22,9 @@ import {
} from './prompts/search-mode-prompts'
// Wrapper function to force optimized search for quick mode
-function wrapSearchToolForQuickMode(originalTool: ReturnType<typeof createSearchTool>) {
+function wrapSearchToolForQuickMode(
+ originalTool: ReturnType<typeof createSearchTool>
+) {
return tool({
description: originalTool.description,
inputSchema: originalTool.inputSchema,
@@ -32,10 +34,13 @@ function wrapSearchToolForQuickMode(originalTool: ReturnType<typeof createSearch
if (!executeFunc) {
throw new Error('Search tool execute function is not defined')
}
- return executeFunc({
- ...params,
- type: 'optimized'
- }, context)
+ return executeFunc(
+ {
+ ...params,
+ type: 'optimized'
+ },
+ context
+ )
}
})
}
diff --git a/lib/types/search.ts b/lib/types/search.ts
index 44d2117d..b98f15ff 100644
--- a/lib/types/search.ts
+++ b/lib/types/search.ts
@@ -1,2 +1,2 @@
// Search mode type definition
-export type SearchMode = 'quick' | 'planning' | 'auto'
\ No newline at end of file
+export type SearchMode = 'quick' | 'planning' | 'auto'
diff --git a/lib/utils/model-selection.ts b/lib/utils/model-selection.ts
index 3c28bde9..0deb7330 100644
--- a/lib/utils/model-selection.ts
+++ b/lib/utils/model-selection.ts
@@ -19,11 +19,11 @@ interface ModelSelectionParams {
/**
* Determines which model to use based on the current configuration and user preferences
- *
+ *
* Priority order:
* 1. If model selector is enabled AND user has selected a model -> use selected model
* 2. If search mode is provided in request -> use mode's default model
- * 3. If search mode is in cookie -> use mode's default model
+ * 3. If search mode is in cookie -> use mode's default model
* 4. Otherwise -> use DEFAULT_MODEL
*/
export function selectModel({
@@ -32,9 +32,11 @@ export function selectModel({
showModelSelector = process.env.NEXT_PUBLIC_SHOW_MODEL_SELECTOR === 'true'
}: ModelSelectionParams): Model {
const modelJson = cookieStore.get('selectedModel')?.value
- const searchModeCookie = cookieStore.get('searchMode')?.value as SearchMode | undefined
+ const searchModeCookie = cookieStore.get('searchMode')?.value as
+ | SearchMode
+ | undefined
const SEARCH_MODE_MODELS = getSearchModeModels()
-
+
// Priority 1: Model selector is enabled and user has selected a model
if (showModelSelector && modelJson) {
try {
@@ -43,19 +45,19 @@ export function selectModel({
console.error('Failed to parse selected model:', e)
}
}
-
+
// Priority 2: Search mode from request
if (searchModeFromRequest && searchModeFromRequest in SEARCH_MODE_MODELS) {
return SEARCH_MODE_MODELS[searchModeFromRequest]
}
-
+
// Priority 3: Search mode from cookie
if (searchModeCookie && searchModeCookie in SEARCH_MODE_MODELS) {
return SEARCH_MODE_MODELS[searchModeCookie]
}
-
+
// Priority 4: Default model
return DEFAULT_MODEL
}
-export { DEFAULT_MODEL }
\ No newline at end of file
+export { DEFAULT_MODEL }