2026-09-23 13:58:43 +03:30
|
|
|
import { Body, Controller, Get, Param, Post, UseGuards } from '@nestjs/common';
|
2026-09-03 14:20:55 +03:30
|
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
|
|
|
import { CurrentUser } from '../auth/current-user.decorator';
|
|
|
|
|
import type { Actor } from '../common/record-scope';
|
|
|
|
|
import { AiAskService } from './ai-ask.service';
|
2026-09-23 15:49:44 +03:30
|
|
|
import { AskMentoDto, VoiceCommandDto } from './dto';
|
2026-09-03 14:20:55 +03:30
|
|
|
import { AiService } from './ai.service';
|
|
|
|
|
|
|
|
|
|
@Controller('ai')
|
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
|
|
|
export class AiController {
|
|
|
|
|
constructor(
|
|
|
|
|
private readonly ai: AiService,
|
|
|
|
|
private readonly ask: AiAskService,
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
@Get('status')
|
|
|
|
|
status() {
|
2026-09-23 13:58:43 +03:30
|
|
|
return { enabled: this.ai.isEnabled() };
|
2026-09-03 14:20:55 +03:30
|
|
|
}
|
|
|
|
|
|
2026-09-23 15:49:44 +03:30
|
|
|
@Post('voice-command')
|
|
|
|
|
voiceCommand(@CurrentUser() user: Actor, @Body() dto: VoiceCommandDto) {
|
|
|
|
|
return this.ask.parseVoiceCommand(user, dto.text);
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-03 14:20:55 +03:30
|
|
|
@Post('ask')
|
|
|
|
|
askMento(@CurrentUser() user: Actor, @Body() dto: AskMentoDto) {
|
|
|
|
|
return this.ask.ask(user, dto.question, dto.personId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('people/:personId/summary')
|
|
|
|
|
personSummary(
|
|
|
|
|
@CurrentUser() user: Actor,
|
|
|
|
|
@Param('personId') personId: string,
|
|
|
|
|
) {
|
|
|
|
|
return this.ask.summarizePerson(user, personId);
|
|
|
|
|
}
|
|
|
|
|
}
|