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

Toolmarketplace #1098

Merged
merged 2 commits into from
Aug 22, 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
4 changes: 2 additions & 2 deletions superagi/controllers/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ 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 @@ -364,4 +364,4 @@ def update_toolkit(toolkit_name: str, organisation: Organisation = Depends(get_u

for tool_config_key in marketplace_toolkit["configs"]:
ToolConfig.add_or_update(db.session, toolkit_id=update_toolkit.id,
key=tool_config_key["key"])
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'])
12 changes: 10 additions & 2 deletions tests/unit_tests/controllers/test_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from superagi.models.organisation import Organisation
from superagi.models.tool import Tool
from superagi.models.tool_config import ToolConfig
from superagi.types.key_type import ToolConfigKeyType
from superagi.models.toolkit import Toolkit

client = TestClient(app)
Expand Down Expand Up @@ -86,11 +87,18 @@ def mock_toolkit_details():
"configs": [
{
"key": "config_key_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