fix: preserve dates for chat imports

Co-Authored-By: conql <49243542+conql@users.noreply.github.com>
This commit is contained in:
Timothy Jaeryang Baek
2025-07-02 14:21:36 +04:00
co-authored by conql
parent 3f800c069e
commit 2c6227e4b6
6 changed files with 70 additions and 21 deletions
-3
View File
@@ -55,10 +55,7 @@
import { generateChatCompletion } from '$lib/apis/ollama';
import {
addTagById,
createNewChat,
deleteTagById,
deleteTagsById,
getAllTags,
getChatById,
getChatList,
+13 -6
View File
@@ -6,11 +6,10 @@
import {
archiveAllChats,
createNewChat,
deleteAllChats,
getAllChats,
getAllUserChats,
getChatList
getChatList,
importChat
} from '$lib/apis/chats';
import { getImportOrigin, convertOpenAIChats } from '$lib/utils';
import { onMount, getContext } from 'svelte';
@@ -58,10 +57,18 @@
console.log(chat);
if (chat.chat) {
await createNewChat(localStorage.token, chat.chat);
await importChat(
localStorage.token,
chat.chat,
chat.meta ?? {},
false,
null,
chat?.created_at ?? null,
chat?.updated_at ?? null
);
} else {
await createNewChat(localStorage.token, chat);
}
// Legacy format
await importChat(localStorage.token, chat, {}, false, null);
}
currentChatPage.set(1);