File tree Expand file tree Collapse file tree
yechef/src/main/java/sejong/capston/yechef/domain/Recipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import org .springframework .http .client .MultipartBodyBuilder ;
1111import org .springframework .stereotype .Component ;
1212import org .springframework .web .multipart .MultipartFile ;
13+ import org .springframework .web .reactive .function .BodyInserters ;
1314import org .springframework .web .reactive .function .client .WebClient ;
1415import sejong .capston .yechef .domain .Gpt .dto .RecipeParseResultDto ;
1516
@@ -53,7 +54,7 @@ public String getFilename() {
5354 return webClient .post ()
5455 .uri ("/api/ocr" )
5556 .contentType (MediaType .MULTIPART_FORM_DATA )
56- .bodyValue ( builder .build ())
57+ .body ( BodyInserters . fromMultipartData ( builder .build () ))
5758 .retrieve ()
5859 .bodyToMono (new ParameterizedTypeReference <Map <String , List <String >>>() {})
5960 .map (map -> String .join ("\n " , map .getOrDefault ("texts" , List .of ())))
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public ResponseEntity<RecipeDto> createRecipe(
4848// DetailRecipeDto result = recipeService.createRecipeFromImage(memberId, imageFile);
4949// return ResponseEntity.ok(result);
5050// }
51- @ PostMapping ("/ocr/create" )
51+ @ PostMapping (value = "/ocr/create" , consumes = MediaType . MULTIPART_FORM_DATA_VALUE )
5252public ResponseEntity <OcrRecipeResultDto > createRecipeFromImage (
5353 @ RequestParam ("memberId" ) Long memberId ,
5454 @ RequestPart ("image" ) MultipartFile imageFile ) {
You can’t perform that action at this time.
0 commit comments