mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
[feature][headless-chat]Introduce ChatApp to support more flexible chat model config.#1739
This commit is contained in:
@@ -64,7 +64,8 @@ public class LLMSqlCorrector extends BaseSemanticCorrector {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatLanguageModel chatLanguageModel = ModelProvider.getChatModel(chatApp.getChatModelConfig());
|
||||
ChatLanguageModel chatLanguageModel =
|
||||
ModelProvider.getChatModel(chatApp.getChatModelConfig());
|
||||
SemanticSqlExtractor extractor =
|
||||
AiServices.create(SemanticSqlExtractor.class, chatLanguageModel);
|
||||
Prompt prompt = generatePrompt(chatQueryContext.getQueryText(), semanticParseInfo,
|
||||
|
||||
@@ -86,7 +86,7 @@ public class FileHandlerImpl implements FileHandler {
|
||||
}
|
||||
|
||||
private PageInfo<DictValueResp> getDictValueRespPagWithKey(String fileName,
|
||||
DictValueReq dictValueReq) {
|
||||
DictValueReq dictValueReq) {
|
||||
PageInfo<DictValueResp> dictValueRespPageInfo = new PageInfo<>();
|
||||
dictValueRespPageInfo.setPageSize(dictValueReq.getPageSize());
|
||||
dictValueRespPageInfo.setPageNum(dictValueReq.getCurrent());
|
||||
@@ -118,11 +118,12 @@ public class FileHandlerImpl implements FileHandler {
|
||||
}
|
||||
|
||||
private PageInfo<DictValueResp> getDictValueRespPagWithoutKey(String fileName,
|
||||
DictValueReq dictValueReq) {
|
||||
DictValueReq dictValueReq) {
|
||||
PageInfo<DictValueResp> dictValueRespPageInfo = new PageInfo<>();
|
||||
String filePath = localFileConfig.getDictDirectoryLatest() + FILE_SPILT + fileName;
|
||||
Long fileLineNum = getFileLineNum(filePath);
|
||||
Integer startLine = Math.max(1, (dictValueReq.getCurrent() - 1) * dictValueReq.getPageSize() + 1);
|
||||
Integer startLine =
|
||||
Math.max(1, (dictValueReq.getCurrent() - 1) * dictValueReq.getPageSize() + 1);
|
||||
Integer endLine = Integer.valueOf(
|
||||
Math.min(dictValueReq.getCurrent() * dictValueReq.getPageSize(), fileLineNum) + "");
|
||||
List<DictValueResp> dictValueRespList = getFileData(filePath, startLine, endLine);
|
||||
|
||||
@@ -59,8 +59,8 @@ public class DictTaskServiceImpl implements DictTaskService {
|
||||
private final DimensionService dimensionService;
|
||||
|
||||
public DictTaskServiceImpl(DictRepository dictRepository, DictUtils dictConverter,
|
||||
DictUtils dictUtils, FileHandler fileHandler, DictWordService dictWordService,
|
||||
DimensionService dimensionService) {
|
||||
DictUtils dictUtils, FileHandler fileHandler, DictWordService dictWordService,
|
||||
DimensionService dimensionService) {
|
||||
this.dictRepository = dictRepository;
|
||||
this.dictConverter = dictConverter;
|
||||
this.dictUtils = dictUtils;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DimensionConverter {
|
||||
}
|
||||
|
||||
public static DimensionResp convert2DimensionResp(DimensionDO dimensionDO,
|
||||
Map<Long, ModelResp> modelRespMap) {
|
||||
Map<Long, ModelResp> modelRespMap) {
|
||||
DimensionResp dimensionResp = new DimensionResp();
|
||||
BeanUtils.copyProperties(dimensionDO, dimensionResp);
|
||||
dimensionResp.setModelName(
|
||||
@@ -123,11 +123,11 @@ public class DimensionConverter {
|
||||
}
|
||||
|
||||
public static List<DimensionResp> filterByDataSet(List<DimensionResp> dimensionResps,
|
||||
DataSetResp dataSetResp) {
|
||||
DataSetResp dataSetResp) {
|
||||
return dimensionResps.stream()
|
||||
.filter(dimensionResp -> dataSetResp.dimensionIds().contains(dimensionResp.getId())
|
||||
|| dataSetResp.getAllIncludeAllModels()
|
||||
.contains(dimensionResp.getModelId()))
|
||||
.contains(dimensionResp.getModelId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user