agent-test.controller.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { Controller, Get, Query, Post, Body } from '@nestjs/common'
  2. import { ApiOperation, ApiTags } from '@nestjs/swagger'
  3. import {
  4. CreateTestTaskDto,
  5. GetTestTaskListDto,
  6. StopTestTaskDto,
  7. ResumeTestTaskDto,
  8. GetTestTaskConversationsDto
  9. } from '@/dto/agent-test'
  10. import { AgentTestService } from './service/agent-test.service'
  11. @ApiTags('agent-test')
  12. @Controller('agent-test')
  13. export class AgentTestController {
  14. constructor(private readonly agentTestService: AgentTestService) {}
  15. @Post('create-test-task')
  16. @ApiOperation({ summary: '创建测试任务' })
  17. async createTestTask(@Body() body: CreateTestTaskDto) {
  18. return this.agentTestService.createTestTask(body)
  19. }
  20. @Get('get-evaluate-type')
  21. @ApiOperation({ summary: '获取评估类型' })
  22. async getEvaluateType() {
  23. return this.agentTestService.getEvaluateType()
  24. }
  25. @Get('get-test-task-list')
  26. @ApiOperation({ summary: '获取测试任务列表' })
  27. async getTestTaskList(@Query() query: GetTestTaskListDto) {
  28. return this.agentTestService.getTestTaskList(query)
  29. }
  30. @Post('stop-test-task')
  31. @ApiOperation({ summary: '停止测试任务' })
  32. async stopTestTask(@Body() body: StopTestTaskDto) {
  33. return this.agentTestService.stopTestTask(body)
  34. }
  35. @Post('resume-test-task')
  36. @ApiOperation({ summary: '恢复测试任务' })
  37. async resumeTestTask(@Body() body: ResumeTestTaskDto) {
  38. return this.agentTestService.resumeTestTask(body)
  39. }
  40. @Get('get-test-task-conversations')
  41. @ApiOperation({ summary: '获取测试任务会话列表' })
  42. async getTestTaskConversations(@Query() query: GetTestTaskConversationsDto) {
  43. return this.agentTestService.getTestTaskConversations(query)
  44. }
  45. }