diff --git a/components/model-selector.tsx b/components/model-selector.tsx index cf0fee492..8ec95158d 100644 --- a/components/model-selector.tsx +++ b/components/model-selector.tsx @@ -2,7 +2,7 @@ import { User } from 'next-auth'; import { startTransition, useMemo, useOptimistic, useState } from 'react'; - +import { toast } from 'sonner'; import { saveChatModelAsCookie } from '@/app/(chat)/actions'; import { Button } from '@/components/ui/button'; import { @@ -55,6 +55,11 @@ export function ModelSelector({ { + if (chatModel.requiresAuth && !user) { + toast.error('Please login to use this model!'); + return; + } + setOpen(false); startTransition(() => { @@ -66,10 +71,17 @@ export function ModelSelector({ data-active={id === optimisticModelId} >
-
{chatModel.name}
+
+
{chatModel.name}
+ + {chatModel.requiresAuth && !user && ( +
+ Login +
+ )} +
{chatModel.description} - {chatModel.requiresAuth && !user && ' (login to continue)'}
diff --git a/lib/ai/models.ts b/lib/ai/models.ts index 655966c51..b6bcbc605 100644 --- a/lib/ai/models.ts +++ b/lib/ai/models.ts @@ -49,6 +49,6 @@ export const chatModels: Array = [ id: 'chat-model-reasoning', name: 'Reasoning model', description: 'Uses advanced reasoning', - requiresAuth: true, + requiresAuth: false, }, ];