feat: users should be able to switch models mid-thread (#1226)
## Problem Right now users have to start a new thread to use another model which causes a lot of confusion to our users. fixes #1201
This commit is contained in:
parent
150af523e1
commit
a7f186cc5e
@ -72,16 +72,10 @@ export default function DropdownListSidebar() {
|
||||
if (!activeThread) {
|
||||
return null
|
||||
}
|
||||
const finishInit = threadStates[activeThread.id].isFinishInit ?? true
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger className="w-full">
|
||||
<Select
|
||||
disabled={finishInit}
|
||||
value={selected?.id}
|
||||
onValueChange={finishInit ? undefined : onValueSelected}
|
||||
>
|
||||
<>
|
||||
<Select value={selected?.id} onValueChange={onValueSelected}>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Choose model to start">
|
||||
{downloadedModels.filter((x) => x.id === selected?.id)[0]?.name}
|
||||
@ -127,14 +121,6 @@ export default function DropdownListSidebar() {
|
||||
</div>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</TooltipTrigger>
|
||||
|
||||
{finishInit && (
|
||||
<TooltipContent sideOffset={10}>
|
||||
<span>Start a new thread to change the model</span>
|
||||
<TooltipArrow />
|
||||
</TooltipContent>
|
||||
)}
|
||||
|
||||
{selected?.engine === InferenceEngine.openai && (
|
||||
<div className="mt-4">
|
||||
@ -154,6 +140,6 @@ export default function DropdownListSidebar() {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Tooltip>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -138,7 +138,10 @@ export default function useSendChatMessage() {
|
||||
const activeThreadState = threadStates[activeThread.id]
|
||||
|
||||
// if the thread is not initialized, we need to initialize it first
|
||||
if (!activeThreadState.isFinishInit) {
|
||||
if (
|
||||
!activeThreadState.isFinishInit ||
|
||||
activeThread.assistants[0].model.id !== selectedModel?.id
|
||||
) {
|
||||
if (!selectedModel) {
|
||||
toaster({ title: 'Please select a model' })
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user