@@ -60,8 +60,11 @@ public TaskStartRes generateTask(String gameId){
6060 .retrieve ()
6161 .onStatus (httpStatusCode -> httpStatusCode .is4xxClientError () || httpStatusCode .is5xxServerError (
6262 )
63- , clientResponse -> clientResponse .bodyToMono (String .class ).flatMap (error -> Mono .error (
64- new CustomException (LuLuExceptionCode .AI_SERVER_ERROR ))))
63+ , clientResponse -> clientResponse .bodyToMono (String .class ).flatMap (error -> {
64+ log .error ("AI Server Error on Get: \" {}\" , StatusCode: {}, Content: {}" , "/lulu/task/" + gameId , clientResponse .statusCode (), error );
65+ return Mono .error (
66+ new CustomException (LuLuExceptionCode .AI_SERVER_ERROR ));
67+ }))
6568 .bodyToMono (TaskStartRes .class )
6669 .block ();
6770 if (res == null || res .keyword () == null || res .situation () == null ){
@@ -93,8 +96,11 @@ private TaskEvalRes requestEvaluate(String gameId, String imageCaption){
9396 .retrieve ()
9497 .onStatus (httpStatusCode -> httpStatusCode .is4xxClientError () || httpStatusCode .is5xxServerError (
9598 )
96- , clientResponse -> clientResponse .bodyToMono (String .class ).flatMap (error -> Mono .error (
97- new CustomException (LuLuExceptionCode .AI_SERVER_ERROR ))))
99+ , clientResponse -> clientResponse .bodyToMono (String .class ).flatMap (error -> {
100+ log .error ("AI Server Error on Post : \" {}\" , StatusCode: {}, Content: {}" , "/lulu/task/" + gameId , clientResponse .statusCode (), error );
101+ return Mono .error (
102+ new CustomException (LuLuExceptionCode .AI_SERVER_ERROR ));
103+ }))
98104 .bodyToMono (TaskEvalRes .class )
99105 .block ();
100106 if (res == null || res .score () == null || res .feedback () == null || res .gameId () == null )
@@ -114,15 +120,18 @@ private TaskEvalRes requestEvaluate(String gameId, String imageCaption){
114120 * 이미지 캡셔닝
115121 */
116122 public String getImageCaption (String imageUrl ){
117- Map <String , String > body = Map .of ("imageURL " , imageUrl );
123+ Map <String , String > body = Map .of ("image_url " , imageUrl );
118124 return webClient .post ()
119125 .uri (AI_SERVER_BASE_URL + "caption" )
120126 .bodyValue (body )
121127 .retrieve ()
122128 .onStatus (httpStatusCode -> httpStatusCode .is4xxClientError () || httpStatusCode .is5xxServerError (
123129 )
124- , clientResponse -> clientResponse .bodyToMono (String .class ).flatMap (error -> Mono .error (
125- new CustomException (LuLuExceptionCode .AI_SERVER_ERROR ))))
130+ , clientResponse -> clientResponse .bodyToMono (String .class ).flatMap (error -> {
131+ log .error ("AI Server Error on Post : \" {}\" , StatusCode: {}, Content: {}" , "/caption" , clientResponse .statusCode (), error );
132+ return Mono .error (
133+ new CustomException (LuLuExceptionCode .AI_SERVER_ERROR ));
134+ }))
126135 .bodyToMono (String .class )
127136 .block ();
128137 }
0 commit comments