(improvement)(chat) Rules and large model queries should be queried using s2sql (#334)

This commit is contained in:
lexluo09
2023-11-07 16:23:31 +08:00
committed by GitHub
parent aa6c658a9a
commit 0365886270
37 changed files with 340 additions and 153 deletions

View File

@@ -3,7 +3,7 @@ package com.tencent.supersonic.chat.api.component;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
import com.tencent.supersonic.chat.api.pojo.response.QueryResult;
import com.tencent.supersonic.semantic.api.model.response.ExplainResp;
import com.tencent.supersonic.chat.api.pojo.response.SqlInfo;
import org.apache.calcite.sql.parser.SqlParseException;
/**
@@ -15,7 +15,7 @@ public interface SemanticQuery {
QueryResult execute(User user) throws SqlParseException;
ExplainResp explain(User user);
SqlInfo explain(User user);
SemanticParseInfo getParseInfo();

View File

@@ -68,4 +68,12 @@ public class SemanticSchema implements Serializable {
modelSchemaList.stream().forEach(d -> entities.add(d.getEntity()));
return entities;
}
public Map<String, String> getBizNameToName(Long modelId) {
List<SchemaElement> allElements = new ArrayList<>();
allElements.addAll(getDimensions(modelId));
allElements.addAll(getMetrics(modelId));
return allElements.stream()
.collect(Collectors.toMap(a -> a.getBizName(), a -> a.getName(), (k1, k2) -> k1));
}
}