浏览代码

Fix:valueERROR when file is optional but not exist value (#9414)

### What problem does this PR solve?

when begin component has optional file but not exist , it rase error

### Type of change

- [x] Bug Fix

Co-authored-by: Popmio <zhengyihao036@gamil.com>
tags/v0.20.2
Popmio 2 个月前
父节点
当前提交
e845d5f9f8
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      agent/component/begin.py

+ 4
- 1
agent/component/begin.py 查看文件

def _invoke(self, **kwargs): def _invoke(self, **kwargs):
for k, v in kwargs.get("inputs", {}).items(): for k, v in kwargs.get("inputs", {}).items():
if isinstance(v, dict) and v.get("type", "").lower().find("file") >=0: if isinstance(v, dict) and v.get("type", "").lower().find("file") >=0:
v = self._canvas.get_files([v["value"]])
if v.get("optional") and v.get("value", None) is None:
v = None
else:
v = self._canvas.get_files([v["value"]])
else: else:
v = v.get("value") v = v.get("value")
self.set_output(k, v) self.set_output(k, v)

正在加载...
取消
保存