enh: temp chat

deprecates chat history setting and introduces temp chat from model selector
This commit is contained in:
Timothy J. Baek
2024-08-15 16:54:16 +02:00
parent 723caf2a09
commit dc6ca61548
13 changed files with 99 additions and 843 deletions

View File

@@ -26,7 +26,8 @@
socket,
showCallOverlay,
tools,
currentChatPage
currentChatPage,
temporaryChatEnabled
} from '$lib/stores';
import {
convertMessagesToHistory,
@@ -238,7 +239,7 @@
}
});
} else {
if (!($settings.saveChatHistory ?? true)) {
if ($temporaryChatEnabled) {
await goto('/');
}
}
@@ -414,7 +415,7 @@
}
if ($chatId == chatId) {
if ($settings.saveChatHistory ?? true) {
if (!$temporaryChatEnabled) {
chat = await updateChatById(localStorage.token, chatId, {
models: selectedModels,
messages: messages,
@@ -462,7 +463,7 @@
}
if ($chatId == chatId) {
if ($settings.saveChatHistory ?? true) {
if (!$temporaryChatEnabled) {
chat = await updateChatById(localStorage.token, chatId, {
models: selectedModels,
messages: messages,
@@ -620,7 +621,7 @@
// Create new chat if only one message in messages
if (newChat && messages.length == 2) {
if ($settings.saveChatHistory ?? true) {
if (!$temporaryChatEnabled) {
chat = await createNewChat(localStorage.token, {
id: $chatId,
title: $i18n.t('New Chat'),
@@ -954,7 +955,7 @@
}
if ($chatId == _chatId) {
if ($settings.saveChatHistory ?? true) {
if (!$temporaryChatEnabled) {
chat = await updateChatById(localStorage.token, _chatId, {
messages: messages,
history: history,
@@ -1227,7 +1228,7 @@
}
if ($chatId == _chatId) {
if ($settings.saveChatHistory ?? true) {
if (!$temporaryChatEnabled) {
chat = await updateChatById(localStorage.token, _chatId, {
models: selectedModels,
messages: messages,
@@ -1400,7 +1401,7 @@
title = _title;
}
if ($settings.saveChatHistory ?? true) {
if (!$temporaryChatEnabled) {
chat = await updateChatById(localStorage.token, _chatId, { title: _title });
currentChatPage.set(1);