feat: command execution via plugin

This commit is contained in:
Junyan Qin
2025-07-13 10:26:48 +08:00
parent 10a44c70b6
commit 5922be7e15
4 changed files with 72 additions and 27 deletions

View File

@@ -56,3 +56,24 @@ class SystemRouterGroup(group.RouterGroup):
return self.success(
data=await self.ap.tool_mgr.execute_func_call(data['tool_name'], data['tool_parameters'])
)
@self.route('/debug/plugin/action', methods=['POST'], auth_type=group.AuthType.USER_TOKEN)
async def _() -> str:
if not constants.debug_mode:
return self.http_status(403, 403, 'Forbidden')
data = await quart.request.json
class AnoymousAction:
value = 'anonymous_action'
def __init__(self, value: str):
self.value = value
resp = await self.ap.plugin_connector.handler.call_action(
AnoymousAction(data['action']),
data['data'],
timeout=data.get('timeout', 10),
)
return self.success(data=resp)