Skip to content

Commit e3d8c31

Browse files
committed
Fix some warnings
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
1 parent dd0143a commit e3d8c31

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

agent/component/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
16+
import logging
1717
import os
1818
import importlib
1919
import inspect
@@ -50,9 +50,10 @@ def _extract_classes_from_module(module: ModuleType) -> None:
5050

5151

5252
def component_class(class_name):
53-
for mdl in ["agent.component", "agent.tools", "rag.flow"]:
53+
for module_name in ["agent.component", "agent.tools", "rag.flow"]:
5454
try:
55-
return getattr(importlib.import_module(mdl), class_name)
56-
except Exception:
55+
return getattr(importlib.import_module(module_name), class_name)
56+
except Exception as e:
57+
logging.warning(f"Can't import module: {module_name}, error: {e}")
5758
pass
5859
assert False, f"Can't import {class_name}"

0 commit comments

Comments
 (0)