File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,15 @@ import { NextResponse } from 'next/server';
22
33export 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
You can’t perform that action at this time.
0 commit comments