H
Kevin Hu
commited on
Commit
·
e07a35a
1
Parent(s):
32dd133
Fix bug : bad escape \x at position xxx (line xx, column xx) in agent (#2226)
Browse files### What problem does this PR solve?
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
---------
Co-authored-by: Kevin Hu <[email protected]>
agent/component/generate.py
CHANGED
@@ -112,8 +112,7 @@ class Generate(ComponentBase):
|
|
112 |
|
113 |
kwargs["input"] = input
|
114 |
for n, v in kwargs.items():
|
115 |
-
|
116 |
-
prompt = re.sub(r"\{%s\}" % n, str(v), prompt)
|
117 |
|
118 |
downstreams = self._canvas.get_component(self._id)["downstream"]
|
119 |
if kwargs.get("stream") and len(downstreams) == 1 and self._canvas.get_component(downstreams[0])[
|
|
|
112 |
|
113 |
kwargs["input"] = input
|
114 |
for n, v in kwargs.items():
|
115 |
+
prompt = re.sub(r"\{%s\}" % n, re.escape(str(v)), prompt)
|
|
|
116 |
|
117 |
downstreams = self._canvas.get_component(self._id)["downstream"]
|
118 |
if kwargs.get("stream") and len(downstreams) == 1 and self._canvas.get_component(downstreams[0])[
|