From b8490dc7996a27d66180a20d2416a06222a3b519 Mon Sep 17 00:00:00 2001 From: Sean Sundberg Date: Mon, 6 Nov 2023 12:00:03 -0600 Subject: [PATCH] Change findRelevantPassages api to POST (#136) Signed-off-by: Sean Sundberg --- .../data-extraction.controller.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/controllers/data-extraction/data-extraction.controller.ts b/src/controllers/data-extraction/data-extraction.controller.ts index 856fca3..3ed3ffa 100644 --- a/src/controllers/data-extraction/data-extraction.controller.ts +++ b/src/controllers/data-extraction/data-extraction.controller.ts @@ -1,7 +1,14 @@ -import {Controller, Get, Post, Query} from "@nestjs/common"; +import {Body, Controller, Get, Post, Query} from "@nestjs/common"; +import {ApiProperty, ApiTags} from "@nestjs/swagger"; -import {DataExtractionApi} from "../../services/data-extraction"; -import {ApiTags} from "@nestjs/swagger"; +import {DataExtractionApi} from "../../services"; + +class FindPassagesInput { + @ApiProperty() + question: string; + @ApiProperty() + passages: string[] = [] +} @ApiTags('data-extraction') @Controller('data-extraction') @@ -38,13 +45,10 @@ export class DataExtractionController { .catch(err => console.error(err)) } - @Get('findRelevantPassages') + @Post('findRelevantPassages') async findRelevantPassages( - @Query('question') question: string, - @Query('passages') passages: string[] = [] + @Body() input: FindPassagesInput ): Promise { - const passageVals = Array.isArray(passages) ? passages : [passages] - - return this.service.findRelevantPassages(question, passageVals) + return this.service.findRelevantPassages(input.question, input.passages) } }