@@ -84,6 +84,14 @@ std::string gen_tool_call_id() {
8484 return random_string ();
8585}
8686
87+ static std::string media_marker = " " ;
88+ const char * get_media_marker () {
89+ if (media_marker.empty ()) {
90+ media_marker = " <__media_" + random_string () + " __>" ;
91+ }
92+ return media_marker.c_str ();
93+ }
94+
8795//
8896// lora utils
8997//
@@ -975,7 +983,7 @@ json oaicompat_chat_params_parse(
975983 handle_media (out_files, image_url, opt.media_path );
976984
977985 p[" type" ] = " media_marker" ;
978- p[" text" ] = mtmd_default_marker ();
986+ p[" text" ] = get_media_marker ();
979987 p.erase (" image_url" );
980988
981989 } else if (type == " input_audio" ) {
@@ -996,7 +1004,7 @@ json oaicompat_chat_params_parse(
9961004 // TODO: add audio_url support by reusing handle_media()
9971005
9981006 p[" type" ] = " media_marker" ;
999- p[" text" ] = mtmd_default_marker ();
1007+ p[" text" ] = get_media_marker ();
10001008 p.erase (" input_audio" );
10011009
10021010 } else if (type != " text" ) {
@@ -1460,7 +1468,7 @@ json convert_transcriptions_to_chatcmpl(
14601468 if (!language.empty ()) {
14611469 prompt += string_format (" (language: %s)" , language.c_str ());
14621470 }
1463- prompt += mtmd_default_marker ();
1471+ prompt += get_media_marker ();
14641472
14651473 json chatcmpl_body = inp_body; // copy all fields
14661474 chatcmpl_body[" messages" ] = json::array ({
0 commit comments