(improvement)(assembly)Improve build scripts

This commit is contained in:
jerryjzhang
2024-05-17 15:53:10 +08:00
parent 89b86a22cf
commit 710f120e38
3 changed files with 19 additions and 13 deletions

View File

@@ -48,7 +48,7 @@ function packageRelease {
# package webapp
tar xvf supersonic-webapp.tar.gz
mv supersonic-webapp webapp
json='{"env": "'$model_name'"}'
json='{"env": "''"}'
echo $json > webapp/supersonic.config.json
mv webapp $release_dir/
# package java service
@@ -57,9 +57,8 @@ function packageRelease {
# generate zip file
zip -r $release_dir.zip $release_dir
# delete intermediate files
rm -rf supersonic-webapp.tar.gz
rm -rf $service_name-bin.tar.gz
rm -rf $service_name
rm supersonic-webapp.tar.gz $service_name-bin.tar.gz
rm -rf webapp $service_name $release_dir
echo "finished packaging supersonic release"
}
@@ -71,7 +70,9 @@ if [ "$service" == $PYLLM_SERVICE ]; then
echo "install python modules success"
elif [ "$service" == "webapp" ]; then
buildWebapp
cp -fr webapp $projectDir/launchers/$STANDALONE_SERVICE/target/classes
target_path=$projectDir/launchers/$STANDALONE_SERVICE/target/classes
tar xvf $projectDir/webapp/supersonic-webapp.tar.gz -C $target_path
mv $target_path/supersonic_webapp $target_path/webapp
else
buildJavaService $service
buildWebapp

View File

@@ -4,9 +4,9 @@ import com.tencent.supersonic.headless.core.pojo.ChatContext;
import com.tencent.supersonic.headless.core.pojo.QueryContext;
/**
* A semantic parser understands user queries and extracts semantic information.
* It could leverage either rule-based or LLM-based approach to identify query intent
* and extract related semantic items from the query.
* A semantic parser understands user queries and generates semantic query statement.
* SuperSonic leverages a combination of rule-based and LLM-based parsers,
* each of which deals with specific scenarios.
*/
public interface SemanticParser {

View File

@@ -17,6 +17,10 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* LLMSqlParser uses large language model to understand query semantics and
* generate S2SQL statements to be executed by the semantic query engine.
*/
@Slf4j
public class LLMSqlParser implements SemanticParser {
@@ -30,20 +34,21 @@ public class LLMSqlParser implements SemanticParser {
try {
//2.get dataSetId from queryCtx and chatCtx.
Long dataSetId = requestService.getDataSetId(queryCtx);
log.info("dataSetId:{}", dataSetId);
if (dataSetId == null) {
return;
}
//3.construct a request, call the API for the large model, and retrieve the results.
log.info("Generate query statement for dataSetId:{}", dataSetId);
//3.invoke LLM service to do parsing.
List<LLMReq.ElementValue> linkingValues = requestService.getValueList(queryCtx, dataSetId);
SemanticSchema semanticSchema = queryCtx.getSemanticSchema();
LLMReq llmReq = requestService.getLlmReq(queryCtx, dataSetId, semanticSchema, linkingValues);
LLMResp llmResp = requestService.requestLLM(llmReq, dataSetId);
if (Objects.isNull(llmResp)) {
return;
}
//4. deduplicate the SQL result list and build parserInfo
//4. deduplicate the S2SQL result list and build parserInfo
LLMResponseService responseService = ContextUtils.getBean(LLMResponseService.class);
Map<String, LLMSqlResp> deduplicationSqlResp = responseService.getDeduplicationSqlResp(llmResp);
ParseResult parseResult = ParseResult.builder()
@@ -66,7 +71,7 @@ public class LLMSqlParser implements SemanticParser {
}
} catch (Exception e) {
log.error("parse", e);
log.error("Failed to parse query:", e);
}
}