Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolkit configuration fix #1102

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions superagi/controllers/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ def install_toolkit_from_marketplace(toolkit_name: str,
folder_name=tool['folder_name'], class_name=tool['class_name'], file_name=tool['file_name'],
toolkit_id=db_toolkit.id)
for config in toolkit['configs']:
ToolConfig.add_or_update(session=db.session, toolkit_id=db_toolkit.id, key=config['key'], value=config['value'])
ToolConfig.add_or_update(session=db.session, toolkit_id=db_toolkit.id, key=config['key'], value=config['value'], key_type = config['key_type'], is_secret = config['is_secret'], is_required = config['is_required'])

return {"message": "ToolKit installed successfully"}


Expand Down Expand Up @@ -363,5 +364,4 @@ def update_toolkit(toolkit_name: str, organisation: Organisation = Depends(get_u
toolkit_id=update_toolkit.id, description=tool["description"])

for tool_config_key in marketplace_toolkit["configs"]:
ToolConfig.add_or_update(db.session, toolkit_id=update_toolkit.id,
key=tool_config_key["key"])
ToolConfig.add_or_update(db.session, toolkit_id=update_toolkit.id, key=tool_config_key["key"], key_type = tool_config_key['key_type'], is_secret = tool_config_key['is_secret'], is_required = tool_config_key['is_required'])
13 changes: 10 additions & 3 deletions tests/unit_tests/controllers/test_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from fastapi.testclient import TestClient

from superagi.types.key_type import ToolConfigKeyType
from main import app
from superagi.models.organisation import Organisation
from superagi.models.tool import Tool
Expand Down Expand Up @@ -86,11 +86,18 @@ def mock_toolkit_details():
"configs": [
{
"key": "config_key_1",
"value": "config_value_1"
"value": "config_value_1",
"value": "config_value_1",
'key_type': ToolConfigKeyType.STRING,
'is_secret': True,
'is_required': False
},
{
"key": "config_key_2",
"value": "config_value_2"
"value": "config_value_2",
'key_type': ToolConfigKeyType.FILE,
'is_secret': True,
'is_required': False
}
]
}
Expand Down