mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
Compare commits
10 Commits
2f4f2027a5
...
86651a2b10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86651a2b10 | ||
|
|
62b9db6791 | ||
|
|
6d907b6adf | ||
|
|
da172a030e | ||
|
|
fa65b6eff7 | ||
|
|
0ab44c0866 | ||
|
|
449fdf180f | ||
|
|
d275a145d5 | ||
|
|
c8f690c1c2 | ||
|
|
38af6e3a28 |
@@ -88,10 +88,10 @@ public class WebServiceQuery extends PluginSemanticQuery {
|
||||
restTemplate = ContextUtils.getBean(RestTemplate.class);
|
||||
try {
|
||||
responseEntity =
|
||||
restTemplate.exchange(requestUrl, HttpMethod.POST, entity, Object.class);
|
||||
restTemplate.exchange(requestUrl, HttpMethod.POST, entity, String.class);
|
||||
objectResponse = responseEntity.getBody();
|
||||
log.info("objectResponse:{}", objectResponse);
|
||||
Map<String, Object> response = JsonUtil.objectToMap(objectResponse);
|
||||
Map<String, Object> response = JSON.parseObject(objectResponse.toString());
|
||||
webServiceResponse.setResult(response);
|
||||
} catch (Exception e) {
|
||||
log.info("Exception:{}", e.getMessage());
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ParseContext {
|
||||
}
|
||||
|
||||
public boolean enableNL2SQL() {
|
||||
return Objects.nonNull(agent) && agent.containsDatasetTool();
|
||||
return Objects.nonNull(agent) && agent.containsDatasetTool()&&response.getSelectedParses().size() == 0;
|
||||
}
|
||||
|
||||
public boolean enableLLM() {
|
||||
|
||||
@@ -175,6 +175,7 @@ public class FileHandlerImpl implements FileHandler {
|
||||
private DictValueResp convert2Resp(String lineStr) {
|
||||
DictValueResp dictValueResp = new DictValueResp();
|
||||
if (StringUtils.isNotEmpty(lineStr)) {
|
||||
lineStr=StringUtils.stripStart(lineStr,null);
|
||||
String[] itemArray = lineStr.split("\\s+");
|
||||
if (Objects.nonNull(itemArray) && itemArray.length >= 3) {
|
||||
dictValueResp.setValue(itemArray[0].replace("#", " "));
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.tencent.supersonic.headless.chat.mapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.hankcs.hanlp.seg.common.Term;
|
||||
import com.tencent.supersonic.common.pojo.ChatModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.S2Term;
|
||||
import com.tencent.supersonic.headless.chat.ChatQueryContext;
|
||||
import com.tencent.supersonic.headless.chat.knowledge.EmbeddingResult;
|
||||
@@ -167,9 +168,13 @@ public class EmbeddingMatchStrategy extends BatchMatchStrategy<EmbeddingResult>
|
||||
variable.put("retrievedInfo", JSONObject.toJSONString(results));
|
||||
|
||||
Prompt prompt = PromptTemplate.from(LLM_FILTER_PROMPT).apply(variable);
|
||||
ChatLanguageModel chatLanguageModel =
|
||||
ModelProvider.getChatModel(chatQueryContext.getRequest().getChatAppConfig()
|
||||
.get("REWRITE_MULTI_TURN").getChatModelConfig());
|
||||
|
||||
ChatModelConfig chatModelConfig=null;
|
||||
if(chatQueryContext.getRequest().getChatAppConfig()!=null
|
||||
&& chatQueryContext.getRequest().getChatAppConfig().containsKey("REWRITE_MULTI_TURN")){
|
||||
chatModelConfig=chatQueryContext.getRequest().getChatAppConfig().get("REWRITE_MULTI_TURN").getChatModelConfig();
|
||||
}
|
||||
ChatLanguageModel chatLanguageModel = ModelProvider.getChatModel(chatModelConfig);
|
||||
String response = chatLanguageModel.generate(prompt.toUserMessage().singleText());
|
||||
|
||||
if (StringUtils.isBlank(response)) {
|
||||
|
||||
@@ -367,7 +367,7 @@ const ChatMsg: React.FC<Props> = ({
|
||||
entityName !== undefined;
|
||||
|
||||
const existDrillDownDimension =
|
||||
queryMode.includes('METRIC') &&
|
||||
(queryMode.includes('METRIC') || queryMode === 'LLM_S2SQL')&&
|
||||
getMsgContentType() !== MsgContentTypeEnum.TEXT &&
|
||||
!isEntityMode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user