mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-27 02:44:19 +08:00
feat(chat): 添加批量获取语义解析信息功能
- 在ChatManageService中新增getParseInfos方法用于批量查询 - 实现ChatManageServiceImpl中的getParseInfos具体逻辑 - 优化SqlReplaceHelper中的代码格式化处理 - 支持根据questionId批量获取多个语义解析结果
This commit is contained in:
@@ -52,4 +52,6 @@ public interface ChatManageService {
|
|||||||
List<ChatParseDO> batchAddParse(ChatParseReq chatParseReq, ChatParseResp chatParseResp);
|
List<ChatParseDO> batchAddParse(ChatParseReq chatParseReq, ChatParseResp chatParseResp);
|
||||||
|
|
||||||
SemanticParseInfo getParseInfo(Long questionId, int parseId);
|
SemanticParseInfo getParseInfo(Long questionId, int parseId);
|
||||||
|
|
||||||
|
List<SemanticParseInfo> getParseInfos(Long questionId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,4 +244,13 @@ public class ChatManageServiceImpl implements ChatManageService {
|
|||||||
return JSONObject.parseObject(chatParseDO.getParseInfo(), SemanticParseInfo.class);
|
return JSONObject.parseObject(chatParseDO.getParseInfo(), SemanticParseInfo.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SemanticParseInfo> getParseInfos(Long questionId) {
|
||||||
|
List<ChatParseDO> chatParseDOs =
|
||||||
|
chatQueryRepository.getParseInfoList(Collections.singletonList(questionId));
|
||||||
|
return chatParseDOs.stream().map(chatParseDO -> JSONObject
|
||||||
|
.parseObject(chatParseDO.getParseInfo(), SemanticParseInfo.class))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,8 @@ public class SqlReplaceHelper {
|
|||||||
setOperationList.getSelects().forEach(subSelectBody -> {
|
setOperationList.getSelects().forEach(subSelectBody -> {
|
||||||
if (subSelectBody instanceof PlainSelect) {
|
if (subSelectBody instanceof PlainSelect) {
|
||||||
PlainSelect subPlainSelect = (PlainSelect) subSelectBody;
|
PlainSelect subPlainSelect = (PlainSelect) subSelectBody;
|
||||||
replaceFieldsInPlainOneSelect(fieldNameMap, exactReplace, subPlainSelect);
|
replaceFieldsInPlainOneSelect(fieldNameMap, exactReplace,
|
||||||
|
subPlainSelect);
|
||||||
} else if (subSelectBody instanceof ParenthesedSelect) {
|
} else if (subSelectBody instanceof ParenthesedSelect) {
|
||||||
replaceFieldsInPlainOneSelect(fieldNameMap, exactReplace,
|
replaceFieldsInPlainOneSelect(fieldNameMap, exactReplace,
|
||||||
((ParenthesedSelect) subSelectBody).getPlainSelect());
|
((ParenthesedSelect) subSelectBody).getPlainSelect());
|
||||||
|
|||||||
Reference in New Issue
Block a user