mirror of
https://github.com/stackblitz/bolt.new
synced 2025-03-12 14:58:30 +00:00
Type fixes
This commit is contained in:
parent
6e8aa04d27
commit
fbea474442
@ -343,8 +343,12 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
|
|
||||||
await importChat(data.description, data.messages);
|
await importChat(data.description, data.messages);
|
||||||
toast.success('Chat imported successfully');
|
toast.success('Chat imported successfully');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
|
if(error instanceof Error) {
|
||||||
toast.error('Failed to parse chat file: ' + error.message);
|
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');
|
reader.onerror = () => toast.error('Failed to read chat file');
|
||||||
|
@ -80,6 +80,7 @@ interface ChatProps {
|
|||||||
storeMessageHistory: (messages: Message[]) => Promise<void>;
|
storeMessageHistory: (messages: Message[]) => Promise<void>;
|
||||||
importChat: (description: string, messages: Message[]) => Promise<void>;
|
importChat: (description: string, messages: Message[]) => Promise<void>;
|
||||||
exportChat: () => void;
|
exportChat: () => void;
|
||||||
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ChatImpl = memo(
|
export const ChatImpl = memo(
|
||||||
|
@ -2,7 +2,7 @@ import WithTooltip from '~/components/ui/Tooltip';
|
|||||||
import { IconButton } from '~/components/ui/IconButton';
|
import { IconButton } from '~/components/ui/IconButton';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export const ExportChatButton = ({ exportChat }: { exportChat: () => void }) => {
|
export const ExportChatButton = ({ exportChat }: { exportChat?: () => void }) => {
|
||||||
return (
|
return (
|
||||||
<WithTooltip tooltip="Export Chat">
|
<WithTooltip tooltip="Export Chat">
|
||||||
<IconButton title="Export Chat" onClick={exportChat}>
|
<IconButton title="Export Chat" onClick={exportChat}>
|
||||||
|
@ -131,7 +131,11 @@ export function useChatHistory() {
|
|||||||
window.location.href = `/chat/${newId}`;
|
window.location.href = `/chat/${newId}`;
|
||||||
toast.success('Chat imported successfully');
|
toast.success('Chat imported successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
toast.error('Failed to import chat: ' + error.message);
|
toast.error('Failed to import chat: ' + error.message);
|
||||||
|
} else {
|
||||||
|
toast.error('Failed to import chat');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exportChat: async (id = urlId) => {
|
exportChat: async (id = urlId) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user