mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
Support limit (#1688)
This commit is contained in:
@@ -31,6 +31,8 @@ public class LLMResponseService {
|
||||
LLMSemanticQuery semanticQuery = QueryManager.createLLMQuery(LLMSqlQuery.QUERY_MODE);
|
||||
SemanticParseInfo parseInfo = semanticQuery.getParseInfo();
|
||||
parseInfo.setDataSet(queryCtx.getSemanticSchema().getDataSet(parseResult.getDataSetId()));
|
||||
parseInfo.setQueryConfig(
|
||||
queryCtx.getSemanticSchema().getQueryConfig(parseResult.getDataSetId()));
|
||||
parseInfo
|
||||
.getElementMatches()
|
||||
.addAll(queryCtx.getMapInfo().getMatchedElements(parseInfo.getDataSetId()));
|
||||
|
||||
@@ -113,6 +113,7 @@ public abstract class RuleSemanticQuery extends BaseSemanticQuery {
|
||||
.collect(Collectors.toSet());
|
||||
Long dataSetId = dataSetIds.iterator().next();
|
||||
parseInfo.setDataSet(semanticSchema.getDataSet(dataSetId));
|
||||
parseInfo.setQueryConfig(semanticSchema.getQueryConfig(dataSetId));
|
||||
Map<Long, List<SchemaElementMatch>> dim2Values = new HashMap<>();
|
||||
Map<Long, List<SchemaElementMatch>> id2Values = new HashMap<>();
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ import java.util.Objects;
|
||||
@Slf4j
|
||||
public abstract class DetailSemanticQuery extends RuleSemanticQuery {
|
||||
|
||||
private static final Long DETAIL_MAX_RESULTS = 500L;
|
||||
|
||||
public DetailSemanticQuery() {
|
||||
super();
|
||||
}
|
||||
@@ -35,7 +33,9 @@ public abstract class DetailSemanticQuery extends RuleSemanticQuery {
|
||||
super.fillParseInfo(chatQueryContext);
|
||||
|
||||
parseInfo.setQueryType(QueryType.DETAIL);
|
||||
parseInfo.setLimit(DETAIL_MAX_RESULTS);
|
||||
if (Objects.isNull(parseInfo.getLimit())) {
|
||||
parseInfo.setLimit(parseInfo.getDetailLimit());
|
||||
}
|
||||
if (!needFillDateConf(chatQueryContext)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ import static com.tencent.supersonic.headless.chat.query.rule.QueryMatchOption.R
|
||||
@Slf4j
|
||||
public abstract class MetricSemanticQuery extends RuleSemanticQuery {
|
||||
|
||||
private static final Long METRIC_MAX_RESULTS = 365L;
|
||||
|
||||
public MetricSemanticQuery() {
|
||||
super();
|
||||
queryMatcher.addOption(METRIC, REQUIRED, AT_LEAST, 1);
|
||||
@@ -36,7 +34,9 @@ public abstract class MetricSemanticQuery extends RuleSemanticQuery {
|
||||
@Override
|
||||
public void fillParseInfo(ChatQueryContext chatQueryContext) {
|
||||
super.fillParseInfo(chatQueryContext);
|
||||
parseInfo.setLimit(METRIC_MAX_RESULTS);
|
||||
if (Objects.isNull(parseInfo.getLimit())) {
|
||||
parseInfo.setLimit(parseInfo.getMetricLimit());
|
||||
}
|
||||
fillDateInfo(chatQueryContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import static com.tencent.supersonic.headless.chat.query.rule.QueryMatchOption.R
|
||||
public class MetricTopNQuery extends MetricSemanticQuery {
|
||||
|
||||
public static final String QUERY_MODE = "METRIC_ORDERBY";
|
||||
private static final Long ORDERBY_MAX_RESULTS = 3L;
|
||||
private static final Pattern INTENT_PATTERN = Pattern.compile("(.*)(最大|最高|最多)(.*)");
|
||||
|
||||
public MetricTopNQuery() {
|
||||
@@ -52,7 +51,6 @@ public class MetricTopNQuery extends MetricSemanticQuery {
|
||||
public void fillParseInfo(ChatQueryContext chatQueryContext) {
|
||||
super.fillParseInfo(chatQueryContext);
|
||||
|
||||
parseInfo.setLimit(ORDERBY_MAX_RESULTS);
|
||||
parseInfo.setScore(parseInfo.getScore() + 2.0);
|
||||
parseInfo.setAggType(AggregateTypeEnum.SUM);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user