Skip to content

Commit 33dc8bb

Browse files
committed
fix: correct image path and update base64 image handling in provider info response
1 parent 10c7c44 commit 33dc8bb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/route.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ import { NextResponse } from 'next/server';
22

33
export async function GET(request: Request) {
44
const providerName = process.env.PROVIDER_NAME || 'gpt-4o-mini model';
5-
const picturePath = process.env.PICTURE_PATH || '/public/images/logo.png';
6-
const imageResponse = await fetch(new URL(picturePath, request.url).toString());
7-
if (!imageResponse.ok) {
8-
throw new Error('Failed to fetch the image');
9-
}
5+
const picturePath = process.env.PICTURE_PATH || '/images/logo.png';
6+
const imageResponse = await fetch(new URL(picturePath, request.url));
107
const imageBuffer = await imageResponse.arrayBuffer();
118
const base64Image = `data:${imageResponse.headers.get('content-type')};base64,${Buffer.from(imageBuffer).toString('base64')}`;
129
const providerDescription = process.env.PROVIDER_DESCRIPTION || 'Default provider with gpt-4o-mini model';
1310

1411
const info = {
1512
provider_name: providerName,
16-
base64Image: base64Image,
13+
base64Image: imageResponse,
1714
provider_description: providerDescription
1815
};
1916

0 commit comments

Comments
 (0)