From e8f8c2c71189e9074b810cb14376c413a1eadcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Tue, 24 Jun 2025 12:01:37 +0200 Subject: [PATCH] fix assistant prefilling when content is an array --- tools/server/utils.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/server/utils.hpp b/tools/server/utils.hpp index f8fab2c86..13e2a893b 100644 --- a/tools/server/utils.hpp +++ b/tools/server/utils.hpp @@ -779,7 +779,13 @@ static json oaicompat_chat_params_parse( /* Append assistant prefilled message */ if (prefill_assistant_message) { - chat_params.prompt += last_message.content; + if (last_message.content.is_array()) { + for (auto & p : last_message.content) { + chat_params.prompt += p["text"]; + } + } else { + chat_params.prompt += last_message.content; + } } llama_params["chat_format"] = static_cast(chat_params.format);