Suppress model-switch warning on empty chat threads
Don't show "Model changed for this chat" toast when the thread has no messages. On a fresh page load with a stale thread from a previous session, this warning is confusing. The warning is only useful mid-conversation to alert about image compatibility with the new model. When messages.length === 0, silently update the thread's modelId and proceed with loading.
This commit is contained in:
parent
f4d54a8de7
commit
042598d9f1
1 changed files with 12 additions and 0 deletions
|
|
@ -352,6 +352,18 @@ export function ChatPage(): ReactElement {
|
|||
.where("threadId")
|
||||
.equals(activeThreadId)
|
||||
.toArray();
|
||||
if (messages.length === 0) {
|
||||
// No history -- just switch silently
|
||||
await db.threads.update(activeThreadId, { modelId: value });
|
||||
await selectModel({
|
||||
id: value,
|
||||
isLora: meta?.isLora,
|
||||
ggufVariant: meta?.ggufVariant,
|
||||
isDownloaded: meta?.isDownloaded,
|
||||
expectedBytes: meta?.expectedBytes,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const hasImage = messages.some(messageHasImage);
|
||||
const targetModel = modelsFromStore.find((model) => model.id === value);
|
||||
const nonVisionWithImages = hasImage && targetModel?.isVision === false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue