An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
feat: redesign search mode selector with toggle UI and hover cards
Yoshiki Miura16291aad6beb
diff --git a/bun.lock b/bun.lockindex 771f44f9..1170efdd 100644--- a/bun.lock+++ b/bun.lock@@ -20,6 +20,7 @@"@radix-ui/react-collapsible": "^1.0.3","@radix-ui/react-dialog": "^1.1.11","@radix-ui/react-dropdown-menu": "^2.1.16",+ "@radix-ui/react-hover-card": "^1.1.15","@radix-ui/react-label": "^2.1.6","@radix-ui/react-popover": "^1.1.5","@radix-ui/react-select": "^2.1.2",@@ -467,6 +468,8 @@"@radix-ui/react-focus-scope": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw=="],+ "@radix-ui/react-hover-card": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-popper": "1.2.8", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-controllable-state": "1.2.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-qgTkjNT1CfKMoP0rcasmlH2r1DAiYicWsDsufxl940sT2wHNEWWv6FMWIQXWhVdmC1d/HYfbhQx60KYyAtKxjg=="],+"@radix-ui/react-id": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg=="],"@radix-ui/react-label": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-YT1GqPSL8kJn20djelMX7/cTRp/Y9w5IZHvfxQTVHrOqa2yMl7i/UfMqKRU5V7mEyKTrUVgJXhNQPVCG8PBLoQ=="],@@ -475,7 +478,7 @@"@radix-ui/react-popover": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.2", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dismissable-layer": "1.1.10", "@radix-ui/react-focus-guards": "1.1.2", "@radix-ui/react-focus-scope": "1.1.7", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-popper": "1.2.7", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.4", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-controllable-state": "1.2.2", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-ODz16+1iIbGUfFEfKx2HTPKizg2MN39uIOV8MXeHnmdd3i/N9Wt7vU46wbHsqA0xoaQyXVcs0KIlBdOA2Y95bw=="],- "@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-IUFAccz1JyKcf/RjB552PlWwxjeCJB8/4KxT7EhBHOJM+mN7LdW+B3kacJXILm32xawcMMjb2i0cIZpo+f9kiQ=="],+ "@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw=="],"@radix-ui/react-portal": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ=="],@@ -2057,18 +2060,28 @@"@radix-ui/react-dropdown-menu/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],+ "@radix-ui/react-hover-card/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],++ "@radix-ui/react-hover-card/@radix-ui/react-dismissable-layer": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-escape-keydown": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg=="],++ "@radix-ui/react-hover-card/@radix-ui/react-presence": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ=="],+"@radix-ui/react-menu/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],"@radix-ui/react-menu/@radix-ui/react-dismissable-layer": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-escape-keydown": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg=="],"@radix-ui/react-menu/@radix-ui/react-focus-guards": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw=="],- "@radix-ui/react-menu/@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw=="],-"@radix-ui/react-menu/@radix-ui/react-presence": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ=="],+ "@radix-ui/react-popover/@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-IUFAccz1JyKcf/RjB552PlWwxjeCJB8/4KxT7EhBHOJM+mN7LdW+B3kacJXILm32xawcMMjb2i0cIZpo+f9kiQ=="],+"@radix-ui/react-roving-focus/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],+ "@radix-ui/react-select/@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-IUFAccz1JyKcf/RjB552PlWwxjeCJB8/4KxT7EhBHOJM+mN7LdW+B3kacJXILm32xawcMMjb2i0cIZpo+f9kiQ=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-IUFAccz1JyKcf/RjB552PlWwxjeCJB8/4KxT7EhBHOJM+mN7LdW+B3kacJXILm32xawcMMjb2i0cIZpo+f9kiQ=="],+"@supabase/auth-ui-react/react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ=="],"@supabase/auth-ui-react/react-dom": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" }, "peerDependencies": { "react": "^18.3.1" } }, "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw=="],diff --git a/components/chat-panel.tsx b/components/chat-panel.tsxindex 6354a710..34edf102 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 { ActionButtons } from './action-buttons'import { useArtifact } from './artifact/artifact-context'+import { Button } from './ui/button'+import { IconLogo } from './ui/icons'+import { ActionButtons } from './action-buttons'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 delaysdiff --git a/components/chat.tsx b/components/chat.tsxindex d1b8e448..f2904832 100644--- a/components/chat.tsx+++ b/components/chat.tsx@@ -64,11 +64,11 @@ export function Chat({const { isAuthenticated } = useAuthCheck()// Get search mode from cookie- const [searchMode, setSearchMode] = useState<SearchMode>('auto')+ const [searchMode, setSearchMode] = useState<SearchMode>('adaptive')useEffect(() => {const savedMode = getCookie('searchMode')- if (savedMode && ['quick', 'planning', 'auto'].includes(savedMode)) {+ if (savedMode && ['quick', 'planning', 'adaptive'].includes(savedMode)) {setSearchMode(savedMode as SearchMode)}}, [])diff --git a/components/search-mode-selector.tsx b/components/search-mode-selector.tsxindex d8b69fa1..41808620 100644--- a/components/search-mode-selector.tsx+++ b/components/search-mode-selector.tsx@@ -1,96 +1,121 @@'use client'-import { useEffect, useState } from 'react'--import { Check, ChevronDown } from 'lucide-react'+import { useEffect, useRef, useState } from 'react'import { SEARCH_MODE_CONFIGS } from '@/lib/config/search-modes'import { SearchMode } from '@/lib/types/search'import { cn } from '@/lib/utils'import { getCookie, setCookie } from '@/lib/utils/cookies'-import { Button } from './ui/button'-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger-} from './ui/dropdown-menu'+import { HoverCard, HoverCardContent, HoverCardTrigger } from './ui/hover-card'export function SearchModeSelector() {- const [value, setValue] = useState<SearchMode>('auto')- const [open, setOpen] = useState(false)+ const [value, setValue] = useState<SearchMode>('adaptive')+ const [indicatorStyle, setIndicatorStyle] = useState<React.CSSProperties>({})+ const [openHoverCard, setOpenHoverCard] = useState<string | null>(null)+ const [justSelected, setJustSelected] = useState(false)+ const buttonsRef = useRef<(HTMLButtonElement | null)[]>([])useEffect(() => {const savedMode = getCookie('searchMode')- if (savedMode && ['quick', 'planning', 'auto'].includes(savedMode)) {+ if (savedMode && ['quick', 'planning', 'adaptive'].includes(savedMode)) {setValue(savedMode as SearchMode)}}, [])+ useEffect(() => {+ // Update indicator position when value changes+ const selectedIndex = SEARCH_MODE_CONFIGS.findIndex(+ config => config.value === value+ )+ const selectedButton = buttonsRef.current[selectedIndex]++ if (selectedButton) {+ const { offsetLeft, offsetWidth } = selectedButton+ setIndicatorStyle({+ transform: `translateX(${offsetLeft}px)`,+ width: `${offsetWidth}px`+ })+ }+ }, [value])+const handleModeSelect = (mode: SearchMode) => {setValue(mode)setCookie('searchMode', mode)- setOpen(false)- }+ setOpenHoverCard(null) // Close hover card on selection+ setJustSelected(true)- const selectedMode = SEARCH_MODE_CONFIGS.find(- config => config.value === value- )- const Icon = selectedMode?.icon+ // Prevent hover card from reopening immediately+ setTimeout(() => {+ setJustSelected(false)+ }, 500)+ }return (- <DropdownMenu open={open} onOpenChange={setOpen}>- <DropdownMenuTrigger asChild>- <Button- variant="outline"- className="text-sm rounded-full shadow-none gap-1 transition-all !ring-0 !outline-none !ring-offset-0 [&:focus]:!ring-0 [&:focus]:!outline-none [&:focus-visible]:!ring-0 [&:focus-visible]:!ring-offset-0"- >- {Icon && (- <Icon- className={cn('h-4 w-4 transition-colors', selectedMode?.color)}- />- )}- <span className="text-xs font-medium">{selectedMode?.label}</span>- <ChevronDown- className={cn(- 'h-3 w-3 ml-1 opacity-50 transition-transform duration-200',- open && 'rotate-180'- )}- />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="start" className="w-72" sideOffset={5}>- {SEARCH_MODE_CONFIGS.map(config => {- const ModeIcon = config.icon+ <div className="relative inline-flex items-center rounded-full bg-background p-1">+ {/* Animated background indicator */}+ <div+ className="absolute inset-y-1 rounded-full bg-muted transition-all duration-200 ease-out"+ style={indicatorStyle}+ />++ {/* Mode buttons */}+ <div className="relative flex items-center">+ {SEARCH_MODE_CONFIGS.map((config, index) => {+ const Icon = config.iconconst isSelected = value === config.value+return (- <DropdownMenuItem+ <HoverCardkey={config.value}- onClick={() => handleModeSelect(config.value)}- className="relative flex flex-col items-start gap-1 py-2 pl-8 pr-2 cursor-pointer focus:outline-none"+ open={!justSelected && openHoverCard === config.value}+ onOpenChange={open => {+ if (!justSelected) {+ setOpenHoverCard(open ? config.value : null)+ }+ }}+ openDelay={100}+ closeDelay={50}>- {isSelected && (- <Check className="absolute left-2 top-2.5 h-4 w-4" />- )}- <div className="flex items-center gap-2">- <ModeIcon- className={cn('h-4 w-4 transition-colors', config.color)}- />- <span className="text-sm font-medium">{config.label}</span>- </div>- <div className="flex flex-col gap-0.5 ml-6">- <span className="text-xs text-muted-foreground">- {config.description}- </span>- <span className="text-xs text-muted-foreground/70">- {config.displayModel}- </span>- </div>- </DropdownMenuItem>+ <HoverCardTrigger asChild>+ <button+ ref={el => {+ buttonsRef.current[index] = el+ }}+ onClick={() => handleModeSelect(config.value)}+ className={cn(+ 'relative z-10 flex items-center justify-center rounded-full px-3 py-2 transition-colors duration-200',+ isSelected+ ? 'text-foreground'+ : 'text-muted-foreground hover:text-foreground/80'+ )}+ aria-label={`${config.label} mode`}+ aria-pressed={isSelected}+ >+ <Icon+ className={cn(+ 'h-3.5 w-3.5 transition-colors',+ isSelected ? config.color : ''+ )}+ />+ </button>+ </HoverCardTrigger>++ <HoverCardContent className="w-72" align="center" sideOffset={8}>+ <div className="space-y-2">+ <div className="flex items-center gap-2">+ <Icon className={cn('h-5 w-5', config.color)} />+ <h4 className="text-sm font-semibold">{config.label}</h4>+ </div>+ <p className="text-xs text-muted-foreground leading-tight">+ {config.description}+ </p>+ </div>+ </HoverCardContent>+ </HoverCard>)})}- </DropdownMenuContent>- </DropdownMenu>+ </div>+ </div>)}diff --git a/components/ui/hover-card.tsx b/components/ui/hover-card.tsxnew file mode 100644index 00000000..b7934c67--- /dev/null+++ b/components/ui/hover-card.tsx@@ -0,0 +1,41 @@+'use client'++import * as React from 'react'++import * as HoverCardPrimitive from '@radix-ui/react-hover-card'++import { cn } from '@/lib/utils'++const HoverCard = HoverCardPrimitive.Root++const HoverCardTrigger = HoverCardPrimitive.Trigger++const HoverCardContent = React.forwardRef<+ React.ElementRef<typeof HoverCardPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>+>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (+ <HoverCardPrimitive.Portal>+ <HoverCardPrimitive.Content+ ref={ref}+ align={align}+ sideOffset={sideOffset}+ className={cn(+ 'z-50 w-64 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',+ 'data-[state=open]:duration-150 data-[state=closed]:duration-100',+ className+ )}+ {...props}+ >+ {props.children}+ <HoverCardPrimitive.Arrow className="fill-popover" />+ </HoverCardPrimitive.Content>+ </HoverCardPrimitive.Portal>+))+HoverCardContent.displayName = HoverCardPrimitive.Content.displayName++export { HoverCard, HoverCardContent, HoverCardTrigger }diff --git a/lib/agents/researcher.ts b/lib/agents/researcher.tsindex 852bfe15..fd24a1a9 100644--- a/lib/agents/researcher.ts+++ b/lib/agents/researcher.ts@@ -51,7 +51,7 @@ export function researcher({abortSignal,writer,parentTraceId,- searchMode = 'auto'+ searchMode = 'adaptive'}: {model: stringmodelConfig?: Model@@ -98,9 +98,9 @@ export function researcher({searchTool = originalSearchToolbreak- case 'auto':+ case 'adaptive':default:- // Auto Mode: Balanced approach, current behavior+ // Adaptive Mode: Balanced approach, current behaviorsystemPrompt = AUTO_MODE_PROMPTactiveToolsList = ['search', 'fetch']if (writer && 'todoWrite' in todoTools) {diff --git a/lib/config/search-modes.ts b/lib/config/search-modes.tsindex 21f9d3b5..c1e51be6 100644--- a/lib/config/search-modes.ts+++ b/lib/config/search-modes.ts@@ -1,4 +1,4 @@-import { ListChecks, Sparkles, Zap } from 'lucide-react'+import { ListChecks, Search, Sparkles } from 'lucide-react'import { Model } from '@/lib/types/models'import { SearchMode } from '@/lib/types/search'@@ -16,15 +16,15 @@ export interface SearchModeConfig {// Centralized search mode configurationexport const SEARCH_MODE_CONFIGS: SearchModeConfig[] = [{- value: 'quick',- label: 'Quick',- description: 'Quick search with instant answers',- icon: Zap,- color: 'text-amber-500',- displayModel: 'MoonshotAI/Kimi K2',+ value: 'adaptive',+ label: 'Adaptive',+ description: 'Automatically adjusts search strategy to match your needs',+ icon: Sparkles,+ color: 'text-violet-500',+ displayModel: 'Auto',actualModel: {- id: 'gpt-5-nano-2025-08-07',- name: 'GPT-5 nano',+ id: 'gpt-5-mini-2025-08-07',+ name: 'GPT-5 mini',provider: 'OpenAI',providerId: 'openai',providerOptions: {@@ -38,7 +38,7 @@ export const SEARCH_MODE_CONFIGS: SearchModeConfig[] = [{value: 'planning',label: 'Planning',- description: 'Thorough search with task planning',+ description: 'Structured multi-step approach for comprehensive research',icon: ListChecks,color: 'text-blue-500',displayModel: 'OpenAI GPT-5',@@ -56,15 +56,15 @@ export const SEARCH_MODE_CONFIGS: SearchModeConfig[] = [}},{- value: 'auto',- label: 'Auto',- description: 'Smart search with adaptive depth',- icon: Sparkles,- color: 'text-violet-500',- displayModel: 'Auto',+ value: 'quick',+ label: 'Quick',+ description: 'Streamlined search for fast, concise responses',+ icon: Search,+ color: 'text-amber-500',+ displayModel: 'MoonshotAI/Kimi K2',actualModel: {- id: 'gpt-5-mini-2025-08-07',- name: 'GPT-5 mini',+ id: 'gpt-5-nano-2025-08-07',+ name: 'GPT-5 nano',provider: 'OpenAI',providerId: 'openai',providerOptions: {diff --git a/lib/types/search.ts b/lib/types/search.tsindex b98f15ff..7dbb2c97 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'+export type SearchMode = 'quick' | 'planning' | 'adaptive'diff --git a/package.json b/package.jsonindex 3b6b3246..8c711afa 100644--- a/package.json+++ b/package.json@@ -33,6 +33,7 @@"@radix-ui/react-collapsible": "^1.0.3","@radix-ui/react-dialog": "^1.1.11","@radix-ui/react-dropdown-menu": "^2.1.16",+ "@radix-ui/react-hover-card": "^1.1.15","@radix-ui/react-label": "^2.1.6","@radix-ui/react-popover": "^1.1.5","@radix-ui/react-select": "^2.1.2",