refac/fix: temp chat

This commit is contained in:
Timothy Jaeryang Baek
2025-10-01 22:49:25 -05:00
parent af34e414e1
commit 3a601e0fc3
6 changed files with 145 additions and 114 deletions

View File

@@ -2207,8 +2207,8 @@
selectedFolder.set(null);
} else {
_chatId = 'local';
await chatId.set('local');
_chatId = `local:${$socket?.id}`; // Use socket id for temporary chat
await chatId.set(_chatId);
}
await tick();

View File

@@ -248,7 +248,7 @@
</div>
</div>
{#if $temporaryChatEnabled && $chatId === 'local'}
{#if $temporaryChatEnabled && ($chatId ?? '').startsWith('local:')}
<div class=" w-full z-30 text-center">
<div class="text-xs text-gray-500">{$i18n.t('Temporary Chat')}</div>
</div>

View File

@@ -232,7 +232,7 @@
if (chat.id) {
let chatObj = null;
if (chat.id === 'local' || $temporaryChatEnabled) {
if ((chat?.id ?? '').startsWith('local') || $temporaryChatEnabled) {
chatObj = chat;
} else {
chatObj = await getChatById(localStorage.token, chat.id);