hotfix
This commit is contained in:
parent
92eab6c634
commit
3f09a4c355
|
@ -1,16 +1,16 @@
|
||||||
import { ChatFolder, Conversation } from "@/types";
|
import { ChatFolder, Conversation } from "@/types";
|
||||||
import { cleanConversationHistory } from "@/utils/app/clean";
|
import { cleanConversationHistory } from "@/utils/app/clean";
|
||||||
import { IconFileImport } from "@tabler/icons-react";
|
import { IconFileImport } from "@tabler/icons-react";
|
||||||
|
import { useTranslation } from "next-i18next";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { SidebarButton } from "./SidebarButton";
|
import { SidebarButton } from "./SidebarButton";
|
||||||
import { useTranslation } from "next-i18next";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onImport: (data: { conversations: Conversation[]; folders: ChatFolder[] }) => void;
|
onImport: (data: { conversations: Conversation[]; folders: ChatFolder[] }) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Import: FC<Props> = ({ onImport }) => {
|
export const Import: FC<Props> = ({ onImport }) => {
|
||||||
const { t} = useTranslation('sidebar')
|
const { t } = useTranslation("sidebar");
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<input
|
<input
|
||||||
|
@ -27,7 +27,7 @@ export const Import: FC<Props> = ({ onImport }) => {
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
let json = JSON.parse(e.target?.result as string);
|
let json = JSON.parse(e.target?.result as string);
|
||||||
|
|
||||||
if (!json.folders) {
|
if (json && !json.folders) {
|
||||||
json = { history: cleanConversationHistory(json), folders: [] };
|
json = { history: cleanConversationHistory(json), folders: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue