From fa233e0a241462bded36498293b79728a430f2b3 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Mon, 17 Mar 2025 22:03:49 +0800 Subject: [PATCH] fix(variables): `user_message_text` not provided --- pkg/pipeline/preproc/preproc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/pipeline/preproc/preproc.py b/pkg/pipeline/preproc/preproc.py index a69de78e..299aea5e 100644 --- a/pkg/pipeline/preproc/preproc.py +++ b/pkg/pipeline/preproc/preproc.py @@ -60,11 +60,14 @@ class PreProcessor(stage.PipelineStage): content_list = [] + plain_text = "" + for me in query.message_chain: if isinstance(me, platform_message.Plain): content_list.append( llm_entities.ContentElement.from_text(me.text) ) + plain_text += me.text elif isinstance(me, platform_message.Image): if self.ap.provider_cfg.data['enable-vision'] and (self.ap.provider_cfg.data['runner'] != 'local-agent' or query.use_model.vision_supported): if me.base64 is not None: @@ -72,6 +75,8 @@ class PreProcessor(stage.PipelineStage): llm_entities.ContentElement.from_image_base64(me.base64) ) + query.variables['user_message_text'] = plain_text + query.user_message = llm_entities.Message( role='user', content=content_list