Add chatGPT chat history Import functionality

This commit is contained in:
Brandon Hulston 2024-01-17 01:01:11 -07:00
parent 5e32db1c57
commit 27d5eb4684
3 changed files with 73 additions and 2 deletions

View file

@ -21,7 +21,7 @@
import { WEB_UI_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
import { config, models, settings, user, chats } from '$lib/stores';
import { splitStream, getGravatarURL } from '$lib/utils';
import { splitStream, getGravatarURL, getImportOrigin, convertGptChats } from '$lib/utils';
import Advanced from './Settings/Advanced.svelte';
import Modal from '../common/Modal.svelte';
@ -132,6 +132,9 @@
reader.onload = (event) => {
let chats = JSON.parse(event.target.result);
console.log(chats);
if (getImportOrigin(chats) == 'gpt') {
chats = convertGptChats(chats);
}
importChats(chats);
};