@@ -52,7 +52,7 @@ const CHAT_COMPLETION_SCHEMA = z.object({
5252 text : z . string ( ) ,
5353 } ) ,
5454 z . object ( {
55- type : z . literal ( "image " ) ,
55+ type : z . literal ( "image_url " ) ,
5656 image_url : z . object ( {
5757 url : z . string ( ) ,
5858 } ) ,
@@ -257,7 +257,7 @@ class ChatCompletionsHandler {
257257 text : y . text ,
258258 } ;
259259 }
260- if ( y . type === "image " ) {
260+ if ( y . type === "image_url " ) {
261261 let url = y . image_url . url ;
262262 if ( url . startsWith ( "http" ) ) {
263263 const image = await fetch ( y . image_url . url ) ;
@@ -286,6 +286,7 @@ class ChatCompletionsHandler {
286286 } ;
287287 }
288288 }
289+ // NOTE: 目前不支持音频,因为不知道怎么测也不通用
289290 throw new Error ( `not support content type: ${ y . type } ` ) ;
290291 } )
291292 ) ;
@@ -401,6 +402,10 @@ class ChatCompletionsHandler {
401402
402403 private async handleStream ( ) {
403404 const payload = await this . buildGeneratePayload ( ) ;
405+ // writeFileSync(
406+ // "./tmp_payload.json",
407+ // JSON.stringify({ ...payload, id: this.id }, null, 2)
408+ // );
404409 const abortSignal = new AbortController ( ) ;
405410 const result = await payload . gen_model . generateContentStream (
406411 {
0 commit comments