Skip to content

Commit 664b618

Browse files
committed
feat: enhance import functionality to accept tool name parameter in shared_tool.py
1 parent 6eb3aa8 commit 664b618

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/tools/serializers/tool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def insert(self, instance, with_valid=True):
411411
'user_id': self.data.get('user_id'),
412412
'workspace_id': self.data.get('workspace_id'),
413413
'folder_id': str(instance.get('folder_id', self.data.get('workspace_id'))),
414-
}).import_()
414+
}).import_(name=instance.get('name'))
415415

416416
try:
417417
requests.get(template_instance.get('downloadCallbackUrl'), timeout=5)
@@ -827,7 +827,7 @@ def import_workflow_tools(self, tool, workspace_id, user_id):
827827
}).auth_resource_batch([t.id for t in tool_model_list])
828828

829829
@transaction.atomic
830-
def import_(self, scope=ToolScope.WORKSPACE):
830+
def import_(self, scope=ToolScope.WORKSPACE, name=None):
831831
self.is_valid()
832832

833833
user_id = self.data.get('user_id')
@@ -856,7 +856,7 @@ def import_(self, scope=ToolScope.WORKSPACE):
856856
code = skill_file_id
857857
tool_model = Tool(
858858
id=tool_id,
859-
name=tool.get('name'),
859+
name=name or tool.get('name'),
860860
desc=tool.get('desc'),
861861
code=code,
862862
user_id=user_id,

0 commit comments

Comments
 (0)