diff --git a/src/components/MessageInputActions/ChatModelSelector.tsx b/src/components/MessageInputActions/ChatModelSelector.tsx index ddad581..4d75166 100644 --- a/src/components/MessageInputActions/ChatModelSelector.tsx +++ b/src/components/MessageInputActions/ChatModelSelector.tsx @@ -2,15 +2,11 @@ import { Cpu, Loader2, Search } from 'lucide-react'; import { cn } from '@/lib/utils'; -import { - Popover, - PopoverButton, - PopoverPanel, - Transition, -} from '@headlessui/react'; -import { Fragment, useEffect, useMemo, useState } from 'react'; +import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react'; +import { useEffect, useMemo, useState } from 'react'; import { MinimalProvider } from '@/lib/models/types'; import { useChat } from '@/lib/hooks/useChat'; +import { AnimatePresence, motion } from 'motion/react'; const ModelSelector = () => { const [providers, setProviders] = useState([]); @@ -79,119 +75,127 @@ const ModelSelector = () => { return ( - - - - - -
-
-
- - setSearchQuery(e.target.value)} - className="w-full pl-9 pr-3 py-2 bg-light-secondary dark:bg-dark-secondary rounded-lg placeholder:text-sm text-sm text-black dark:text-white placeholder:text-black/40 dark:placeholder:text-white/40 focus:outline-none focus:ring-2 focus:ring-sky-500/20 border border-transparent focus:border-sky-500/30 transition duration-200" - /> -
-
+ {({ open }) => ( + <> + + + + + {open && ( + + +
+
+ + setSearchQuery(e.target.value)} + className="w-full pl-8 pr-3 py-2 bg-light-secondary dark:bg-dark-secondary rounded-lg placeholder:text-xs placeholder:-translate-y-[1.5px] text-xs text-black dark:text-white placeholder:text-black/40 dark:placeholder:text-white/40 focus:outline-none border border-transparent transition duration-200" + /> +
+
-
- {isLoading ? ( -
- -
- ) : filteredProviders.length === 0 ? ( -
- {searchQuery - ? 'No models found' - : 'No chat models configured'} -
- ) : ( -
- {filteredProviders.map((provider, providerIndex) => ( -
-
-

- {provider.name} -

+
+ {isLoading ? ( +
+
- -
- {provider.chatModels.map((model) => ( - + +
+ {provider.chatModels.map((model) => ( + + ))} +
+ + {providerIndex < filteredProviders.length - 1 && ( +
+ )} +
))}
- - {providerIndex < filteredProviders.length - 1 && ( -
- )} -
- ))} -
- )} -
-
- - + )} +
+ + + )} + + + )} ); }; diff --git a/src/components/MessageInputActions/Optimization.tsx b/src/components/MessageInputActions/Optimization.tsx index 1cdded8..7b87e6c 100644 --- a/src/components/MessageInputActions/Optimization.tsx +++ b/src/components/MessageInputActions/Optimization.tsx @@ -8,6 +8,7 @@ import { } from '@headlessui/react'; import { Fragment } from 'react'; import { useChat } from '@/lib/hooks/useChat'; +import { AnimatePresence, motion } from 'motion/react'; const OptimizationModes = [ { @@ -60,40 +61,43 @@ const Optimization = () => { />
- - -
- {OptimizationModes.map((mode, i) => ( - setOptimizationMode(mode.key)} - key={i} - className={cn( - 'p-2 rounded-lg flex flex-col items-start justify-start text-start space-y-1 duration-200 cursor-pointer transition focus:outline-none', - optimizationMode === mode.key - ? 'bg-light-secondary dark:bg-dark-secondary' - : 'hover:bg-light-secondary dark:hover:bg-dark-secondary', - )} - > -
- {mode.icon} -

{mode.title}

-
-

- {mode.description} -

-
- ))} -
-
-
+ + {open && ( + + + {OptimizationModes.map((mode, i) => ( + setOptimizationMode(mode.key)} + key={i} + className={cn( + 'p-2 rounded-lg flex flex-col items-start justify-start text-start space-y-1 duration-200 cursor-pointer transition focus:outline-none', + optimizationMode === mode.key + ? 'bg-light-secondary dark:bg-dark-secondary' + : 'hover:bg-light-secondary dark:hover:bg-dark-secondary', + )} + > +
+ {mode.icon} +

{mode.title}

+
+

+ {mode.description} +

+
+ ))} +
+
+ )} +
)}