### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)tags/v0.10.0
| if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval": | if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval": | ||||
| o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1] | o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1] | ||||
| if o is not None: | if o is not None: | ||||
| if not "".join(o["content"]): | |||||
| continue | |||||
| upstream_outs.append(o) | upstream_outs.append(o) | ||||
| continue | continue | ||||
| if u not in self._canvas.get_component(self._id)["upstream"]: continue | if u not in self._canvas.get_component(self._id)["upstream"]: continue |
| def stream_output(self, chat_mdl, prompt, retrieval_res): | def stream_output(self, chat_mdl, prompt, retrieval_res): | ||||
| res = None | res = None | ||||
| if "empty_response" in retrieval_res.columns and "\n- ".join(retrieval_res["content"]): | |||||
| res = {"content": "\n- ".join(retrieval_res["content"]), "reference": []} | |||||
| if "empty_response" in retrieval_res.columns and not "\n- ".join(retrieval_res["content"]): | |||||
| res = {"content": "\n- ".join(retrieval_res["empty_response"]), "reference": []} | |||||
| yield res | yield res | ||||
| self.set_output(res) | self.set_output(res) | ||||
| return | return |
| aggs=False, rerank_mdl=rerank_mdl) | aggs=False, rerank_mdl=rerank_mdl) | ||||
| if not kbinfos["chunks"]: | if not kbinfos["chunks"]: | ||||
| df = Retrieval.be_output(self._param.empty_response) | |||||
| df["empty_response"] = True | |||||
| df = Retrieval.be_output("") | |||||
| df["empty_response"] = self._param.empty_response | |||||
| return df | return df | ||||
| df = pd.DataFrame(kbinfos["chunks"]) | df = pd.DataFrame(kbinfos["chunks"]) |