import { Body, Controller, Get, Headers, Inject, Post, Query } from '@nestjs/common'; import { ok } from '../common/api-response.js'; import { actorFromHeaders } from '../common/auth-context.js'; import { ChatAskInput, ChatService } from './chat.service.js'; @Controller('api/v1/chat') export class ChatController { constructor(@Inject(ChatService) private readonly svc: ChatService) {} @Post('ask') ask(@Headers() headers: Record, @Body() body: ChatAskInput) { return ok(this.svc.ask(body, actorFromHeaders(headers))); } @Get('audit/verify') verifyAudit() { return ok(this.svc.verifyAudit()); } @Get('replay') replay(@Query('chatId') chatId?: string, @Query('turnId') turnId?: string, @Query('tenant') tenant?: string) { return ok(this.svc.replay(chatId || '', turnId || '', tenant || '')); } @Get('actions') actions(@Headers() headers: Record) { return ok(this.svc.listActions(actorFromHeaders(headers))); } @Get('agents') agents(@Headers() headers: Record) { return ok(this.svc.listAgents(actorFromHeaders(headers))); } }