enhancement: set recommend model to undefined if no model available (#4296)
* enhancement: set recommend model to undefined if not lastUsedModel * chore: update logic
This commit is contained in:
parent
fd45e7e47f
commit
0271774773
@ -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.
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -188,9 +188,8 @@ const ChatInput = () => {
|
||||
</Button>
|
||||
}
|
||||
disabled={
|
||||
!isModelSupportRagAndTools &&
|
||||
activeAssistant?.tools &&
|
||||
activeAssistant?.tools[0]?.enabled
|
||||
!isModelSupportRagAndTools ||
|
||||
(activeAssistant?.tools && activeAssistant?.tools[0]?.enabled)
|
||||
}
|
||||
content={
|
||||
<>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user