Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
luciferlinx101 committed Jul 6, 2023
1 parent 2521cf5 commit 4fa764c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
16 changes: 15 additions & 1 deletion superagi/helper/tool_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 269,18 @@ def add_tool_to_json(repo_link):

# Write the updated JSON object back to tools.json
with open('tools.json', 'w') as file:
json.dump(tools_data, file, indent=2)
json.dump(tools_data, file, indent=2)


def handle_tools_import():
print("_______________________EXECUTOR.py")
# folder_path = "superagi/tools"
folder_path = get_config("TOOLS_DIR")
if folder_path is None:
folder_path = "superagi/tools"
for folder_name in os.listdir(folder_path):
folder_dir = os.path.join(folder_path, folder_name)
if os.path.isdir(folder_dir):
sys.path.append(folder_dir)
for path in sys.path:
print(path)
2 changes: 2 additions & 0 deletions superagi/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 2,7 @@

from sqlalchemy.orm import sessionmaker

from superagi.helper.tool_helper import handle_tools_import
from superagi.lib.logger import logger

from celery import Celery
Expand All @@ -22,6 23,7 @@
def execute_agent(agent_execution_id: int, time):
"""Execute an agent step in background."""
from superagi.jobs.agent_executor import AgentExecutor
handle_tools_import()
logger.info("Execute agent:" str(time) "," str(agent_execution_id))
AgentExecutor().execute_next_action(agent_execution_id=agent_execution_id)

Expand Down
1 change: 1 addition & 0 deletions tools.json
Original file line number Diff line number Diff line change
@@ -1,4 1,5 @@
{
"tools": {
"DuckDuckGoTool": "https://github.com/luciferlinx101/DuckDuckGoTool"
}
}

0 comments on commit 4fa764c

Please sign in to comment.