mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
(improvement)(chat) update llm url to llmParser in chat project (#92)
This commit is contained in:
@@ -58,6 +58,9 @@ function setEnvToWeb {
|
||||
}
|
||||
|
||||
function resetEnvironment {
|
||||
if [[ ${app_name} == $LLMPARSER_APP_NAME ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ "$command" == "start" || "$command" == "restart" ]]; then
|
||||
#1. clear file
|
||||
mkdir -p ${runtimeDir}
|
||||
|
||||
@@ -7,10 +7,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@Data
|
||||
public class LLMConfig {
|
||||
public class LLMParserConfig {
|
||||
|
||||
|
||||
@Value("${llm.url:}")
|
||||
@Value("${llm.parser.url:}")
|
||||
private String url;
|
||||
|
||||
@Value("${query2sql.path:/query2sql}")
|
||||
@@ -15,7 +15,7 @@ import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
|
||||
import com.tencent.supersonic.chat.api.pojo.SemanticSchema;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.chat.config.LLMConfig;
|
||||
import com.tencent.supersonic.chat.config.LLMParserConfig;
|
||||
import com.tencent.supersonic.chat.corrector.BaseSemanticCorrector;
|
||||
import com.tencent.supersonic.chat.parser.SatisfactionChecker;
|
||||
import com.tencent.supersonic.chat.parser.plugin.function.ModelResolver;
|
||||
@@ -66,9 +66,9 @@ public class LLMDslParser implements SemanticParser {
|
||||
@Override
|
||||
public void parse(QueryContext queryCtx, ChatContext chatCtx) {
|
||||
QueryReq request = queryCtx.getRequest();
|
||||
LLMConfig llmConfig = ContextUtils.getBean(LLMConfig.class);
|
||||
if (StringUtils.isEmpty(llmConfig.getUrl())) {
|
||||
log.info("llm url is empty, skip dsl parser, llmConfig:{}", llmConfig);
|
||||
LLMParserConfig llmParserConfig = ContextUtils.getBean(LLMParserConfig.class);
|
||||
if (StringUtils.isEmpty(llmParserConfig.getUrl())) {
|
||||
log.info("llm parser url is empty, skip dsl parser, llmParserConfig:{}", llmParserConfig);
|
||||
return;
|
||||
}
|
||||
if (SatisfactionChecker.check(queryCtx)) {
|
||||
@@ -88,7 +88,7 @@ public class LLMDslParser implements SemanticParser {
|
||||
}
|
||||
|
||||
LLMReq llmReq = getLlmReq(queryCtx, modelId);
|
||||
LLMResp llmResp = requestLLM(llmReq, modelId, llmConfig);
|
||||
LLMResp llmResp = requestLLM(llmReq, modelId, llmParserConfig);
|
||||
|
||||
if (Objects.isNull(llmResp)) {
|
||||
return;
|
||||
@@ -319,8 +319,8 @@ public class LLMDslParser implements SemanticParser {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
private LLMResp requestLLM(LLMReq llmReq, Long modelId, LLMConfig llmConfig) {
|
||||
String questUrl = llmConfig.getUrl() + llmConfig.getQueryToSqlPath();
|
||||
private LLMResp requestLLM(LLMReq llmReq, Long modelId, LLMParserConfig llmParserConfig) {
|
||||
String questUrl = llmParserConfig.getUrl() + llmParserConfig.getQueryToSqlPath();
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info("requestLLM request, modelId:{},llmReq:{}", modelId, llmReq);
|
||||
RestTemplate restTemplate = ContextUtils.getBean(RestTemplate.class);
|
||||
|
||||
@@ -29,4 +29,5 @@ semantic:
|
||||
prefix: http://127.0.0.1:9081
|
||||
|
||||
llm:
|
||||
url: http://127.0.0.1:9092/
|
||||
parser:
|
||||
url: http://127.0.0.1:9092
|
||||
|
||||
@@ -36,7 +36,9 @@ time:
|
||||
mybatis:
|
||||
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml
|
||||
|
||||
|
||||
llm:
|
||||
parser:
|
||||
url: http://127.0.0.1:9092
|
||||
embedding:
|
||||
url: http://127.0.0.1:9092
|
||||
|
||||
Reference in New Issue
Block a user