mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 06:38:59 +08:00
let 'Generate' take user's input as parameter (#3086)
### What problem does this PR solve? #3085 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
3ed096fd3f
commit
f7705d6bc9
@ -260,7 +260,7 @@ class Canvas(ABC):
|
||||
|
||||
def get_history(self, window_size):
|
||||
convs = []
|
||||
for role, obj in self.history[(window_size + 1) * -1:]:
|
||||
for role, obj in self.history[window_size * -1:]:
|
||||
convs.append({"role": role, "content": (obj if role == "user" else
|
||||
'\n'.join([str(s) for s in pd.DataFrame(obj)['content']]))})
|
||||
return convs
|
||||
|
@ -105,6 +105,9 @@ class Generate(ComponentBase):
|
||||
input = (" - "+"\n - ".join([c for c in retrieval_res["content"] if isinstance(c, str)])) if "content" in retrieval_res else ""
|
||||
for para in self._param.parameters:
|
||||
cpn = self._canvas.get_component(para["component_id"])["obj"]
|
||||
if cpn.component_name.lower() == "answer":
|
||||
kwargs[para["key"]] = self._canvas.get_history(1)[0]["content"]
|
||||
continue
|
||||
_, out = cpn.output(allow_partial=False)
|
||||
if "content" not in out.columns:
|
||||
kwargs[para["key"]] = "Nothing"
|
||||
|
Loading…
x
Reference in New Issue
Block a user