Skip to content

Commit

Permalink
Merge pull request #912 from garylin2099/v0.7-release
Browse files Browse the repository at this point in the history
fix tool path bug
  • Loading branch information
garylin2099 committed Feb 20, 2024
2 parents 0ea991f + f03a5dd commit c7b197f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metagpt/tools/tool_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import inspect
import os
import re
from collections import defaultdict

import yaml
Expand Down Expand Up @@ -109,7 +108,8 @@ def decorator(cls):
# Get the file path where the function / class is defined and the source code
file_path = inspect.getfile(cls)
if "metagpt" in file_path:
file_path = re.search("metagpt.+", file_path).group(0)
# split to handle ../metagpt/metagpt/tools/... where only metapgt/tools/... is needed
file_path = "metagpt" + file_path.split("metagpt")[-1]
source_code = inspect.getsource(cls)

TOOL_REGISTRY.register_tool(
Expand Down

0 comments on commit c7b197f

Please sign in to comment.