diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index d22d63b..ab67167 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -343,8 +343,12 @@ export const BaseChat = React.forwardRef( await importChat(data.description, data.messages); toast.success('Chat imported successfully'); - } catch (error) { - toast.error('Failed to parse chat file: ' + error.message); + } catch (error: unknown) { + if(error instanceof Error) { + toast.error('Failed to parse chat file: ' + error.message); + } else { + toast.error('Failed to parse chat file'); + } } }; reader.onerror = () => toast.error('Failed to read chat file'); diff --git a/app/components/chat/Chat.client.tsx b/app/components/chat/Chat.client.tsx index 4da0804..9841820 100644 --- a/app/components/chat/Chat.client.tsx +++ b/app/components/chat/Chat.client.tsx @@ -80,6 +80,7 @@ interface ChatProps { storeMessageHistory: (messages: Message[]) => Promise; importChat: (description: string, messages: Message[]) => Promise; exportChat: () => void; + description?: string; } export const ChatImpl = memo( diff --git a/app/components/chat/ExportChatButton.tsx b/app/components/chat/ExportChatButton.tsx index 5ee889a..8972eed 100644 --- a/app/components/chat/ExportChatButton.tsx +++ b/app/components/chat/ExportChatButton.tsx @@ -2,7 +2,7 @@ import WithTooltip from '~/components/ui/Tooltip'; import { IconButton } from '~/components/ui/IconButton'; import React from 'react'; -export const ExportChatButton = ({ exportChat }: { exportChat: () => void }) => { +export const ExportChatButton = ({ exportChat }: { exportChat?: () => void }) => { return ( diff --git a/app/lib/persistence/useChatHistory.ts b/app/lib/persistence/useChatHistory.ts index 779e598..9daa61f 100644 --- a/app/lib/persistence/useChatHistory.ts +++ b/app/lib/persistence/useChatHistory.ts @@ -131,7 +131,11 @@ export function useChatHistory() { window.location.href = `/chat/${newId}`; toast.success('Chat imported successfully'); } catch (error) { - toast.error('Failed to import chat: ' + error.message); + if (error instanceof Error) { + toast.error('Failed to import chat: ' + error.message); + } else { + toast.error('Failed to import chat'); + } } }, exportChat: async (id = urlId) => {