|
|
|
@ -10,11 +10,10 @@ from controllers.console import api
|
|
|
|
from controllers.console.workspace import plugin_permission_required
|
|
|
|
from controllers.console.workspace import plugin_permission_required
|
|
|
|
from controllers.console.wraps import account_initialization_required, setup_required
|
|
|
|
from controllers.console.wraps import account_initialization_required, setup_required
|
|
|
|
from core.model_runtime.utils.encoders import jsonable_encoder
|
|
|
|
from core.model_runtime.utils.encoders import jsonable_encoder
|
|
|
|
from core.plugin.entities.parameters import PluginParameterOption
|
|
|
|
|
|
|
|
from core.plugin.impl.exc import PluginDaemonClientSideError
|
|
|
|
from core.plugin.impl.exc import PluginDaemonClientSideError
|
|
|
|
from core.tools.entities.common_entities import I18nObject
|
|
|
|
|
|
|
|
from libs.login import login_required
|
|
|
|
from libs.login import login_required
|
|
|
|
from models.account import TenantPluginPermission
|
|
|
|
from models.account import TenantPluginPermission
|
|
|
|
|
|
|
|
from services.plugin.plugin_parameter_service import PluginParameterService
|
|
|
|
from services.plugin.plugin_permission_service import PluginPermissionService
|
|
|
|
from services.plugin.plugin_permission_service import PluginPermissionService
|
|
|
|
from services.plugin.plugin_service import PluginService
|
|
|
|
from services.plugin.plugin_service import PluginService
|
|
|
|
|
|
|
|
|
|
|
|
@ -506,20 +505,23 @@ class PluginFetchDynamicSelectOptionsApi(Resource):
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
tenant_id = current_user.current_tenant_id
|
|
|
|
tenant_id = current_user.current_tenant_id
|
|
|
|
|
|
|
|
|
|
|
|
return jsonable_encoder(
|
|
|
|
# check if the user is admin or owner
|
|
|
|
{
|
|
|
|
if not current_user.is_admin_or_owner:
|
|
|
|
"options": [
|
|
|
|
raise Forbidden()
|
|
|
|
PluginParameterOption(
|
|
|
|
|
|
|
|
label=I18nObject(
|
|
|
|
parser = reqparse.RequestParser()
|
|
|
|
en_US="test",
|
|
|
|
parser.add_argument("plugin_id", type=str, required=True, location="args")
|
|
|
|
zh_Hans="测试",
|
|
|
|
parser.add_argument("provider", type=str, required=True, location="args")
|
|
|
|
),
|
|
|
|
parser.add_argument("action", type=str, required=True, location="args")
|
|
|
|
value="test",
|
|
|
|
parser.add_argument("parameter", type=str, required=True, location="args")
|
|
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
options = PluginParameterService.get_dynamic_select_options(
|
|
|
|
|
|
|
|
tenant_id, args["plugin_id"], args["provider"], args["action"], args["parameter"]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return jsonable_encoder({"options": options})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api.add_resource(PluginDebuggingKeyApi, "/workspaces/current/plugin/debugging-key")
|
|
|
|
api.add_resource(PluginDebuggingKeyApi, "/workspaces/current/plugin/debugging-key")
|
|
|
|
api.add_resource(PluginListApi, "/workspaces/current/plugin/list")
|
|
|
|
api.add_resource(PluginListApi, "/workspaces/current/plugin/list")
|
|
|
|
|