[release](project)update version 0.7.4 backend (#66)

This commit is contained in:
daikon
2023-09-10 21:26:46 +08:00
committed by GitHub
parent 02068f58c7
commit a8add4c013
172 changed files with 2180 additions and 1082 deletions

View File

@@ -29,4 +29,4 @@ semantic:
prefix: http://127.0.0.1:9081
llm:
url: http://127.0.0.1:9092
url: http://127.0.0.1:9092/

View File

@@ -1,6 +1,7 @@
package com.tencent.supersonic.advice;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.tencent.supersonic.common.pojo.ResultData;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@@ -31,6 +32,7 @@ public class ResponseAdvice implements ResponseBodyAdvice<Object> {
public Object beforeBodyWrite(Object result, MethodParameter methodParameter, MediaType mediaType,
Class<? extends HttpMessageConverter<?>> aClass, ServerHttpRequest serverHttpRequest,
ServerHttpResponse serverHttpResponse) {
objectMapper.registerModule(new JavaTimeModule());
if (result instanceof String) {
return objectMapper.writeValueAsString(ResultData.success(result));
}

View File

@@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `s2_model` (
`name` varchar(255) DEFAULT NULL , -- domain name
`biz_name` varchar(255) DEFAULT NULL , -- internal name
`domain_id` INT DEFAULT '0' , -- parent domain ID
`alias` varchar(255) DEFAULT NULL , -- internal name
`created_at` TIMESTAMP DEFAULT NULL ,
`created_by` varchar(100) DEFAULT NULL ,
`updated_at` TIMESTAMP DEFAULT NULL ,

View File

@@ -14,9 +14,11 @@ import com.tencent.supersonic.chat.api.pojo.request.ChatDetailConfigReq;
import com.tencent.supersonic.chat.api.pojo.request.ExecuteQueryReq;
import com.tencent.supersonic.chat.api.pojo.request.ItemVisibility;
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
import com.tencent.supersonic.chat.api.pojo.request.KnowledgeInfoReq;
import com.tencent.supersonic.chat.api.pojo.request.RecommendedQuestionReq;
import com.tencent.supersonic.chat.api.pojo.response.ParseResp;
import com.tencent.supersonic.chat.plugin.Plugin;
import com.tencent.supersonic.chat.plugin.PluginParseConfig;
import com.tencent.supersonic.chat.query.plugin.ParamOption;
import com.tencent.supersonic.chat.query.plugin.WebBase;
import com.tencent.supersonic.chat.service.QueryService;
@@ -119,6 +121,16 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
chatAggConfig.setChatDefaultConfig(chatDefaultConfigAgg);
ItemVisibility visibility1 = new ItemVisibility();
chatAggConfig.setVisibility(visibility1);
List<KnowledgeInfoReq> knowledgeInfos = new ArrayList<>();
KnowledgeInfoReq knowledgeInfoReq = new KnowledgeInfoReq();
knowledgeInfoReq.setItemId(1L);
knowledgeInfoReq.setSearchEnable(true);
knowledgeInfos.add(knowledgeInfoReq);
KnowledgeInfoReq knowledgeInfoReq2 = new KnowledgeInfoReq();
knowledgeInfoReq2.setItemId(2L);
knowledgeInfoReq2.setSearchEnable(true);
knowledgeInfos.add(knowledgeInfoReq2);
chatAggConfig.setKnowledgeInfos(knowledgeInfos);
chatConfigBaseReq.setChatAggConfig(chatAggConfig);
List<RecommendedQuestionReq> recommendedQuestions = new ArrayList<>();
@@ -170,13 +182,18 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
configService.addConfig(chatConfigBaseReq, user);
}
private void addPlugin_1() {
Plugin plugin1 = new Plugin();
plugin1.setType("WEB_PAGE");
plugin1.setModelList(Arrays.asList(1L));
plugin1.setPattern("用于分析超音数的流量概况包含UV、PV等核心指标的追踪。P.S. 仅作为示例展示,无实际看板");
plugin1.setParseModeConfig(null);
plugin1.setName("超音数流量分析看板");
PluginParseConfig pluginParseConfig = new PluginParseConfig();
pluginParseConfig.setDescription(plugin1.getPattern());
pluginParseConfig.setName(plugin1.getName());
pluginParseConfig.setExamples(Lists.newArrayList("tom最近访问超音数情况怎么样"));
plugin1.setParseModeConfig(JSONObject.toJSONString(pluginParseConfig));
WebBase webBase = new WebBase();
webBase.setUrl("www.yourbi.com");
ParamOption paramOption = new ParamOption();
@@ -198,8 +215,8 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
agent.setDescription("帮助您用自然语言查询指标,支持时间限定、条件筛选、下钻维度以及聚合统计");
agent.setStatus(1);
agent.setEnableSearch(1);
agent.setExamples(Lists.newArrayList("超音数访问次数", "近15天超音数访问次数汇总",
"按部门统计超音数的访问人数", "对比alice和lucy的停留时长", "超音数访问次数最高的部门"));
agent.setExamples(Lists.newArrayList("超音数访问次数", "近15天超音数访问次数汇总", "按部门统计超音数的访问人数",
"对比alice和lucy的停留时长", "超音数访问次数最高的部门"));
AgentConfig agentConfig = new AgentConfig();
RuleQueryTool ruleQueryTool = new RuleQueryTool();
ruleQueryTool.setType(AgentToolType.RULE);

View File

@@ -38,3 +38,7 @@ mybatis:
llm:
url: http://127.0.0.1:9092
embedding:
url: http://127.0.0.1:9092
functionCall:
url: http://127.0.0.1:9092

View File

@@ -117,6 +117,7 @@ CREATE TABLE IF NOT EXISTS `s2_model` (
`name` varchar(255) DEFAULT NULL , -- domain name
`biz_name` varchar(255) DEFAULT NULL , -- internal name
`domain_id` INT DEFAULT '0' , -- parent domain ID
`alias` varchar(255) DEFAULT NULL , -- internal name
`created_at` TIMESTAMP DEFAULT NULL ,
`created_by` varchar(100) DEFAULT NULL ,
`updated_at` TIMESTAMP DEFAULT NULL ,
@@ -392,7 +393,21 @@ CREATE TABLE IF NOT EXISTS `singer` (
);
COMMENT ON TABLE singer IS 'singer_info';
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL , -- task name
`description` varchar(255) ,
`command`LONGVARCHAR NOT NULL , -- task Request Parameters
`command_md5` varchar(255) NOT NULL , -- task Request Parameters md5
`status` INT NOT NULL , -- the final status of the task
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
`created_by` varchar(100) NOT NULL ,
`progress` DOUBLE default 0.00 , -- task real-time progress
`elapsed_ms` bigINT DEFAULT NULL , -- the task takes time in milliseconds
`message` LONGVARCHAR , -- remark related information
PRIMARY KEY (`id`)
);
COMMENT ON TABLE s2_dictionary_task IS 'dictionary task information table';

View File

@@ -45,4 +45,8 @@ alter table s2_database add column viewer varchar(500);
alter table s2_database drop column domain_id;
--20230831
alter table s2_chat add column agent_id int after chat_id;
alter table s2_chat add column agent_id int after chat_id;
--20230907
ALTER TABLE s2_model add alias varchar(200) default null after domain_id;

View File

@@ -1,18 +1,10 @@
#hanlp mapper helper
one.detection.size=8
one.detection.max.size=20
metric.dimension.min.threshold=0.3
metric.dimension.threshold=0.3
dimension.value.threshold=0.5
function.bonus.threshold=201
#SatisfactionChecker
long.text.threshold=0.8
short.text.threshold=0.5
query.text.length.threshold=10
candidate.threshold=0.2

View File

@@ -6,7 +6,7 @@ import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
import com.tencent.supersonic.chat.api.pojo.response.QueryResult;
import com.tencent.supersonic.chat.parser.plugin.embedding.EmbeddingConfig;
import com.tencent.supersonic.chat.plugin.PluginManager;
import com.tencent.supersonic.chat.query.metricinterpret.LLmAnswerResp;
import com.tencent.supersonic.chat.query.llm.interpret.LLmAnswerResp;
import com.tencent.supersonic.chat.service.AgentService;
import com.tencent.supersonic.chat.service.QueryService;
import com.tencent.supersonic.util.DataUtils;

View File

@@ -24,7 +24,7 @@ public class BasePluginTest {
Assert.assertEquals(queryResult.getQueryMode(), WebPageQuery.QUERY_MODE);
WebPageResponse webPageResponse = (WebPageResponse) queryResult.getResponse();
WebBaseResult webPage = webPageResponse.getWebPage();
Assert.assertEquals(webPage.getUrl(), "www.test.com");
Assert.assertEquals(webPage.getUrl(), "www.yourbi.com");
Assert.assertEquals(1, webPage.getParams().size());
Assert.assertEquals("alice", webPage.getParams().get(0).getValue());
}

View File

@@ -36,7 +36,7 @@ public class PluginRecognizeTest extends BasePluginTest {
public void webPageRecognize() throws Exception {
MockConfiguration.mockEmbeddingRecognize(pluginManager, "alice最近的访问情况怎么样", "1");
MockConfiguration.mockEmbeddingUrl(embeddingConfig);
QueryReq queryContextReq = DataUtils.getQueryContextReq(1000, "alice最近的访问情况怎么样");
QueryReq queryContextReq = DataUtils.getQueryReqWithAgent(1000, "alice最近的访问情况怎么样", 1);
QueryResult queryResult = queryService.executeQuery(queryContextReq);
assertPluginRecognizeResult(queryResult);
}
@@ -45,7 +45,7 @@ public class PluginRecognizeTest extends BasePluginTest {
public void webPageRecognizeWithQueryFilter() throws Exception {
MockConfiguration.mockEmbeddingRecognize(pluginManager, "在超音数最近的情况怎么样", "1");
MockConfiguration.mockEmbeddingUrl(embeddingConfig);
QueryReq queryRequest = DataUtils.getQueryContextReq(1000, "在超音数最近的情况怎么样");
QueryReq queryRequest = DataUtils.getQueryReqWithAgent(1000, "在超音数最近的情况怎么样", 1);
QueryFilters queryFilters = new QueryFilters();
QueryFilter queryFilter = new QueryFilter();
queryFilter.setElementID(2L);

View File

@@ -91,7 +91,7 @@ public class DataUtils {
dateInfo.setDateMode(dateMode);
dateInfo.setPeriod(period);
dateInfo.setStartDate(now().plusDays(-unit).toString());
dateInfo.setEndDate(now().toString());
dateInfo.setEndDate(now().plusDays(-1).toString());
return dateInfo;
}

View File

@@ -4,6 +4,8 @@ spring:
path: /h2-console/chat
# enabled web
enabled: true
demo:
enabled: true
datasource:
driver-class-name: org.h2.Driver
schema: classpath:db/schema-h2.sql

View File

@@ -132,6 +132,7 @@ CREATE TABLE IF NOT EXISTS `s2_model` (
`name` varchar(255) DEFAULT NULL , -- domain name
`biz_name` varchar(255) DEFAULT NULL , -- internal name
`domain_id` INT DEFAULT '0' , -- parent domain ID
`alias` varchar(255) DEFAULT NULL , -- alias name
`created_at` TIMESTAMP DEFAULT NULL ,
`created_by` varchar(100) DEFAULT NULL ,
`updated_at` TIMESTAMP DEFAULT NULL ,