File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,14 @@ export async function POST(request: NextRequest) {
3737 return { type : "text" , text : content }
3838 } else if (
3939 content ?. type === "image_url" &&
40- content ?. image_url ?. length
40+ content ?. image_url ?. url ?. length
4141 ) {
4242 return {
4343 type : "image" ,
4444 source : {
4545 type : "base64" ,
46- media_type : getMediaTypeFromDataURL ( content . image_url ) ,
47- data : getBase64FromDataURL ( content . image_url )
46+ media_type : getMediaTypeFromDataURL ( content . image_url . url ) ,
47+ data : getBase64FromDataURL ( content . image_url . url )
4848 }
4949 }
5050 } else {
Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ export async function POST(request: Request) {
2828 model : chatSettings . model as ChatCompletionCreateParamsBase [ "model" ] ,
2929 messages : messages as ChatCompletionCreateParamsBase [ "messages" ] ,
3030 temperature : chatSettings . temperature ,
31- max_tokens : chatSettings . model === "gpt-4-vision-preview" ? 4096 : null , // TODO: Fix
31+ max_tokens :
32+ chatSettings . model === "gpt-4-vision-preview" ||
33+ chatSettings . model === "gpt-4o"
34+ ? 4096
35+ : null , // TODO: Fix
3236 stream : true
3337 } )
3438
Original file line number Diff line number Diff line change @@ -144,7 +144,9 @@ export async function buildFinalMessages(
144144
145145 return {
146146 type : "image_url" ,
147- image_url : formedUrl
147+ image_url : {
148+ url : formedUrl
149+ }
148150 }
149151 } )
150152 ]
You can’t perform that action at this time.
0 commit comments