Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cors issues from preview fixed by changing embedder policies #1056

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/components/chat/chatExportAndImport/ImportButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function ImportButtons(importChat: ((description: string, messages: Messa
if (Array.isArray(data.messages)) {
await importChat(data.description || 'Imported Chat', data.messages);
toast.success('Chat imported successfully');

return;
}

Expand Down
37 changes: 21 additions & 16 deletions app/components/settings/data/DataTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ export default function DataTab() {
event.target.value = '';
};

const processChatData = (data: any): Array<{
const processChatData = (
data: any,
): Array<{
id: string;
messages: Message[];
description: string;
Expand All @@ -242,23 +244,25 @@ export default function DataTab() {
// Handle Bolt standard format (single chat)
if (data.messages && Array.isArray(data.messages)) {
const chatId = crypto.randomUUID();
return [{
id: chatId,
messages: data.messages,
description: data.description || 'Imported Chat',
urlId: chatId
}];
return [
{
id: chatId,
messages: data.messages,
description: data.description || 'Imported Chat',
urlId: chatId,
},
];
}

// Handle Bolt export format (multiple chats)
if (data.chats && Array.isArray(data.chats)) {
return data.chats.map((chat: { id?: string; messages: Message[]; description?: string; urlId?: string; }) => ({
id: chat.id || crypto.randomUUID(),
messages: chat.messages,
description: chat.description || 'Imported Chat',
urlId: chat.urlId,
}));
}
// Handle Bolt export format (multiple chats)
if (data.chats && Array.isArray(data.chats)) {
return data.chats.map((chat: { id?: string; messages: Message[]; description?: string; urlId?: string }) => ({
id: chat.id || crypto.randomUUID(),
messages: chat.messages,
description: chat.description || 'Imported Chat',
urlId: chat.urlId,
}));
}

console.error('No matching format found for:', data);
throw new Error('Unsupported chat format');
Expand Down Expand Up @@ -296,6 +300,7 @@ export default function DataTab() {
} else {
toast.error('Failed to import chats');
}

console.error(error);
}
};
Expand Down
1 change: 1 addition & 0 deletions app/lib/webcontainer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (!import.meta.env.SSR) {
Promise.resolve()
.then(() => {
return WebContainer.boot({
coep: 'credentialless',
workdirName: WORK_DIR_NAME,
forwardPreviewErrors: true, // Enable error forwarding from iframes
});
Expand Down
Loading