Skip to content

Commit

Permalink
Merge branch 'fix/chore-fix' into dev/plugin-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Nov 15, 2024
2 parents 59b7690 + 2cb640d commit 2698b1c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
18 changes: 18 additions & 0 deletions api/controllers/files/plugin_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from flask_restful import Resource, reqparse

from controllers.files import api


class PluginFilePreviewApi(Resource):
def get(self, file_id: str, file_type: str):
parser = reqparse.RequestParser()

parser.add_argument("timestamp", type=str, required=True, location="args")
parser.add_argument("nonce", type=str, required=True, location="args")
parser.add_argument("sign", type=str, required=True, location="args")
parser.add_argument("as_attachment", type=bool, required=False, default=False, location="args")

args = parser.parse_args()


api.add_resource(PluginFilePreviewApi, "/files/<path:file_id>/<path:file_type>/plugin-file-preview")
19 changes: 10 additions & 9 deletions api/core/tools/builtin_tool/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,9 @@ def __init__(self, **data: Any) -> None:
),
)

def _get_builtin_tools(self) -> list[BuiltinTool]:
"""
returns a list of tools that the provider can provide
:return: list of tools
"""
if self.tools:
return self.tools
self._load_tools()

def _load_tools(self):
provider = self.entity.identity.name
tool_path = path.join(path.dirname(path.realpath(__file__)), "providers", provider, "tools")
# get all the yaml files in the tool path
Expand Down Expand Up @@ -86,7 +80,14 @@ def _get_builtin_tools(self) -> list[BuiltinTool]:
)

self.tools = tools
return tools

def _get_builtin_tools(self) -> list[BuiltinTool]:
"""
returns a list of tools that the provider can provide
:return: list of tools
"""
return self.tools

def get_credentials_schema(self) -> list[ProviderConfig]:
"""
Expand Down
1 change: 0 additions & 1 deletion api/core/tools/plugin_tool/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __init__(self, entity: ToolEntity, runtime: ToolRuntime, tenant_id: str) ->
self.tenant_id = tenant_id
self.runtime_parameters = None

@property
def tool_provider_type(self) -> ToolProviderType:
return ToolProviderType.PLUGIN

Expand Down

0 comments on commit 2698b1c

Please sign in to comment.