+
{#if open}
-
+
{:else}
-
+
{/if}
{/if}
-
+
{name}
diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte
index 3e72f0a23e..bbb8c501fa 100644
--- a/src/lib/components/layout/Sidebar.svelte
+++ b/src/lib/components/layout/Sidebar.svelte
@@ -871,14 +871,42 @@
{/if}
+ {#if folders}
+
{
+ showCreateFolderModal = true;
+ }}
+ onAddLabel={$i18n.t('New Folder')}
+ >
+ {
+ selectedFolder.set(null);
+ initChatList();
+ }}
+ on:update={() => {
+ initChatList();
+ }}
+ on:import={(e) => {
+ const { folderId, items } = e.detail;
+ importChatHandler(items, false, folderId);
+ }}
+ on:change={async () => {
+ initChatList();
+ }}
+ />
+
+ {/if}
+
{
- showCreateFolderModal = true;
- }}
- onAddLabel={$i18n.t('New Folder')}
on:change={async (e) => {
selectedFolder.set(null);
await goto('/');
@@ -940,115 +968,89 @@
}
}}
>
- {#if folders || $pinnedChats.length > 0}
+ {#if $pinnedChats.length > 0}
- {#if folders}
-
{
- selectedFolder.set(null);
- initChatList();
- }}
- on:update={() => {
- initChatList();
+
+
{
+ localStorage.setItem('showPinnedChat', e.detail);
+ console.log(e.detail);
}}
on:import={(e) => {
- const { folderId, items } = e.detail;
- importChatHandler(items, false, folderId);
+ importChatHandler(e.detail, true);
}}
- on:change={async () => {
- initChatList();
- }}
- />
- {/if}
+ on:drop={async (e) => {
+ const { type, id, item } = e.detail;
- {#if $pinnedChats.length > 0}
-
-
{
- localStorage.setItem('showPinnedChat', e.detail);
- console.log(e.detail);
- }}
- on:import={(e) => {
- importChatHandler(e.detail, true);
- }}
- on:drop={async (e) => {
- const { type, id, item } = e.detail;
-
- if (type === 'chat') {
- let chat = await getChatById(localStorage.token, id).catch((error) => {
- return null;
- });
- if (!chat && item) {
- chat = await importChat(
- localStorage.token,
- item.chat,
- item?.meta ?? {},
- false,
- null,
- item?.created_at ?? null,
- item?.updated_at ?? null
- );
- }
-
- if (chat) {
- console.log(chat);
- if (chat.folder_id) {
- const res = await updateChatFolderIdById(
- localStorage.token,
- chat.id,
- null
- ).catch((error) => {
- toast.error(`${error}`);
- return null;
- });
- }
-
- if (!chat.pinned) {
- const res = await toggleChatPinnedStatusById(
- localStorage.token,
- chat.id
- );
- }
-
- initChatList();
- }
+ if (type === 'chat') {
+ let chat = await getChatById(localStorage.token, id).catch((error) => {
+ return null;
+ });
+ if (!chat && item) {
+ chat = await importChat(
+ localStorage.token,
+ item.chat,
+ item?.meta ?? {},
+ false,
+ null,
+ item?.created_at ?? null,
+ item?.updated_at ?? null
+ );
}
- }}
- name={$i18n.t('Pinned')}
+
+ if (chat) {
+ console.log(chat);
+ if (chat.folder_id) {
+ const res = await updateChatFolderIdById(
+ localStorage.token,
+ chat.id,
+ null
+ ).catch((error) => {
+ toast.error(`${error}`);
+ return null;
+ });
+ }
+
+ if (!chat.pinned) {
+ const res = await toggleChatPinnedStatusById(localStorage.token, chat.id);
+ }
+
+ initChatList();
+ }
+ }
+ }}
+ name={$i18n.t('Pinned')}
+ >
+
-
- {#each $pinnedChats as chat, idx (`pinned-chat-${chat?.id ?? idx}`)}
- {
- selectedChatId = chat.id;
- }}
- on:unselect={() => {
- selectedChatId = null;
- }}
- on:change={async () => {
- initChatList();
- }}
- on:tag={(e) => {
- const { type, name } = e.detail;
- tagEventHandler(type, name, chat.id);
- }}
- />
- {/each}
-
-
-
- {/if}
+ {#each $pinnedChats as chat, idx (`pinned-chat-${chat?.id ?? idx}`)}
+ {
+ selectedChatId = chat.id;
+ }}
+ on:unselect={() => {
+ selectedChatId = null;
+ }}
+ on:change={async () => {
+ initChatList();
+ }}
+ on:tag={(e) => {
+ const { type, name } = e.detail;
+ tagEventHandler(type, name, chat.id);
+ }}
+ />
+ {/each}
+
+
+
{/if}
diff --git a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte
index a169998f20..2bb9eab791 100644
--- a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte
+++ b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte
@@ -464,7 +464,7 @@
}}
>