@@ -228,10 +228,12 @@ static int eval_message(mtmd_cli_context & ctx, common_chat_msg & msg) {
228228 text.add_special = add_bos;
229229 text.parse_special = true ;
230230
231+ std::string formatted_chat;
232+
231233 if (!mtmd_is_deepseekocr (ctx.ctx_vision .get ())) {
232- auto formatted_chat = chat_add_and_format (ctx, msg);
234+ formatted_chat = chat_add_and_format (ctx, msg);
233235 LOG_DBG (" formatted_chat.prompt: %s\n " , formatted_chat.c_str ());
234- text.text = formatted_chat.c_str ();
236+ text.text = formatted_chat.c_str ();
235237 }
236238
237239 if (g_is_interrupted) return 0 ;
@@ -316,8 +318,18 @@ int main(int argc, char ** argv) {
316318 if (is_single_turn) {
317319 g_is_generating = true ;
318320 if (params.prompt .find (mtmd_default_marker ()) == std::string::npos) {
319- for (size_t i = 0 ; i < params.image .size (); i++) {
320- params.prompt += mtmd_default_marker ();
321+ if (mtmd_is_deepseekocr (ctx.ctx_vision .get ())) {
322+ std::string image_tokens = " " ;
323+ for (size_t i = 0 ; i < params.image .size (); i++) {
324+ image_tokens += mtmd_default_marker ();
325+ image_tokens += ' \n ' ;
326+ }
327+ params.prompt = image_tokens + params.prompt ;
328+ }
329+ else {
330+ for (size_t i = 0 ; i < params.image .size (); i++) {
331+ params.prompt += mtmd_default_marker ();
332+ }
321333 }
322334 }
323335 common_chat_msg msg;
0 commit comments