mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 22:46:49 +00:00
(improvement)(chat) Update ConfigureDemo and dict txt for test (#438)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -110,6 +110,45 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
}
|
||||
|
||||
public void addDemoChatConfig_1() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setModelId(1L);
|
||||
|
||||
ChatDetailConfigReq chatDetailConfig = new ChatDetailConfigReq();
|
||||
ChatDefaultConfigReq chatDefaultConfigDetail = new ChatDefaultConfigReq();
|
||||
List<Long> dimensionIds0 = Collections.singletonList(1L);
|
||||
List<Long> metricIds0 = Lists.newArrayList();
|
||||
chatDefaultConfigDetail.setDimensionIds(dimensionIds0);
|
||||
chatDefaultConfigDetail.setMetricIds(metricIds0);
|
||||
chatDefaultConfigDetail.setUnit(7);
|
||||
chatDefaultConfigDetail.setPeriod("DAY");
|
||||
chatDetailConfig.setChatDefaultConfig(chatDefaultConfigDetail);
|
||||
ItemVisibility visibility0 = new ItemVisibility();
|
||||
chatDetailConfig.setVisibility(visibility0);
|
||||
chatConfigBaseReq.setChatDetailConfig(chatDetailConfig);
|
||||
|
||||
ChatAggConfigReq chatAggConfig = new ChatAggConfigReq();
|
||||
ChatDefaultConfigReq chatDefaultConfigAgg = new ChatDefaultConfigReq();
|
||||
List<Long> dimensionIds1 = Arrays.asList(1L);
|
||||
List<Long> metricIds1 = Lists.newArrayList();
|
||||
chatDefaultConfigAgg.setDimensionIds(dimensionIds1);
|
||||
chatDefaultConfigAgg.setMetricIds(metricIds1);
|
||||
chatDefaultConfigAgg.setUnit(7);
|
||||
chatDefaultConfigAgg.setPeriod("DAY");
|
||||
chatDefaultConfigAgg.setTimeMode(ChatDefaultConfigReq.TimeMode.RECENT);
|
||||
chatAggConfig.setChatDefaultConfig(chatDefaultConfigAgg);
|
||||
ItemVisibility visibility1 = new ItemVisibility();
|
||||
chatAggConfig.setVisibility(visibility1);
|
||||
List<KnowledgeInfoReq> knowledgeInfos = new ArrayList<>();
|
||||
KnowledgeInfoReq knowledgeInfoReq = new KnowledgeInfoReq();
|
||||
knowledgeInfoReq.setItemId(3L);
|
||||
knowledgeInfoReq.setSearchEnable(true);
|
||||
knowledgeInfos.add(knowledgeInfoReq);
|
||||
chatAggConfig.setKnowledgeInfos(knowledgeInfos);
|
||||
chatConfigBaseReq.setChatAggConfig(chatAggConfig);
|
||||
configService.addConfig(chatConfigBaseReq, user);
|
||||
}
|
||||
|
||||
public void addDemoChatConfig_2() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setModelId(2L);
|
||||
|
||||
@@ -148,7 +187,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
configService.addConfig(chatConfigBaseReq, user);
|
||||
}
|
||||
|
||||
public void addDemoChatConfig_2() {
|
||||
public void addDemoChatConfig_3() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setModelId(3L);
|
||||
|
||||
@@ -187,7 +226,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
configService.addConfig(chatConfigBaseReq, user);
|
||||
}
|
||||
|
||||
public void addDemoChatConfig_3() {
|
||||
public void addDemoChatConfig_4() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setModelId(4L);
|
||||
|
||||
@@ -335,6 +374,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
addDemoChatConfig_1();
|
||||
addDemoChatConfig_2();
|
||||
addDemoChatConfig_3();
|
||||
addDemoChatConfig_4();
|
||||
addPlugin_1();
|
||||
addAgent1();
|
||||
addAgent2();
|
||||
|
||||
@@ -321,7 +321,7 @@ public class LoadModelDataDemo implements CommandLineRunner {
|
||||
|
||||
public void updateMetric() throws Exception {
|
||||
MetricReq metricReq = new MetricReq();
|
||||
metricReq.setModelId(1L);
|
||||
metricReq.setModelId(3L);
|
||||
metricReq.setId(3L);
|
||||
metricReq.setName("停留时长");
|
||||
metricReq.setBizName("stay_hours");
|
||||
|
||||
@@ -244,7 +244,7 @@ CREATE TABLE s2_model_rela
|
||||
create table s2_view_info
|
||||
(
|
||||
id INT auto_increment,
|
||||
model_id INT null,
|
||||
domain_id INT null,
|
||||
type varchar(20) null comment 'datasource、dimension、metric',
|
||||
config LONGVARCHAR null comment 'config detail',
|
||||
created_at TIMESTAMP null,
|
||||
@@ -532,3 +532,12 @@ CREATE TABLE s2_sys_parameter
|
||||
parameters text null
|
||||
);
|
||||
|
||||
CREATE TABLE `s2_collect` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(20) NOT NULL,
|
||||
`username` varchar(20) NOT NULL,
|
||||
`collect_id` bigint NOT NULL,
|
||||
`create_time` TIMESTAMP,
|
||||
`update_time` TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
@@ -363,7 +363,7 @@ CREATE TABLE `s2_semantic_pasre_info` (
|
||||
|
||||
CREATE TABLE `s2_view_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`model_id` bigint(20) DEFAULT NULL,
|
||||
`domain_id` bigint(20) DEFAULT NULL,
|
||||
`type` varchar(20) DEFAULT NULL COMMENT 'datasource、dimension、metric',
|
||||
`config` text COMMENT 'config detail',
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
|
||||
@@ -113,4 +113,6 @@ CREATE TABLE s2_model_rela
|
||||
join_type VARCHAR(255),
|
||||
join_condition VARCHAR(255),
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
);
|
||||
|
||||
alter table s2_view_info change model_id domain_id bigint;
|
||||
@@ -1,21 +1,20 @@
|
||||
package com.tencent.supersonic.integration;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElement;
|
||||
import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.QueryResult;
|
||||
import com.tencent.supersonic.chat.query.rule.tag.TagFilterQuery;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricTagQuery;
|
||||
import com.tencent.supersonic.chat.query.rule.tag.TagFilterQuery;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.DateConf.DateMode;
|
||||
import com.tencent.supersonic.common.pojo.QueryType;
|
||||
import com.tencent.supersonic.common.pojo.enums.FilterOperatorEnum;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
|
||||
public class TagQueryTest extends BaseQueryTest {
|
||||
|
||||
@@ -30,13 +29,13 @@ public class TagQueryTest extends BaseQueryTest {
|
||||
expectedResult.setQueryMode(MetricTagQuery.QUERY_MODE);
|
||||
expectedParseInfo.setAggType(NONE);
|
||||
|
||||
QueryFilter dimensionFilter = DataUtils.getFilter("singer_name", FilterOperatorEnum.EQUALS, "周杰伦", "歌手名", 7L);
|
||||
QueryFilter dimensionFilter = DataUtils.getFilter("singer_name", FilterOperatorEnum.EQUALS, "周杰伦", "歌手名", 9L);
|
||||
expectedParseInfo.getDimensionFilters().add(dimensionFilter);
|
||||
|
||||
SchemaElement metric = SchemaElement.builder().name("播放量").build();
|
||||
expectedParseInfo.getMetrics().add(metric);
|
||||
|
||||
expectedParseInfo.setDateInfo(DataUtils.getDateConf(DateMode.BETWEEN, 1, period, startDay, endDay));
|
||||
expectedParseInfo.setDateInfo(DataUtils.getDateConf(DateMode.RECENT, 7, period, startDay, endDay));
|
||||
expectedParseInfo.setQueryType(QueryType.METRIC);
|
||||
|
||||
assertQueryResult(expectedResult, actualResult);
|
||||
@@ -54,9 +53,9 @@ public class TagQueryTest extends BaseQueryTest {
|
||||
expectedParseInfo.setAggType(NONE);
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("爱情");
|
||||
list.add("流行");
|
||||
QueryFilter dimensionFilter = DataUtils.getFilter("genre", FilterOperatorEnum.IN, list, "风格", 6L);
|
||||
QueryFilter dimensionFilter = DataUtils.getFilter("genre", FilterOperatorEnum.EQUALS,
|
||||
"流行", "风格", 8L);
|
||||
expectedParseInfo.getDimensionFilters().add(dimensionFilter);
|
||||
|
||||
SchemaElement metric = SchemaElement.builder().name("播放量").build();
|
||||
|
||||
@@ -5,15 +5,14 @@ dean _1_2 36
|
||||
john _1_2 50
|
||||
jack _1_2 38
|
||||
admin _1_2 70
|
||||
周杰伦 _2_7 100
|
||||
陈奕迅 _2_7 100
|
||||
林俊杰 _2_7 100
|
||||
张碧晨 _2_7 100
|
||||
程响 _2_7 100
|
||||
Taylor#Swift _2_7 100
|
||||
中国 _2_4 100
|
||||
欧美 _2_4 100
|
||||
流行 _2_6 100
|
||||
爱情 _2_6 100
|
||||
激情 _2_6 100
|
||||
国风 _2_6 100
|
||||
周杰伦 _4_9 100
|
||||
陈奕迅 _4_9 100
|
||||
林俊杰 _4_9 100
|
||||
张碧晨 _4_9 100
|
||||
程响 _4_9 100
|
||||
Taylor#Swift _4_9 100
|
||||
内地 _4_6 100
|
||||
欧美 _4_6 100
|
||||
港台 _4_6 100
|
||||
流行 _4_8 100
|
||||
国风 _4_8 100
|
||||
@@ -1,6 +1,6 @@
|
||||
p1 _1_3 52
|
||||
p2 _1_3 47
|
||||
p3 _1_3 31
|
||||
p4 _1_3 36
|
||||
p5 _1_3 50
|
||||
p6 _1_3 38
|
||||
p1 _3_4 52
|
||||
p2 _3_4 47
|
||||
p3 _3_4 31
|
||||
p4 _3_4 36
|
||||
p5 _3_4 50
|
||||
p6 _3_4 38
|
||||
@@ -0,0 +1,9 @@
|
||||
周杰伦 _4_9 9000
|
||||
周深 _4_9 8000
|
||||
周传雄 _4_9 7000
|
||||
周华建 _4_9 6000
|
||||
陈奕迅 _4_9 8000
|
||||
林俊杰 _4_9 7000
|
||||
张碧晨 _4_9 7000
|
||||
程响 _4_9 7000
|
||||
Taylor#Swift _4_9 7000
|
||||
Reference in New Issue
Block a user