diff --git a/backend/src/controllers/api/v1/AiInstanceController.ts b/backend/src/controllers/api/v1/AiInstanceController.ts index 0344dc3..21759d9 100644 --- a/backend/src/controllers/api/v1/AiInstanceController.ts +++ b/backend/src/controllers/api/v1/AiInstanceController.ts @@ -37,6 +37,14 @@ interface AiInstanceVmV1 { messages: ChatMessageVmV1[]; } +interface DiscordOnlineVmV1 { + online: boolean; +} + +interface DiscordReactoToChatVmV1 { + reactToChat: boolean; +} + @Route('api/v1/ai/instances') @Middlewares(isAuthenticatedMiddleware) @Tags('ai') @@ -74,24 +82,24 @@ export class AiInstanceController extends Controller { @Post('{id}/discord/online') @SuccessResponse(200, 'Ok') @Response(404, 'Not found') - async discordOnline(@Path() id: UUID, @Body() body: boolean): Promise { + async discordOnline(@Path() id: UUID, @Body() body: DiscordOnlineVmV1): Promise { const ai = this.service.getInstanceById(id as nodeUUID); if (!ai) { this.setStatus(404); return; } - await ai.discord.setOnline(body); + await ai.discord.setOnline(body.online); } @Post('{id}/discord/reactToChat') @SuccessResponse(200, 'Ok') @Response(404, 'Not found') - async discordReactToChat(@Path() id: UUID, @Body() body: boolean): Promise { + async discordReactToChat(@Path() id: UUID, @Body() body: DiscordReactoToChatVmV1): Promise { const ai = this.service.getInstanceById(id as nodeUUID); if (!ai) { this.setStatus(404); return; } - ai.discord.setReactToChat(body); + ai.discord.setReactToChat(body.reactToChat); } } diff --git a/backend/src/tsoa.gen/routes.ts b/backend/src/tsoa.gen/routes.ts index 7de35aa..1c7d85d 100644 --- a/backend/src/tsoa.gen/routes.ts +++ b/backend/src/tsoa.gen/routes.ts @@ -162,6 +162,22 @@ const models: TsoaRoute.Models = { "additionalProperties": false, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "DiscordOnlineVmV1": { + "dataType": "refObject", + "properties": { + "online": {"dataType":"boolean","required":true}, + }, + "additionalProperties": false, + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "DiscordReactoToChatVmV1": { + "dataType": "refObject", + "properties": { + "reactToChat": {"dataType":"boolean","required":true}, + }, + "additionalProperties": false, + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa }; const templateService = new ExpressTemplateService(models, {"noImplicitAdditionalProperties":"throw-on-extras","bodyCoercion":true}); @@ -857,7 +873,7 @@ export function RegisterRoutes(app: Router) { async function AiInstanceController_discordOnline(request: ExRequest, response: ExResponse, next: any) { const args: Record = { id: {"in":"path","name":"id","required":true,"ref":"UUID"}, - body: {"in":"body","name":"body","required":true,"dataType":"boolean"}, + body: {"in":"body","name":"body","required":true,"ref":"DiscordOnlineVmV1"}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa @@ -893,7 +909,7 @@ export function RegisterRoutes(app: Router) { async function AiInstanceController_discordReactToChat(request: ExRequest, response: ExResponse, next: any) { const args: Record = { id: {"in":"path","name":"id","required":true,"ref":"UUID"}, - body: {"in":"body","name":"body","required":true,"dataType":"boolean"}, + body: {"in":"body","name":"body","required":true,"ref":"DiscordReactoToChatVmV1"}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa diff --git a/frontend/src/components/dashboard/Discord.vue b/frontend/src/components/dashboard/Discord.vue index 3041dfd..65bcd32 100644 --- a/frontend/src/components/dashboard/Discord.vue +++ b/frontend/src/components/dashboard/Discord.vue @@ -1,9 +1,9 @@ diff --git a/swagger.json b/swagger.json index aebd331..62def3f 100644 --- a/swagger.json +++ b/swagger.json @@ -308,6 +308,30 @@ ], "type": "object", "additionalProperties": false + }, + "DiscordOnlineVmV1": { + "properties": { + "online": { + "type": "boolean" + } + }, + "required": [ + "online" + ], + "type": "object", + "additionalProperties": false + }, + "DiscordReactoToChatVmV1": { + "properties": { + "reactToChat": { + "type": "boolean" + } + }, + "required": [ + "reactToChat" + ], + "type": "object", + "additionalProperties": false } }, "securitySchemes": {}