Kevin Hu
commited on
Commit
·
06bd4d8
1
Parent(s):
d66c623
make variables access robuster (#3406)
Browse files### What problem does this PR solve?
### Type of change
- [x] Performance Improvement
- agent/component/base.py +1 -1
- agent/component/generate.py +1 -1
agent/component/base.py
CHANGED
@@ -399,7 +399,7 @@ class ComponentBase(ABC):
|
|
399 |
self._param.check()
|
400 |
|
401 |
def get_dependent_components(self):
|
402 |
-
cpnts = [para["component_id"] for para in self._param.query if para["component_id"].lower().find("answer") < 0]
|
403 |
return cpnts
|
404 |
|
405 |
def run(self, history, **kwargs):
|
|
|
399 |
self._param.check()
|
400 |
|
401 |
def get_dependent_components(self):
|
402 |
+
cpnts = [para["component_id"] for para in self._param.query if para.get("component_id") and para["component_id"].lower().find("answer") < 0]
|
403 |
return cpnts
|
404 |
|
405 |
def run(self, history, **kwargs):
|
agent/component/generate.py
CHANGED
@@ -63,7 +63,7 @@ class Generate(ComponentBase):
|
|
63 |
component_name = "Generate"
|
64 |
|
65 |
def get_dependent_components(self):
|
66 |
-
cpnts = [para["component_id"] for para in self._param.parameters if para["component_id"].lower().find("answer") < 0]
|
67 |
return cpnts
|
68 |
|
69 |
def set_cite(self, retrieval_res, answer):
|
|
|
63 |
component_name = "Generate"
|
64 |
|
65 |
def get_dependent_components(self):
|
66 |
+
cpnts = [para["component_id"] for para in self._param.parameters if para.get("component_id") and para["component_id"].lower().find("answer") < 0]
|
67 |
return cpnts
|
68 |
|
69 |
def set_cite(self, retrieval_res, answer):
|