diff --git a/web/hooks/useCreateNewThread.ts b/web/hooks/useCreateNewThread.ts index c85a7fe65d..944b446545 100644 --- a/web/hooks/useCreateNewThread.ts +++ b/web/hooks/useCreateNewThread.ts @@ -23,6 +23,7 @@ import { isLocalEngine } from '@/utils/modelEngine' import { useActiveModel } from './useActiveModel' +import useRecommendedModel from './useRecommendedModel' import useSetActiveThread from './useSetActiveThread' import { extensionManager } from '@/extension' @@ -73,6 +74,8 @@ export const useCreateNewThread = () => { const threads = useAtomValue(threadsAtom) const { stopInference } = useActiveModel() + const { recommendedModel } = useRecommendedModel() + const requestCreateNewThread = async ( assistant: (ThreadAssistantInfo & { id: string; name: string }) | Assistant, model?: Model | undefined @@ -81,7 +84,7 @@ export const useCreateNewThread = () => { setIsGeneratingResponse(false) stopInference() - const defaultModel = model + const defaultModel = model || recommendedModel if (!model) { // if we have model, which means user wants to create new thread from Model hub. Allow them. diff --git a/web/hooks/useRecommendedModel.ts b/web/hooks/useRecommendedModel.ts index e1702701bb..03bcc4a30c 100644 --- a/web/hooks/useRecommendedModel.ts +++ b/web/hooks/useRecommendedModel.ts @@ -67,6 +67,7 @@ export default function useRecommendedModel() { if (models.length === 0) { // if we have no downloaded models, then can't recommend anything console.debug("No downloaded models, can't recommend anything") + setRecommendedModel(undefined) return } diff --git a/web/screens/Thread/ThreadCenterPanel/ChatInput/index.tsx b/web/screens/Thread/ThreadCenterPanel/ChatInput/index.tsx index 241e8bcc72..1981964845 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatInput/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatInput/index.tsx @@ -188,9 +188,8 @@ const ChatInput = () => { } disabled={ - !isModelSupportRagAndTools && - activeAssistant?.tools && - activeAssistant?.tools[0]?.enabled + !isModelSupportRagAndTools || + (activeAssistant?.tools && activeAssistant?.tools[0]?.enabled) } content={ <>