mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
(improvement)(headless)Improve dataset time query judgment (#1395)
(improvement)(headless)Improve dataset time query judgment The official document describes that if you do not want to add a time limit, please set the time to -1, but it has not taken effect. During LLM parsing, the parameters passed to the model still default to the date parameter. Now change to include the date parameter only when [unit!=-1 '] is checked in the dataset query settings
This commit is contained in:
@@ -81,7 +81,13 @@ public class LLMRequestService {
|
||||
llmSchema.setDomainName(dataSetIdToName.get(dataSetId));
|
||||
|
||||
List<String> fieldNameList = getFieldNameList(queryCtx, dataSetId, llmParserConfig);
|
||||
fieldNameList.add(TimeDimensionEnum.DAY.getChName());
|
||||
if(Objects.nonNull(semanticSchema.getDataSetSchemaMap()) && Objects.nonNull(semanticSchema.getDataSetSchemaMap().get(dataSetId))){
|
||||
TimeDefaultConfig timeDefaultConfig = semanticSchema.getDataSetSchemaMap().get(dataSetId).getTagTypeTimeDefaultConfig();
|
||||
if(!Objects.equals(timeDefaultConfig.getUnit(),-1)){
|
||||
// 数据集查询设置 时间不为-1时才添加 '数据日期' 字段
|
||||
fieldNameList.add(TimeDimensionEnum.DAY.getChName());
|
||||
}
|
||||
}
|
||||
llmSchema.setFieldNameList(fieldNameList);
|
||||
|
||||
llmSchema.setMetrics(getMatchedMetrics(queryCtx, dataSetId));
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class DetailSemanticQuery extends RuleSemanticQuery {
|
||||
chatQueryContext.getSemanticSchema().getDataSetSchemaMap().get(parseInfo.getDataSetId());
|
||||
TimeDefaultConfig timeDefaultConfig = dataSetSchema.getTagTypeTimeDefaultConfig();
|
||||
DateConf dateInfo = new DateConf();
|
||||
if (Objects.nonNull(timeDefaultConfig) && Objects.nonNull(timeDefaultConfig.getUnit())) {
|
||||
if (Objects.nonNull(timeDefaultConfig) && Objects.nonNull(timeDefaultConfig.getUnit()) && timeDefaultConfig.getUnit() != -1) {
|
||||
int unit = timeDefaultConfig.getUnit();
|
||||
String startDate = LocalDate.now().plusDays(-unit).toString();
|
||||
String endDate = startDate;
|
||||
@@ -59,8 +59,8 @@ public abstract class DetailSemanticQuery extends RuleSemanticQuery {
|
||||
dateInfo.setPeriod(timeDefaultConfig.getPeriod());
|
||||
dateInfo.setStartDate(startDate);
|
||||
dateInfo.setEndDate(endDate);
|
||||
parseInfo.setDateInfo(dateInfo);
|
||||
}
|
||||
parseInfo.setDateInfo(dateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ public abstract class MetricSemanticQuery extends RuleSemanticQuery {
|
||||
chatQueryContext.getSemanticSchema().getDataSetSchemaMap().get(parseInfo.getDataSetId());
|
||||
TimeDefaultConfig timeDefaultConfig = dataSetSchema.getMetricTypeTimeDefaultConfig();
|
||||
DateConf dateInfo = new DateConf();
|
||||
if (Objects.nonNull(timeDefaultConfig) && Objects.nonNull(timeDefaultConfig.getUnit())) {
|
||||
//加上时间!=-1 判断
|
||||
if (Objects.nonNull(timeDefaultConfig) && Objects.nonNull(timeDefaultConfig.getUnit()) && timeDefaultConfig.getUnit() != -1) {
|
||||
int unit = timeDefaultConfig.getUnit();
|
||||
String startDate = LocalDate.now().plusDays(-unit).toString();
|
||||
String endDate = startDate;
|
||||
@@ -58,8 +59,9 @@ public abstract class MetricSemanticQuery extends RuleSemanticQuery {
|
||||
dateInfo.setPeriod(timeDefaultConfig.getPeriod());
|
||||
dateInfo.setStartDate(startDate);
|
||||
dateInfo.setEndDate(endDate);
|
||||
// 时间不为-1才设置时间,所以移到这里
|
||||
parseInfo.setDateInfo(dateInfo);
|
||||
}
|
||||
parseInfo.setDateInfo(dateInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user