Eduards commited on
Commit
fbea474
·
1 Parent(s): 6e8aa04

Type fixes

Browse files
app/components/chat/BaseChat.tsx CHANGED
@@ -343,8 +343,12 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
343
 
344
  await importChat(data.description, data.messages);
345
  toast.success('Chat imported successfully');
346
- } catch (error) {
347
- toast.error('Failed to parse chat file: ' + error.message);
 
 
 
 
348
  }
349
  };
350
  reader.onerror = () => toast.error('Failed to read chat file');
 
343
 
344
  await importChat(data.description, data.messages);
345
  toast.success('Chat imported successfully');
346
+ } catch (error: unknown) {
347
+ if(error instanceof Error) {
348
+ toast.error('Failed to parse chat file: ' + error.message);
349
+ } else {
350
+ toast.error('Failed to parse chat file');
351
+ }
352
  }
353
  };
354
  reader.onerror = () => toast.error('Failed to read chat file');
app/components/chat/Chat.client.tsx CHANGED
@@ -80,6 +80,7 @@ interface ChatProps {
80
  storeMessageHistory: (messages: Message[]) => Promise<void>;
81
  importChat: (description: string, messages: Message[]) => Promise<void>;
82
  exportChat: () => void;
 
83
  }
84
 
85
  export const ChatImpl = memo(
 
80
  storeMessageHistory: (messages: Message[]) => Promise<void>;
81
  importChat: (description: string, messages: Message[]) => Promise<void>;
82
  exportChat: () => void;
83
+ description?: string;
84
  }
85
 
86
  export const ChatImpl = memo(
app/components/chat/ExportChatButton.tsx CHANGED
@@ -2,7 +2,7 @@ import WithTooltip from '~/components/ui/Tooltip';
2
  import { IconButton } from '~/components/ui/IconButton';
3
  import React from 'react';
4
 
5
- export const ExportChatButton = ({ exportChat }: { exportChat: () => void }) => {
6
  return (
7
  <WithTooltip tooltip="Export Chat">
8
  <IconButton title="Export Chat" onClick={exportChat}>
 
2
  import { IconButton } from '~/components/ui/IconButton';
3
  import React from 'react';
4
 
5
+ export const ExportChatButton = ({ exportChat }: { exportChat?: () => void }) => {
6
  return (
7
  <WithTooltip tooltip="Export Chat">
8
  <IconButton title="Export Chat" onClick={exportChat}>
app/lib/persistence/useChatHistory.ts CHANGED
@@ -131,7 +131,11 @@ export function useChatHistory() {
131
  window.location.href = `/chat/${newId}`;
132
  toast.success('Chat imported successfully');
133
  } catch (error) {
134
- toast.error('Failed to import chat: ' + error.message);
 
 
 
 
135
  }
136
  },
137
  exportChat: async (id = urlId) => {
 
131
  window.location.href = `/chat/${newId}`;
132
  toast.success('Chat imported successfully');
133
  } catch (error) {
134
+ if (error instanceof Error) {
135
+ toast.error('Failed to import chat: ' + error.message);
136
+ } else {
137
+ toast.error('Failed to import chat');
138
+ }
139
  }
140
  },
141
  exportChat: async (id = urlId) => {