|
@@ -17,8 +17,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.regex.Matcher;
|
|
|
|
|
-import java.util.regex.Pattern;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -449,14 +447,15 @@ public class ChatController {
|
|
|
.data("📚 检索药典知识库...").build());
|
|
.data("📚 检索药典知识库...").build());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String query = request.getMessage() != null ? request.getMessage().trim() : "";
|
|
|
|
|
- if (!query.isEmpty() && !ocrText.isEmpty()) {
|
|
|
|
|
- query = query + "\n\n(" + mediaLabel + "OCR提取内容:" + ocrText + ")";
|
|
|
|
|
|
|
+ String rawQuery = request.getMessage() != null ? request.getMessage().trim() : "";
|
|
|
|
|
+ if (!rawQuery.isEmpty() && !ocrText.isEmpty()) {
|
|
|
|
|
+ rawQuery = rawQuery + "\n\n(" + mediaLabel + "OCR提取内容:" + ocrText + ")";
|
|
|
} else if (!ocrText.isEmpty()) {
|
|
} else if (!ocrText.isEmpty()) {
|
|
|
- query = ocrText;
|
|
|
|
|
- } else if (query.isEmpty()) {
|
|
|
|
|
- query = "请介绍一下自己";
|
|
|
|
|
|
|
+ rawQuery = ocrText;
|
|
|
|
|
+ } else if (rawQuery.isEmpty()) {
|
|
|
|
|
+ rawQuery = "请介绍一下自己";
|
|
|
}
|
|
}
|
|
|
|
|
+ final String query = rawQuery;
|
|
|
|
|
|
|
|
final String intent = retrieverService.classifyIntent(query);
|
|
final String intent = retrieverService.classifyIntent(query);
|
|
|
sink.tryEmitNext(ServerSentEvent.<String>builder().event("intent").data(intent).build());
|
|
sink.tryEmitNext(ServerSentEvent.<String>builder().event("intent").data(intent).build());
|