Skip to content

Commit 5f5ecb8

Browse files
update mimetype
1 parent 620d017 commit 5f5ecb8

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

apps/web/client/src/components/store/editor/chat/conversation.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,7 @@ export class ConversationManager {
128128
}
129129

130130
async addConversationTitle(conversationId: string, content: string) {
131-
const title = await api.chat.conversation.generateTitle.mutate({
132-
conversationId,
133-
content,
134-
});
131+
const title = "RANDOM TITLE";
135132
if (!title) {
136133
console.error('Error generating conversation title');
137134
return;

apps/web/client/src/server/api/routers/project/project.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,7 @@ export const projectRouter = createTRPCRouter({
5959
const result = await app.scrapeUrl(project.sandboxUrl, {
6060
formats: ['screenshot'],
6161
onlyMainContent: true,
62-
actions: [
63-
{
64-
type: 'screenshot',
65-
fullPage: true,
66-
},
67-
],
62+
timeout: 10000,
6863
});
6964

7065
if (!result.success) {
@@ -85,7 +80,6 @@ export const projectRouter = createTRPCRouter({
8580

8681
const arrayBuffer = await response.arrayBuffer();
8782
const mimeType = response.headers.get('content-type') ?? 'image/png';
88-
const path = getScreenshotPath(project.id, mimeType);
8983

9084
const buffer = Buffer.from(arrayBuffer);
9185

@@ -96,10 +90,16 @@ export const projectRouter = createTRPCRouter({
9690
format: 'jpeg',
9791
});
9892

93+
const useCompressed = !!compressedImage.buffer;
94+
const finalMimeType = useCompressed ? 'image/jpeg' : mimeType;
95+
const finalBuffer = useCompressed ? compressedImage.buffer : buffer;
96+
97+
const path = getScreenshotPath(project.id, finalMimeType);
98+
9999
const { data, error } = await ctx.supabase.storage
100100
.from(STORAGE_BUCKETS.PREVIEW_IMAGES)
101-
.upload(path, compressedImage.buffer ?? buffer, {
102-
contentType: mimeType,
101+
.upload(path, finalBuffer, {
102+
contentType: finalMimeType,
103103
});
104104

105105
if (error) {

0 commit comments

Comments
 (0)