@@ -24,7 +24,7 @@ public class AIClassifierClient {
2424 private final ObjectMapper objectMapper = new ObjectMapper ();
2525
2626 public Mono <String > classify (String title , String body ) {
27- String shortBody = (body == null || body .isBlank ()) ? "(no description provided) " : body ;
27+ String shortBody = (body == null || body .isBlank ()) ? "" : body ;
2828 shortBody = shortBody .replaceAll ("(?s)```.*?```" , "" );
2929
3030 long start = System .currentTimeMillis ();
@@ -81,7 +81,7 @@ public Mono<String> classifyBatch(List<String[]> titleBodyList) {
8181 .map (pair -> Map .of (
8282 "title" , pair [0 ],
8383 "body" , (pair [1 ] == null || pair [1 ].isBlank ())
84- ? "(no description provided) "
84+ ? ""
8585 : pair [1 ].replaceAll ("(?s)```.*?```" , "" )
8686 ))
8787 .toList ();
@@ -107,7 +107,7 @@ public Mono<String> classifyBatch(List<String[]> titleBodyList) {
107107 .retrieve ()
108108 .bodyToMono (String .class )
109109 .timeout (Duration .ofSeconds (30 ))
110- .doOnSuccess (result -> {
110+ .doOnSuccess ( result -> {
111111 long end = System .currentTimeMillis ();
112112 log .info ("[AI Batch API 호출 + 응답 수신 시간] {}ms" , (end - start ));
113113 })
@@ -128,4 +128,17 @@ public Mono<String> classifyBatch(List<String[]> titleBodyList) {
128128 return Mono .just ("{\" results\" : []}" );
129129 });
130130 }
131+ /**
132+ * 단건 기본값: difficulty="misc" 하나를 리턴
133+ */
134+ public Mono <String > defaultSingleResult () {
135+ return Mono .just ("{\" results\" :[{\" difficulty\" :\" misc\" ,\" score\" :0.0}]}" );
136+ }
137+
138+ /**
139+ * 배치 기본값: 빈 리스트
140+ */
141+ public Mono <String > defaultBatchResult () {
142+ return Mono .just ("{\" results\" :[]}" );
143+ }
131144}
0 commit comments