Kevin Hu commited on
Commit
9058e92
·
1 Parent(s): 104ee20

fix re.escape problem (#2735)

Browse files

### What problem does this PR solve?

#2716

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. agent/component/generate.py +1 -1
agent/component/generate.py CHANGED
@@ -112,7 +112,7 @@ class Generate(ComponentBase):
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])[
 
112
 
113
  kwargs["input"] = input
114
  for n, v in kwargs.items():
115
+ prompt = re.sub(r"\{%s\}" % re.escape(n), 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])[