From ad19f21598bfe2e26b4aae6318cd85cd89cda5aa Mon Sep 17 00:00:00 2001 From: megemini Date: Sun, 22 Feb 2026 14:15:56 +0800 Subject: [PATCH] fix: llama-server image placeholder issue for paddleocrvl --- common/chat.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/chat.cpp b/common/chat.cpp index 8a57e66cceb..988c5fe03d5 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -669,6 +669,12 @@ common_chat_templates_ptr common_chat_templates_init( "{%- if false %}"); } + // TODO @megemini : this is a temporary fix for PaddleOCR image placeholder + if (default_template_src.find("<|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>") != std::string::npos) { + string_replace_all(default_template_src, "image", "media_marker"); + string_replace_all(default_template_src, "\"<|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>\"", "content[\"text\"]"); + } + std::string token_bos = bos_token_override; std::string token_eos = eos_token_override; bool add_bos = false;