From 46a61e5aff1774823f5b806fee12d410f2fb05ae Mon Sep 17 00:00:00 2001
From: zhimeng123 <60221886+zhimeng123@users.noreply.github.com>
Date: Tue, 23 Sep 2025 10:16:11 +0800
Subject: [PATCH] Fix: string merge bug about agent TextProcessing. (\m)
(#10211)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
### What problem does this PR solve?
An error occurred while merging strings containing '\m' in the Text
Processing function of the agent.
Convert \ m to m using regular expressions
From my example alone, it doesn't affect the original meaning, it's
still math
### Type of change
- [ √ ] Bug Fix (non-breaking change which fixes an issue)
Co-authored-by: mxc
---
agent/component/string_transform.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/agent/component/string_transform.py b/agent/component/string_transform.py
index 06ab7bf21..83fb5f962 100644
--- a/agent/component/string_transform.py
+++ b/agent/component/string_transform.py
@@ -90,6 +90,8 @@ class StringTransform(Message, ABC):
for k,v in kwargs.items():
if not v:
v = ""
+ k = re.sub(r'\\m', 'm', k)
+ v = re.sub(r'\\m', 'm', v)
script = re.sub(k, v, script)
self.set_output("result", script)