(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 # package webapp
tar xvf supersonic-webapp.tar.gz tar xvf supersonic-webapp.tar.gz
mv supersonic-webapp webapp mv supersonic-webapp webapp
json='{"env": "'$model_name'"}' json='{"env": "''"}'
echo $json > webapp/supersonic.config.json echo $json > webapp/supersonic.config.json
mv webapp $release_dir/ mv webapp $release_dir/
# package java service # package java service
@@ -57,9 +57,8 @@ function packageRelease {
# generate zip file # generate zip file
zip -r $release_dir.zip $release_dir zip -r $release_dir.zip $release_dir
# delete intermediate files # delete intermediate files
rm -rf supersonic-webapp.tar.gz rm supersonic-webapp.tar.gz $service_name-bin.tar.gz
rm -rf $service_name-bin.tar.gz rm -rf webapp $service_name $release_dir
rm -rf $service_name
echo "finished packaging supersonic release" echo "finished packaging supersonic release"
} }
@@ -71,7 +70,9 @@ if [ "$service" == $PYLLM_SERVICE ]; then
echo "install python modules success" echo "install python modules success"
elif [ "$service" == "webapp" ]; then elif [ "$service" == "webapp" ]; then
buildWebapp 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 else
buildJavaService $service buildJavaService $service
buildWebapp buildWebapp

View File

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

View File

@@ -17,6 +17,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; 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 @Slf4j
public class LLMSqlParser implements SemanticParser { public class LLMSqlParser implements SemanticParser {
@@ -30,20 +34,21 @@ public class LLMSqlParser implements SemanticParser {
try { try {
//2.get dataSetId from queryCtx and chatCtx. //2.get dataSetId from queryCtx and chatCtx.
Long dataSetId = requestService.getDataSetId(queryCtx); Long dataSetId = requestService.getDataSetId(queryCtx);
log.info("dataSetId:{}", dataSetId);
if (dataSetId == null) { if (dataSetId == null) {
return; 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); List<LLMReq.ElementValue> linkingValues = requestService.getValueList(queryCtx, dataSetId);
SemanticSchema semanticSchema = queryCtx.getSemanticSchema(); SemanticSchema semanticSchema = queryCtx.getSemanticSchema();
LLMReq llmReq = requestService.getLlmReq(queryCtx, dataSetId, semanticSchema, linkingValues); LLMReq llmReq = requestService.getLlmReq(queryCtx, dataSetId, semanticSchema, linkingValues);
LLMResp llmResp = requestService.requestLLM(llmReq, dataSetId); LLMResp llmResp = requestService.requestLLM(llmReq, dataSetId);
if (Objects.isNull(llmResp)) { if (Objects.isNull(llmResp)) {
return; 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); LLMResponseService responseService = ContextUtils.getBean(LLMResponseService.class);
Map<String, LLMSqlResp> deduplicationSqlResp = responseService.getDeduplicationSqlResp(llmResp); Map<String, LLMSqlResp> deduplicationSqlResp = responseService.getDeduplicationSqlResp(llmResp);
ParseResult parseResult = ParseResult.builder() ParseResult parseResult = ParseResult.builder()
@@ -66,7 +71,7 @@ public class LLMSqlParser implements SemanticParser {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("parse", e); log.error("Failed to parse query:", e);
} }
} }