mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-22 06:44:18 +08:00
[improvement][project] supersonic 0.7.2 version backend update (#28)
Co-authored-by: jipengli <jipengli@tencent.com>
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
package com.tencent.supersonic;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.*;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.ChatAggConfigReq;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.ChatConfigBaseReq;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.ChatDefaultConfigReq;
|
||||
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.RecommendedQuestionReq;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.ParseResp;
|
||||
import com.tencent.supersonic.chat.parser.ParseMode;
|
||||
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.ChatService;
|
||||
@@ -12,17 +19,19 @@ import com.tencent.supersonic.chat.service.ConfigService;
|
||||
import com.tencent.supersonic.chat.service.PluginService;
|
||||
import com.tencent.supersonic.chat.service.QueryService;
|
||||
import com.tencent.supersonic.common.util.JsonUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent> {
|
||||
|
||||
@Autowired
|
||||
private QueryService queryService;
|
||||
@Autowired
|
||||
@@ -67,7 +76,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
|
||||
public void addDemoChatConfig_1() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setDomainId(1L);
|
||||
chatConfigBaseReq.setModelId(1L);
|
||||
|
||||
ChatDetailConfigReq chatDetailConfig = new ChatDetailConfigReq();
|
||||
ChatDefaultConfigReq chatDefaultConfigDetail = new ChatDefaultConfigReq();
|
||||
@@ -82,7 +91,6 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
chatDetailConfig.setVisibility(visibility_0);
|
||||
chatConfigBaseReq.setChatDetailConfig(chatDetailConfig);
|
||||
|
||||
|
||||
ChatAggConfigReq chatAggConfig = new ChatAggConfigReq();
|
||||
ChatDefaultConfigReq chatDefaultConfigAgg = new ChatDefaultConfigReq();
|
||||
List<Long> dimensionIds_1 = Arrays.asList(1L, 2L);
|
||||
@@ -111,7 +119,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
|
||||
public void addDemoChatConfig_2() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setDomainId(2L);
|
||||
chatConfigBaseReq.setModelId(2L);
|
||||
|
||||
ChatDetailConfigReq chatDetailConfig = new ChatDetailConfigReq();
|
||||
ChatDefaultConfigReq chatDefaultConfigDetail = new ChatDefaultConfigReq();
|
||||
@@ -126,7 +134,6 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
chatDetailConfig.setVisibility(visibility_0);
|
||||
chatConfigBaseReq.setChatDetailConfig(chatDetailConfig);
|
||||
|
||||
|
||||
ChatAggConfigReq chatAggConfig = new ChatAggConfigReq();
|
||||
ChatDefaultConfigReq chatDefaultConfigAgg = new ChatDefaultConfigReq();
|
||||
List<Long> dimensionIds_1 = Arrays.asList(4L, 5L, 6L, 7L);
|
||||
@@ -150,7 +157,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
private void addPlugin_1() {
|
||||
Plugin plugin_1 = new Plugin();
|
||||
plugin_1.setType("WEB_PAGE");
|
||||
plugin_1.setDomainList(Arrays.asList(1L));
|
||||
plugin_1.setModelList(Arrays.asList(1L));
|
||||
plugin_1.setPattern("访问情况");
|
||||
plugin_1.setParseModeConfig(null);
|
||||
plugin_1.setName("访问情况");
|
||||
@@ -160,7 +167,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
paramOption.setKey("name");
|
||||
paramOption.setParamType(ParamOption.ParamType.SEMANTIC);
|
||||
paramOption.setElementId(2L);
|
||||
paramOption.setDomainId(1L);
|
||||
paramOption.setModelId(1L);
|
||||
List<ParamOption> paramOptions = Arrays.asList(paramOption);
|
||||
webBase.setParamOptions(paramOptions);
|
||||
plugin_1.setConfig(JsonUtil.toString(webBase));
|
||||
@@ -169,15 +176,42 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
}
|
||||
|
||||
private void addPlugin_2() {
|
||||
Plugin plugin_1 = new Plugin();
|
||||
plugin_1.setType("DSL");
|
||||
plugin_1.setDomainList(new ArrayList<>());
|
||||
plugin_1.setPattern("");
|
||||
plugin_1.setParseMode(ParseMode.FUNCTION_CALL);
|
||||
plugin_1.setParseModeConfig(null);
|
||||
plugin_1.setName("访问情况");
|
||||
plugin_1.setConfig("");
|
||||
pluginService.createPlugin(plugin_1, user);
|
||||
Plugin plugin_2 = new Plugin();
|
||||
plugin_2.setType("DSL");
|
||||
plugin_2.setModelList(Arrays.asList(1L, 2L));
|
||||
plugin_2.setPattern("");
|
||||
plugin_2.setParseModeConfig(null);
|
||||
plugin_2.setName("大模型语义解析");
|
||||
List<String> examples = new ArrayList<>();
|
||||
examples.add("超音数访问次数最高的部门是哪个");
|
||||
examples.add("超音数访问人数最高的部门是哪个");
|
||||
|
||||
PluginParseConfig parseConfig = PluginParseConfig.builder()
|
||||
.name("DSL")
|
||||
.description("这个工具能够将用户的自然语言查询转化为SQL语句,从而从数据库中的查询具体的数据。用于处理数据查询的问题,提供基于事实的数据")
|
||||
.examples(examples)
|
||||
.build();
|
||||
plugin_2.setParseModeConfig(JsonUtil.toString(parseConfig));
|
||||
pluginService.createPlugin(plugin_2, user);
|
||||
}
|
||||
|
||||
private void addPlugin_3() {
|
||||
Plugin plugin_2 = new Plugin();
|
||||
plugin_2.setType("CONTENT_INTERPRET");
|
||||
plugin_2.setModelList(Arrays.asList(1L));
|
||||
plugin_2.setPattern("超音数最近访问情况怎么样");
|
||||
plugin_2.setParseModeConfig(null);
|
||||
plugin_2.setName("内容解读");
|
||||
List<String> examples = new ArrayList<>();
|
||||
examples.add("超音数最近访问情况怎么样");
|
||||
examples.add("超音数最近访问情况如何");
|
||||
PluginParseConfig parseConfig = PluginParseConfig.builder()
|
||||
.name("supersonic_content_interpret")
|
||||
.description("这个工具能够先查询到相关的数据并交给大模型进行解读, 最后返回解读结果")
|
||||
.examples(examples)
|
||||
.build();
|
||||
plugin_2.setParseModeConfig(JsonUtil.toString(parseConfig));
|
||||
pluginService.createPlugin(plugin_2, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,6 +221,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
addDemoChatConfig_2();
|
||||
addPlugin_1();
|
||||
addPlugin_2();
|
||||
addPlugin_3();
|
||||
addSampleChats();
|
||||
addSampleChats2();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.tencent.supersonic.db;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
@@ -8,8 +9,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
@Configuration
|
||||
@MapperScan(value = "com.tencent.supersonic", annotationClass = Mapper.class)
|
||||
|
||||
@@ -3,27 +3,21 @@ com.tencent.supersonic.chat.api.component.SchemaMapper=\
|
||||
com.tencent.supersonic.chat.mapper.FuzzyNameMapper, \
|
||||
com.tencent.supersonic.chat.mapper.QueryFilterMapper, \
|
||||
com.tencent.supersonic.chat.mapper.EntityMapper
|
||||
|
||||
com.tencent.supersonic.chat.api.component.SemanticParser=\
|
||||
com.tencent.supersonic.chat.parser.rule.QueryModeParser, \
|
||||
com.tencent.supersonic.chat.parser.rule.ContextInheritParser, \
|
||||
com.tencent.supersonic.chat.parser.rule.TimeRangeParser, \
|
||||
com.tencent.supersonic.chat.parser.rule.AggregateTypeParser, \
|
||||
com.tencent.supersonic.chat.parser.llm.LLMDSLParser, \
|
||||
com.tencent.supersonic.chat.parser.embedding.EmbeddingBasedParser, \
|
||||
com.tencent.supersonic.chat.parser.function.FunctionBasedParser
|
||||
|
||||
|
||||
com.tencent.supersonic.chat.api.component.SemanticLayer=\
|
||||
com.tencent.supersonic.knowledge.semantic.LocalSemanticLayer
|
||||
|
||||
com.tencent.supersonic.chat.query.QuerySelector=\
|
||||
com.tencent.supersonic.chat.query.HeuristicQuerySelector
|
||||
|
||||
com.tencent.supersonic.chat.parser.function.DomainResolver=\
|
||||
com.tencent.supersonic.chat.parser.function.HeuristicDomainResolver
|
||||
|
||||
com.tencent.supersonic.chat.parser.function.ModelResolver=\
|
||||
com.tencent.supersonic.chat.parser.function.HeuristicModelResolver
|
||||
com.tencent.supersonic.auth.authentication.interceptor.AuthenticationInterceptor=\
|
||||
com.tencent.supersonic.auth.authentication.interceptor.DefaultAuthenticationInterceptor
|
||||
|
||||
com.tencent.supersonic.auth.api.authentication.adaptor.UserAdaptor=\
|
||||
com.tencent.supersonic.auth.authentication.adaptor.DefaultUserAdaptor
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
spring:
|
||||
h2:
|
||||
console:
|
||||
path: /h2-console/chat
|
||||
path: /h2-console/semantic
|
||||
# enabled web
|
||||
enabled: true
|
||||
datasource:
|
||||
@@ -19,6 +19,10 @@ authentication:
|
||||
enable: true
|
||||
exclude:
|
||||
path: /api/auth/user/register,/api/auth/user/login
|
||||
token:
|
||||
http:
|
||||
header:
|
||||
key: Authorization
|
||||
|
||||
semantic:
|
||||
url:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,337 +1,734 @@
|
||||
-- chat tables
|
||||
CREATE TABLE IF NOT EXISTS `s2_chat_context`
|
||||
(
|
||||
`chat_id` BIGINT NOT NULL , -- context chat id
|
||||
`modified_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , -- row modify time
|
||||
`user` varchar(64) DEFAULT NULL , -- row modify user
|
||||
`query_text` LONGVARCHAR DEFAULT NULL , -- query text
|
||||
`chat_id`
|
||||
BIGINT
|
||||
NOT
|
||||
NULL, -- context chat id
|
||||
`modified_at`
|
||||
TIMESTAMP
|
||||
NOT
|
||||
NULL
|
||||
DEFAULT
|
||||
CURRENT_TIMESTAMP
|
||||
ON
|
||||
UPDATE
|
||||
CURRENT_TIMESTAMP, -- row modify time
|
||||
`user`
|
||||
varchar
|
||||
(
|
||||
64
|
||||
) DEFAULT NULL , -- row modify user
|
||||
`query_text` LONGVARCHAR DEFAULT NULL , -- query text
|
||||
`semantic_parse` LONGVARCHAR DEFAULT NULL , -- parse data
|
||||
`ext_data` LONGVARCHAR DEFAULT NULL , -- extend data
|
||||
PRIMARY KEY (`chat_id`)
|
||||
`ext_data` LONGVARCHAR DEFAULT NULL , -- extend data
|
||||
PRIMARY KEY
|
||||
(
|
||||
`chat_id`
|
||||
)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_chat`
|
||||
(
|
||||
`chat_id` BIGINT auto_increment ,-- AUTO_INCREMENT,
|
||||
`chat_name` varchar(100) DEFAULT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
|
||||
`last_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
|
||||
`creator` varchar(30) DEFAULT NULL,
|
||||
`last_question` varchar(200) DEFAULT NULL,
|
||||
`is_delete` INT DEFAULT '0' COMMENT 'is deleted',
|
||||
`is_top` INT DEFAULT '0' COMMENT 'is top',
|
||||
PRIMARY KEY (`chat_id`)
|
||||
) ;
|
||||
`chat_id`
|
||||
BIGINT
|
||||
auto_increment,-- AUTO_INCREMENT,
|
||||
`chat_name`
|
||||
varchar
|
||||
(
|
||||
100
|
||||
) DEFAULT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
|
||||
`last_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP ,
|
||||
`creator` varchar
|
||||
(
|
||||
30
|
||||
) DEFAULT NULL,
|
||||
`last_question` varchar
|
||||
(
|
||||
200
|
||||
) DEFAULT NULL,
|
||||
`is_delete` INT DEFAULT '0' COMMENT 'is deleted',
|
||||
`is_top` INT DEFAULT '0' COMMENT 'is top',
|
||||
PRIMARY KEY
|
||||
(
|
||||
`chat_id`
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE `s2_chat_query`
|
||||
(
|
||||
`question_id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`query_text` mediumtext,
|
||||
`user_name` varchar(150) DEFAULT NULL COMMENT '',
|
||||
`query_state` int(1) DEFAULT NULL,
|
||||
`chat_id` BIGINT NOT NULL , -- context chat id
|
||||
`query_response` mediumtext NOT NULL ,
|
||||
`score` int DEFAULT '0',
|
||||
`feedback` varchar(1024) DEFAULT '',
|
||||
`question_id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`query_text` mediumtext,
|
||||
`user_name` varchar(150) DEFAULT NULL COMMENT '',
|
||||
`query_state` int(1) DEFAULT NULL,
|
||||
`chat_id` BIGINT NOT NULL, -- context chat id
|
||||
`query_response` mediumtext NOT NULL,
|
||||
`score` int DEFAULT '0',
|
||||
`feedback` varchar(1024) DEFAULT '',
|
||||
PRIMARY KEY (`question_id`)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_chat_config` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` INT DEFAULT NULL ,
|
||||
`chat_detail_config` varchar(655) ,
|
||||
`chat_agg_config` varchar(655) ,
|
||||
`recommended_questions` varchar(1500) ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL ,
|
||||
`status` INT NOT NULL DEFAULT '0' , -- domain extension information status : 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
PRIMARY KEY (`id`)
|
||||
) ;
|
||||
COMMENT ON TABLE s2_chat_config IS 'chat config information table ';
|
||||
CREATE TABLE IF NOT EXISTS `s2_chat_config`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`model_id`
|
||||
INT
|
||||
DEFAULT
|
||||
NULL,
|
||||
`chat_detail_config`
|
||||
varchar
|
||||
(
|
||||
655
|
||||
) ,
|
||||
`chat_agg_config` varchar
|
||||
(
|
||||
655
|
||||
) ,
|
||||
`recommended_questions` varchar
|
||||
(
|
||||
1500
|
||||
) ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`status` INT NOT NULL DEFAULT '0' , -- domain extension information status : 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT
|
||||
ON TABLE s2_chat_config IS 'chat config information table ';
|
||||
|
||||
|
||||
create table s2_user
|
||||
(
|
||||
id INT AUTO_INCREMENT,
|
||||
name varchar(100) not null,
|
||||
id INT AUTO_INCREMENT,
|
||||
name varchar(100) not null,
|
||||
display_name varchar(100) null,
|
||||
password varchar(100) null,
|
||||
email varchar(100) null,
|
||||
password varchar(100) null,
|
||||
email varchar(100) null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_user IS 'user information table';
|
||||
COMMENT
|
||||
ON TABLE s2_user IS 'user information table';
|
||||
|
||||
-- semantic tables
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_domain` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
||||
`name` varchar(255) DEFAULT NULL , -- domain name
|
||||
`biz_name` varchar(255) DEFAULT NULL , -- internal name
|
||||
`parent_id` INT DEFAULT '0' , -- parent domain ID
|
||||
`status` INT NOT NULL ,
|
||||
`created_at` TIMESTAMP DEFAULT NULL ,
|
||||
`created_by` varchar(100) DEFAULT NULL ,
|
||||
`updated_at` TIMESTAMP DEFAULT NULL ,
|
||||
`updated_by` varchar(100) DEFAULT NULL ,
|
||||
`is_unique` INT DEFAULT NULL , -- 0 is non-unique, 1 is unique
|
||||
`admin` varchar(3000) DEFAULT NULL , -- domain administrator
|
||||
`admin_org` varchar(3000) DEFAULT NULL , -- domain administrators organization
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether the domain is public
|
||||
`viewer` varchar(3000) DEFAULT NULL , -- domain available users
|
||||
`view_org` varchar(3000) DEFAULT NULL , -- domain available organization
|
||||
`entity` varchar(500) DEFAULT NULL , -- domain entity info
|
||||
PRIMARY KEY (`id`)
|
||||
CREATE TABLE IF NOT EXISTS `s2_domain`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`name`
|
||||
varchar
|
||||
(
|
||||
255
|
||||
) DEFAULT NULL , -- domain name
|
||||
`biz_name` varchar
|
||||
(
|
||||
255
|
||||
) DEFAULT NULL , -- internal name
|
||||
`parent_id` INT DEFAULT '0' , -- parent domain ID
|
||||
`status` INT NOT NULL ,
|
||||
`created_at` TIMESTAMP DEFAULT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) DEFAULT NULL ,
|
||||
`updated_at` TIMESTAMP DEFAULT NULL ,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) DEFAULT NULL ,
|
||||
`admin` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain administrator
|
||||
`admin_org` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain administrators organization
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether the domain is public
|
||||
`viewer` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain available users
|
||||
`view_org` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain available organization
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT ON TABLE s2_domain IS 'domain basic information';
|
||||
COMMENT
|
||||
ON TABLE s2_domain IS 'domain basic information';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_model`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`name`
|
||||
varchar
|
||||
(
|
||||
255
|
||||
) DEFAULT NULL , -- domain name
|
||||
`biz_name` varchar
|
||||
(
|
||||
255
|
||||
) DEFAULT NULL , -- internal name
|
||||
`domain_id` INT DEFAULT '0' , -- parent domain ID
|
||||
`created_at` TIMESTAMP DEFAULT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) DEFAULT NULL ,
|
||||
`updated_at` TIMESTAMP DEFAULT NULL ,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) DEFAULT NULL ,
|
||||
`admin` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain administrator
|
||||
`admin_org` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain administrators organization
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether the domain is public
|
||||
`viewer` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain available users
|
||||
`view_org` varchar
|
||||
(
|
||||
3000
|
||||
) DEFAULT NULL , -- domain available organization
|
||||
`entity` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL , -- domain entity info
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT
|
||||
ON TABLE s2_model IS 'model information';
|
||||
|
||||
|
||||
CREATE TABLE `s2_database` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` INT NOT NULL ,
|
||||
`name` varchar(255) NOT NULL ,
|
||||
`description` varchar(500) DEFAULT NULL ,
|
||||
`version` varchar(64) DEFAULT NULL ,
|
||||
`type` varchar(20) NOT NULL , -- type: mysql,clickhouse,tdw
|
||||
`config` varchar(655) NOT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
CREATE TABLE `s2_database`
|
||||
(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` INT NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` varchar(500) DEFAULT NULL,
|
||||
`version` varchar(64) DEFAULT NULL,
|
||||
`type` varchar(20) NOT NULL, -- type: mysql,clickhouse,tdw
|
||||
`config` varchar(655) NOT NULL,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`created_by` varchar(100) NOT NULL,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_database IS 'database instance table';
|
||||
COMMENT
|
||||
ON TABLE s2_database IS 'database instance table';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_datasource` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` INT NOT NULL ,
|
||||
`name` varchar(255) NOT NULL ,
|
||||
`biz_name` varchar(255) NOT NULL ,
|
||||
`description` varchar(500) DEFAULT NULL ,
|
||||
`database_id` INT NOT NULL ,
|
||||
`datasource_detail` LONGVARCHAR NOT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
CREATE TABLE IF NOT EXISTS `s2_datasource`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`model_id`
|
||||
INT
|
||||
NOT
|
||||
NULL,
|
||||
`name`
|
||||
varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`biz_name` varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`description` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL ,
|
||||
`database_id` INT NOT NULL ,
|
||||
`datasource_detail` LONGVARCHAR NOT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL,
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT ON TABLE s2_datasource IS 'datasource table';
|
||||
COMMENT
|
||||
ON TABLE s2_datasource IS 'datasource table';
|
||||
|
||||
create table s2_auth_groups
|
||||
(
|
||||
group_id INT,
|
||||
config varchar(2048),
|
||||
config varchar(2048),
|
||||
PRIMARY KEY (`group_id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_metric` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` INT NOT NULL ,
|
||||
`name` varchar(255) NOT NULL ,
|
||||
`biz_name` varchar(255) NOT NULL ,
|
||||
`description` varchar(500) DEFAULT NULL ,
|
||||
`status` INT NOT NULL , -- status, 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
CREATE TABLE IF NOT EXISTS `s2_metric`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`model_id`
|
||||
INT
|
||||
NOT
|
||||
NULL,
|
||||
`name`
|
||||
varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`biz_name` varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`description` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL ,
|
||||
`status` INT NOT NULL , -- status, 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
`sensitive_level` INT NOT NULL ,
|
||||
`type` varchar(50) NOT NULL , -- type proxy,expr
|
||||
`type_params` LONGVARCHAR DEFAULT NULL ,
|
||||
`type` varchar
|
||||
(
|
||||
50
|
||||
) NOT NULL , -- type proxy,expr
|
||||
`type_params` LONGVARCHAR DEFAULT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL ,
|
||||
`data_format_type` varchar(50) DEFAULT NULL ,
|
||||
`data_format` varchar(500) DEFAULT NULL,
|
||||
`alias` varchar(500) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`data_format_type` varchar
|
||||
(
|
||||
50
|
||||
) DEFAULT NULL ,
|
||||
`data_format` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL,
|
||||
`alias` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL,
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT ON TABLE s2_metric IS 'metric information table';
|
||||
COMMENT
|
||||
ON TABLE s2_metric IS 'metric information table';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_dimension` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
||||
`domain_id` INT NOT NULL ,
|
||||
`datasource_id` INT NOT NULL ,
|
||||
`name` varchar(255) NOT NULL ,
|
||||
`biz_name` varchar(255) NOT NULL ,
|
||||
`description` varchar(500) NOT NULL ,
|
||||
CREATE TABLE IF NOT EXISTS `s2_dimension`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`model_id`
|
||||
INT
|
||||
NOT
|
||||
NULL,
|
||||
`datasource_id`
|
||||
INT
|
||||
NOT
|
||||
NULL,
|
||||
`name`
|
||||
varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`biz_name` varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`description` varchar
|
||||
(
|
||||
500
|
||||
) NOT NULL ,
|
||||
`status` INT NOT NULL , -- status, 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
`sensitive_level` INT DEFAULT NULL ,
|
||||
`type` varchar(50) NOT NULL , -- type categorical,time
|
||||
`type_params` LONGVARCHAR DEFAULT NULL ,
|
||||
`type` varchar
|
||||
(
|
||||
50
|
||||
) NOT NULL , -- type categorical,time
|
||||
`type_params` LONGVARCHAR DEFAULT NULL ,
|
||||
`expr` LONGVARCHAR NOT NULL , -- expression
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL ,
|
||||
`semantic_type` varchar(20) NOT NULL, -- semantic type: DATE, ID, CATEGORY
|
||||
`alias` varchar(500) DEFAULT NULL,
|
||||
`default_values` varchar(500) DEFAULT NULL,
|
||||
`dim_value_maps` varchar(500) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`semantic_type` varchar
|
||||
(
|
||||
20
|
||||
) NOT NULL, -- semantic type: DATE, ID, CATEGORY
|
||||
`alias` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL,
|
||||
`default_values` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL,
|
||||
`dim_value_maps` varchar
|
||||
(
|
||||
500
|
||||
) DEFAULT NULL,
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT ON TABLE s2_dimension IS 'dimension information table';
|
||||
COMMENT
|
||||
ON TABLE s2_dimension IS 'dimension information table';
|
||||
|
||||
create table s2_datasource_rela
|
||||
(
|
||||
id INT AUTO_INCREMENT,
|
||||
domain_id INT null,
|
||||
datasource_from INT null,
|
||||
datasource_to INT null,
|
||||
model_id INT null,
|
||||
datasource_from INT null,
|
||||
datasource_to INT null,
|
||||
join_key varchar(100) null,
|
||||
created_at TIMESTAMP null,
|
||||
created_at TIMESTAMP null,
|
||||
created_by varchar(100) null,
|
||||
updated_at TIMESTAMP null,
|
||||
updated_at TIMESTAMP null,
|
||||
updated_by varchar(100) null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_datasource_rela IS 'data source association table';
|
||||
COMMENT
|
||||
ON TABLE s2_datasource_rela IS 'data source association table';
|
||||
|
||||
create table s2_view_info
|
||||
(
|
||||
id INT auto_increment,
|
||||
domain_id INT null,
|
||||
type varchar(20) null comment 'datasource、dimension、metric',
|
||||
config LONGVARCHAR null comment 'config detail',
|
||||
created_at TIMESTAMP null,
|
||||
model_id INT null,
|
||||
type varchar(20) null comment 'datasource、dimension、metric',
|
||||
config LONGVARCHAR null comment 'config detail',
|
||||
created_at TIMESTAMP null,
|
||||
created_by varchar(100) null,
|
||||
updated_at TIMESTAMP null,
|
||||
updated_at TIMESTAMP null,
|
||||
updated_by varchar(100) not null
|
||||
);
|
||||
COMMENT ON TABLE s2_view_info IS 'view information table';
|
||||
COMMENT
|
||||
ON TABLE s2_view_info IS 'view information table';
|
||||
|
||||
|
||||
CREATE TABLE `s2_query_stat_info` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) DEFAULT NULL, -- query unique identifier
|
||||
`domain_id` INT DEFAULT NULL,
|
||||
`user` varchar(200) DEFAULT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
|
||||
`query_type` varchar(200) DEFAULT NULL, -- the corresponding scene
|
||||
`query_type_back` INT DEFAULT '0' , -- query type, 0-normal query, 1-pre-refresh type
|
||||
`query_sql_cmd`LONGVARCHAR , -- sql type request parameter
|
||||
`sql_cmd_md5` varchar(200) DEFAULT NULL, -- sql type request parameter md5
|
||||
`query_struct_cmd`LONGVARCHAR , -- struct type request parameter
|
||||
`struct_cmd_md5` varchar(200) DEFAULT NULL, -- struct type request parameter md5值
|
||||
`sql`LONGVARCHAR ,
|
||||
`sql_md5` varchar(200) DEFAULT NULL, -- sql md5
|
||||
`query_engine` varchar(20) DEFAULT NULL,
|
||||
`elapsed_ms` bigINT DEFAULT NULL,
|
||||
`query_state` varchar(20) DEFAULT NULL,
|
||||
`native_query` INT DEFAULT NULL, -- 1-detail query, 0-aggregation query
|
||||
`start_date` varchar(50) DEFAULT NULL,
|
||||
`end_date` varchar(50) DEFAULT NULL,
|
||||
`dimensions`LONGVARCHAR , -- dimensions involved in sql
|
||||
`metrics`LONGVARCHAR , -- metric involved in sql
|
||||
`select_cols`LONGVARCHAR ,
|
||||
`agg_cols`LONGVARCHAR ,
|
||||
`filter_cols`LONGVARCHAR ,
|
||||
`group_by_cols`LONGVARCHAR ,
|
||||
`order_by_cols`LONGVARCHAR ,
|
||||
`use_result_cache` TINYINT DEFAULT '-1' , -- whether to hit the result cache
|
||||
`use_sql_cache` TINYINT DEFAULT '-1' , -- whether to hit the sql cache
|
||||
`sql_cache_key`LONGVARCHAR , -- sql cache key
|
||||
`result_cache_key`LONGVARCHAR , -- result cache key
|
||||
PRIMARY KEY (`id`)
|
||||
) ;
|
||||
COMMENT ON TABLE s2_query_stat_info IS 'query statistics table';
|
||||
CREATE TABLE `s2_query_stat_info`
|
||||
(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) DEFAULT NULL, -- query unique identifier
|
||||
`model_id` INT DEFAULT NULL,
|
||||
`user` varchar(200) DEFAULT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`query_type` varchar(200) DEFAULT NULL, -- the corresponding scene
|
||||
`query_type_back` INT DEFAULT '0', -- query type, 0-normal query, 1-pre-refresh type
|
||||
`query_sql_cmd` LONGVARCHAR, -- sql type request parameter
|
||||
`sql_cmd_md5` varchar(200) DEFAULT NULL, -- sql type request parameter md5
|
||||
`query_struct_cmd` LONGVARCHAR, -- struct type request parameter
|
||||
`struct_cmd_md5` varchar(200) DEFAULT NULL, -- struct type request parameter md5值
|
||||
`sql` LONGVARCHAR,
|
||||
`sql_md5` varchar(200) DEFAULT NULL, -- sql md5
|
||||
`query_engine` varchar(20) DEFAULT NULL,
|
||||
`elapsed_ms` bigINT DEFAULT NULL,
|
||||
`query_state` varchar(20) DEFAULT NULL,
|
||||
`native_query` INT DEFAULT NULL, -- 1-detail query, 0-aggregation query
|
||||
`start_date` varchar(50) DEFAULT NULL,
|
||||
`end_date` varchar(50) DEFAULT NULL,
|
||||
`dimensions` LONGVARCHAR, -- dimensions involved in sql
|
||||
`metrics` LONGVARCHAR, -- metric involved in sql
|
||||
`select_cols` LONGVARCHAR,
|
||||
`agg_cols` LONGVARCHAR,
|
||||
`filter_cols` LONGVARCHAR,
|
||||
`group_by_cols` LONGVARCHAR,
|
||||
`order_by_cols` LONGVARCHAR,
|
||||
`use_result_cache` TINYINT DEFAULT '-1', -- whether to hit the result cache
|
||||
`use_sql_cache` TINYINT DEFAULT '-1', -- whether to hit the sql cache
|
||||
`sql_cache_key` LONGVARCHAR, -- sql cache key
|
||||
`result_cache_key` LONGVARCHAR, -- result cache key
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT
|
||||
ON TABLE s2_query_stat_info IS 'query statistics table';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_semantic_pasre_info` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) NOT NULL ,
|
||||
`domain_id` INT NOT NULL ,
|
||||
`dimensions`LONGVARCHAR ,
|
||||
`metrics`LONGVARCHAR ,
|
||||
`orders`LONGVARCHAR ,
|
||||
`filters`LONGVARCHAR ,
|
||||
`date_info`LONGVARCHAR ,
|
||||
CREATE TABLE IF NOT EXISTS `s2_semantic_pasre_info`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`trace_id`
|
||||
varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL ,
|
||||
`model_id` INT NOT NULL ,
|
||||
`dimensions` LONGVARCHAR ,
|
||||
`metrics` LONGVARCHAR ,
|
||||
`orders` LONGVARCHAR ,
|
||||
`filters` LONGVARCHAR ,
|
||||
`date_info` LONGVARCHAR ,
|
||||
`limit` INT NOT NULL ,
|
||||
`native_query` TINYINT NOT NULL DEFAULT '0' ,
|
||||
`sql`LONGVARCHAR ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`sql` LONGVARCHAR ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`status` INT NOT NULL ,
|
||||
`elapsed_ms` bigINT DEFAULT NULL ,
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT ON TABLE s2_semantic_pasre_info IS 'semantic layer sql parsing information table';
|
||||
COMMENT
|
||||
ON TABLE s2_semantic_pasre_info IS 'semantic layer sql parsing information table';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_available_date_info` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
||||
`item_id` INT NOT NULL ,
|
||||
`type` varchar(255) NOT NULL ,
|
||||
`date_format` varchar(64) NOT NULL ,
|
||||
`start_date` varchar(64) ,
|
||||
`end_date` varchar(64) ,
|
||||
`unavailable_date` LONGVARCHAR DEFAULT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL ,
|
||||
`date_period` varchar(100) DEFAULT NULL ,
|
||||
`status` INT DEFAULT '0', -- 1-in use 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
PRIMARY KEY (`id`)
|
||||
CREATE TABLE IF NOT EXISTS `s2_available_date_info`
|
||||
(
|
||||
`id`
|
||||
INT
|
||||
NOT
|
||||
NULL
|
||||
AUTO_INCREMENT,
|
||||
`item_id`
|
||||
INT
|
||||
NOT
|
||||
NULL,
|
||||
`type`
|
||||
varchar
|
||||
(
|
||||
255
|
||||
) NOT NULL ,
|
||||
`date_format` varchar
|
||||
(
|
||||
64
|
||||
) NOT NULL ,
|
||||
`start_date` varchar
|
||||
(
|
||||
64
|
||||
) ,
|
||||
`end_date` varchar
|
||||
(
|
||||
64
|
||||
) ,
|
||||
`unavailable_date` LONGVARCHAR DEFAULT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) NOT NULL ,
|
||||
`date_period` varchar
|
||||
(
|
||||
100
|
||||
) DEFAULT NULL ,
|
||||
`status` INT DEFAULT '0', -- 1-in use 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT ON TABLE s2_dimension IS 'dimension information table';
|
||||
COMMENT
|
||||
ON TABLE s2_dimension IS 'dimension information table';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_plugin`
|
||||
(
|
||||
`id` INT AUTO_INCREMENT,
|
||||
`type` varchar(50) NULL,
|
||||
`domain` varchar(100) NULL,
|
||||
`pattern` varchar(500) NULL,
|
||||
`parse_mode` varchar(100) NULL,
|
||||
`parse_mode_config` LONGVARCHAR NULL,
|
||||
`name` varchar(100) NULL,
|
||||
`created_at` TIMESTAMP NULL,
|
||||
`created_by` varchar(100) null,
|
||||
`updated_at` TIMESTAMP NULL,
|
||||
`updated_by` varchar(100) NULL,
|
||||
`config` LONGVARCHAR NULL,
|
||||
`comment` LONGVARCHAR NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
); COMMENT ON TABLE s2_plugin IS 'plugin information table';
|
||||
`id`
|
||||
INT
|
||||
AUTO_INCREMENT,
|
||||
`type`
|
||||
varchar
|
||||
(
|
||||
50
|
||||
) NULL,
|
||||
`model` varchar
|
||||
(
|
||||
100
|
||||
) NULL,
|
||||
`pattern` varchar
|
||||
(
|
||||
500
|
||||
) NULL,
|
||||
`parse_mode` varchar
|
||||
(
|
||||
100
|
||||
) NULL,
|
||||
`parse_mode_config` LONGVARCHAR NULL,
|
||||
`name` varchar
|
||||
(
|
||||
100
|
||||
) NULL,
|
||||
`created_at` TIMESTAMP NULL,
|
||||
`created_by` varchar
|
||||
(
|
||||
100
|
||||
) null,
|
||||
`updated_at` TIMESTAMP NULL,
|
||||
`updated_by` varchar
|
||||
(
|
||||
100
|
||||
) NULL,
|
||||
`config` LONGVARCHAR NULL,
|
||||
`comment` LONGVARCHAR NULL,
|
||||
PRIMARY KEY
|
||||
(
|
||||
`id`
|
||||
)
|
||||
);
|
||||
COMMENT
|
||||
ON TABLE s2_plugin IS 'plugin information table';
|
||||
|
||||
|
||||
-------demo for semantic and chat
|
||||
CREATE TABLE IF NOT EXISTS `s2_user_department` (
|
||||
`user_name` varchar(200) NOT NULL,
|
||||
`department` varchar(200) NOT NULL -- department of user
|
||||
CREATE TABLE IF NOT EXISTS `s2_user_department`
|
||||
(
|
||||
`user_name` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`department` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL -- department of user
|
||||
);
|
||||
COMMENT ON TABLE s2_user_department IS 'user_department_info';
|
||||
COMMENT
|
||||
ON TABLE s2_user_department IS 'user_department_info';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_pv_uv_statis` (
|
||||
`imp_date` varchar(200) NOT NULL,
|
||||
`user_name` varchar(200) NOT NULL,
|
||||
`page` varchar(200) NOT NULL
|
||||
CREATE TABLE IF NOT EXISTS `s2_pv_uv_statis`
|
||||
(
|
||||
`imp_date` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`user_name` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`page` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE s2_pv_uv_statis IS 's2_pv_uv_statis';
|
||||
COMMENT
|
||||
ON TABLE s2_pv_uv_statis IS 's2_pv_uv_statis';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_stay_time_statis` (
|
||||
`imp_date` varchar(200) NOT NULL,
|
||||
`user_name` varchar(200) NOT NULL,
|
||||
CREATE TABLE IF NOT EXISTS `s2_stay_time_statis`
|
||||
(
|
||||
`imp_date` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`user_name` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`stay_hours` DOUBLE NOT NULL,
|
||||
`page` varchar(200) NOT NULL
|
||||
`page` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE s2_stay_time_statis IS 's2_stay_time_statis_info';
|
||||
COMMENT
|
||||
ON TABLE s2_stay_time_statis IS 's2_stay_time_statis_info';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `singer` (
|
||||
`imp_date` varchar(200) NOT NULL,
|
||||
`singer_name` varchar(200) NOT NULL,
|
||||
`act_area` varchar(200) NOT NULL,
|
||||
`song_name` varchar(200) NOT NULL,
|
||||
`genre` varchar(200) NOT NULL,
|
||||
CREATE TABLE IF NOT EXISTS `singer`
|
||||
(
|
||||
`imp_date` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`singer_name` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`act_area` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`song_name` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`genre` varchar
|
||||
(
|
||||
200
|
||||
) NOT NULL,
|
||||
`js_play_cnt` bigINT DEFAULT NULL,
|
||||
`down_cnt` bigINT DEFAULT NULL,
|
||||
`favor_cnt` bigINT DEFAULT NULL
|
||||
);
|
||||
COMMENT ON TABLE singer IS 'singer_info';
|
||||
COMMENT
|
||||
ON TABLE singer IS 'singer_info';
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +1,79 @@
|
||||
create table supersonic_sit.s2_auth_groups
|
||||
(
|
||||
group_id int not null
|
||||
group_id int not null
|
||||
primary key,
|
||||
config varchar(2048) null
|
||||
)
|
||||
collate = utf8mb4_unicode_ci;
|
||||
) collate = utf8mb4_unicode_ci;
|
||||
|
||||
create table supersonic_sit.s2_available_date_info
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
item_id int not null,
|
||||
type varchar(255) not null,
|
||||
date_format varchar(64) not null,
|
||||
start_date varchar(64) null,
|
||||
end_date varchar(64) null,
|
||||
unavailable_date text null,
|
||||
created_at timestamp default CURRENT_TIMESTAMP not null,
|
||||
created_by varchar(100) not null,
|
||||
updated_at timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||
updated_by varchar(100) not null,
|
||||
status int default 0 null
|
||||
)
|
||||
collate = utf8mb4_unicode_ci;
|
||||
item_id int not null,
|
||||
type varchar(255) not null,
|
||||
date_format varchar(64) not null,
|
||||
start_date varchar(64) null,
|
||||
end_date varchar(64) null,
|
||||
unavailable_date text null,
|
||||
created_at timestamp default CURRENT_TIMESTAMP not null,
|
||||
created_by varchar(100) not null,
|
||||
updated_at timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||
updated_by varchar(100) not null,
|
||||
status int default 0 null
|
||||
) collate = utf8mb4_unicode_ci;
|
||||
|
||||
create table supersonic_sit.s2_chat
|
||||
(
|
||||
chat_id bigint(8) auto_increment
|
||||
primary key,
|
||||
chat_name varchar(100) null,
|
||||
create_time datetime null,
|
||||
last_time datetime null,
|
||||
creator varchar(30) null,
|
||||
last_question varchar(200) null,
|
||||
chat_name varchar(100) null,
|
||||
create_time datetime null,
|
||||
last_time datetime null,
|
||||
creator varchar(30) null,
|
||||
last_question varchar(200) null,
|
||||
is_delete int(2) default 0 null comment 'is deleted',
|
||||
is_top int(2) default 0 null comment 'is top'
|
||||
)
|
||||
charset = utf8;
|
||||
) charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_chat_config
|
||||
(
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` bigint(20) DEFAULT NULL COMMENT '主题域id',
|
||||
`chat_detail_config` mediumtext COMMENT '明细模式配置信息',
|
||||
`chat_agg_config` mediumtext COMMENT '指标模式配置信息',
|
||||
`recommended_questions` mediumtext COMMENT '推荐问题配置',
|
||||
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||
`status` int(10) NOT NULL COMMENT '主题域扩展信息状态, 0-删除,1-生效',
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
comment '主题域扩展信息表' charset = utf8;
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`domain_id` bigint(20) DEFAULT NULL COMMENT '主题域id',
|
||||
`chat_detail_config` mediumtext COMMENT '明细模式配置信息',
|
||||
`chat_agg_config` mediumtext COMMENT '指标模式配置信息',
|
||||
`recommended_questions` mediumtext COMMENT '推荐问题配置',
|
||||
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||
`status` int(10) NOT NULL COMMENT '主题域扩展信息状态, 0-删除,1-生效',
|
||||
PRIMARY KEY (`id`)
|
||||
) comment '主题域扩展信息表' charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_chat_context
|
||||
(
|
||||
chat_id bigint not null comment 'context chat id'
|
||||
primary key,
|
||||
modified_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment 'row modify time',
|
||||
user varchar(64) null comment 'row modify user',
|
||||
query_text text null comment 'query text',
|
||||
semantic_parse text null comment 'parse data',
|
||||
ext_data text null comment 'extend data'
|
||||
)
|
||||
charset = utf8;
|
||||
user varchar(64) null comment 'row modify user',
|
||||
query_text text null comment 'query text',
|
||||
semantic_parse text null comment 'parse data',
|
||||
ext_data text null comment 'extend data'
|
||||
) charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_chat_query
|
||||
(
|
||||
question_id bigint auto_increment
|
||||
primary key,
|
||||
create_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||
query_text mediumtext null,
|
||||
user_name varchar(150) null,
|
||||
query_state int(1) null,
|
||||
query_text mediumtext null,
|
||||
user_name varchar(150) null,
|
||||
query_state int(1) null,
|
||||
chat_id bigint not null,
|
||||
query_response mediumtext not null,
|
||||
score int default 0 null,
|
||||
feedback varchar(1024) default '' null
|
||||
)
|
||||
charset = utf8;
|
||||
score int default 0 null,
|
||||
feedback varchar(1024) default '' null
|
||||
) charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_database
|
||||
(
|
||||
@@ -88,15 +82,14 @@ create table supersonic_sit.s2_database
|
||||
domain_id bigint not null comment '主题域ID',
|
||||
name varchar(255) not null comment '名称',
|
||||
description varchar(500) null comment '描述',
|
||||
version varchar(64) null comment '版本',
|
||||
version varchar(64) null comment '版本',
|
||||
type varchar(20) not null comment '类型 mysql,clickhouse,tdw',
|
||||
config text not null comment '配置信息',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
updated_by varchar(100) not null comment '更新人'
|
||||
)
|
||||
comment '数据库实例表' charset = utf8;
|
||||
) comment '数据库实例表' charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_datasource
|
||||
(
|
||||
@@ -112,147 +105,140 @@ create table supersonic_sit.s2_datasource
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
updated_by varchar(100) not null comment '更新人'
|
||||
)
|
||||
charset = utf8;
|
||||
) charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_datasource_rela
|
||||
(
|
||||
id bigint auto_increment
|
||||
primary key,
|
||||
domain_id bigint null,
|
||||
datasource_from bigint null,
|
||||
datasource_to bigint null,
|
||||
domain_id bigint null,
|
||||
datasource_from bigint null,
|
||||
datasource_to bigint null,
|
||||
join_key varchar(100) null,
|
||||
created_at datetime null,
|
||||
created_at datetime null,
|
||||
created_by varchar(100) null,
|
||||
updated_at datetime null,
|
||||
updated_at datetime null,
|
||||
updated_by varchar(100) null
|
||||
)
|
||||
charset = utf8;
|
||||
) charset = utf8;
|
||||
|
||||
|
||||
create table supersonic_sit.s2_dimension
|
||||
(
|
||||
id bigint auto_increment comment '维度ID'
|
||||
primary key,
|
||||
domain_id bigint not null comment '主题域id',
|
||||
datasource_id bigint not null comment '所属数据源id',
|
||||
name varchar(255) not null comment '维度名称',
|
||||
biz_name varchar(255) not null comment '字段名称',
|
||||
description varchar(500) not null comment '描述',
|
||||
status int(10) not null comment '维度状态,0正常,1下架,2删除',
|
||||
sensitive_level int(10) null comment '敏感级别',
|
||||
type varchar(50) not null comment '维度类型 categorical,time',
|
||||
type_params text null comment '类型参数',
|
||||
expr text not null comment '表达式',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
updated_by varchar(100) not null comment '更新人',
|
||||
semantic_type varchar(20) not null comment '语义类型DATE, ID, CATEGORY',
|
||||
domain_id bigint not null comment '主题域id',
|
||||
datasource_id bigint not null comment '所属数据源id',
|
||||
name varchar(255) not null comment '维度名称',
|
||||
biz_name varchar(255) not null comment '字段名称',
|
||||
description varchar(500) not null comment '描述',
|
||||
status int(10) not null comment '维度状态,0正常,1下架,2删除',
|
||||
sensitive_level int(10) null comment '敏感级别',
|
||||
type varchar(50) not null comment '维度类型 categorical,time',
|
||||
type_params text null comment '类型参数',
|
||||
expr text not null comment '表达式',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
updated_by varchar(100) not null comment '更新人',
|
||||
semantic_type varchar(20) not null comment '语义类型DATE, ID, CATEGORY',
|
||||
alias varchar(500) collate utf8_unicode_ci null,
|
||||
default_values varchar(500) DEFAULT NULL,
|
||||
dim_value_maps varchar(500) DEFAULT NULL
|
||||
)
|
||||
comment '维度表' charset = utf8;
|
||||
default_values varchar(500) DEFAULT NULL,
|
||||
dim_value_maps varchar(500) DEFAULT NULL
|
||||
) comment '维度表' charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_domain
|
||||
(
|
||||
id bigint auto_increment comment '自增ID'
|
||||
primary key,
|
||||
name varchar(255) null comment '主题域名称',
|
||||
biz_name varchar(255) null comment '内部名称',
|
||||
parent_id bigint default 0 null comment '父主题域ID',
|
||||
status int(10) not null comment '主题域状态',
|
||||
created_at datetime null comment '创建时间',
|
||||
created_by varchar(100) null comment '创建人',
|
||||
updated_at datetime null comment '更新时间',
|
||||
updated_by varchar(100) null comment '更新人',
|
||||
admin varchar(3000) null comment '主题域管理员',
|
||||
admin_org varchar(3000) null comment '主题域管理员组织',
|
||||
is_open int null comment '主题域是否公开',
|
||||
viewer varchar(3000) null comment '主题域可用用户',
|
||||
view_org varchar(3000) null comment '主题域可用组织',
|
||||
name varchar(255) null comment '主题域名称',
|
||||
biz_name varchar(255) null comment '内部名称',
|
||||
parent_id bigint default 0 null comment '父主题域ID',
|
||||
status int(10) not null comment '主题域状态',
|
||||
created_at datetime null comment '创建时间',
|
||||
created_by varchar(100) null comment '创建人',
|
||||
updated_at datetime null comment '更新时间',
|
||||
updated_by varchar(100) null comment '更新人',
|
||||
admin varchar(3000) null comment '主题域管理员',
|
||||
admin_org varchar(3000) null comment '主题域管理员组织',
|
||||
is_open int null comment '主题域是否公开',
|
||||
viewer varchar(3000) null comment '主题域可用用户',
|
||||
view_org varchar(3000) null comment '主题域可用组织',
|
||||
entity varchar(500) DEFAULT NULL COMMENT '主题域实体信息'
|
||||
)
|
||||
comment '主题域基础信息表' charset = utf8;
|
||||
) comment '主题域基础信息表' charset = utf8;
|
||||
|
||||
|
||||
create table supersonic_sit.s2_domain_extend
|
||||
(
|
||||
id bigint unsigned auto_increment
|
||||
primary key,
|
||||
domain_id bigint null comment '主题域id',
|
||||
domain_id bigint null comment '主题域id',
|
||||
default_metrics varchar(655) null comment '默认指标',
|
||||
visibility mediumtext null comment '不可见的维度/指标信息',
|
||||
entity_info mediumtext null comment '实体信息',
|
||||
dictionary_info mediumtext null comment '字典相关的维度设置信息',
|
||||
visibility mediumtext null comment '不可见的维度/指标信息',
|
||||
entity_info mediumtext null comment '实体信息',
|
||||
dictionary_info mediumtext null comment '字典相关的维度设置信息',
|
||||
created_at datetime not null comment '创建时间',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_by varchar(100) not null comment '更新人',
|
||||
status int(10) not null comment '主题域扩展信息状态, 0-删除,1-生效'
|
||||
)
|
||||
comment '主题域扩展信息表' collate = utf8mb4_unicode_ci;
|
||||
status int(10) not null comment '主题域扩展信息状态, 0-删除,1-生效'
|
||||
) comment '主题域扩展信息表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
create table supersonic_sit.s2_metric
|
||||
(
|
||||
id bigint auto_increment
|
||||
primary key,
|
||||
domain_id bigint not null comment '主体域ID',
|
||||
name varchar(255) not null comment '指标名称',
|
||||
biz_name varchar(255) not null comment '字段名称',
|
||||
description varchar(500) null comment '描述',
|
||||
status int(10) not null comment '指标状态,0正常,1下架,2删除',
|
||||
sensitive_level int(10) not null comment '敏感级别',
|
||||
type varchar(50) not null comment '指标类型 proxy,expr',
|
||||
type_params text not null comment '类型参数',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
updated_by varchar(100) not null comment '更新人',
|
||||
data_format_type varchar(50) null comment '数值类型',
|
||||
data_format varchar(500) null comment '数值类型参数',
|
||||
domain_id bigint not null comment '主体域ID',
|
||||
name varchar(255) not null comment '指标名称',
|
||||
biz_name varchar(255) not null comment '字段名称',
|
||||
description varchar(500) null comment '描述',
|
||||
status int(10) not null comment '指标状态,0正常,1下架,2删除',
|
||||
sensitive_level int(10) not null comment '敏感级别',
|
||||
type varchar(50) not null comment '指标类型 proxy,expr',
|
||||
type_params text not null comment '类型参数',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
updated_at datetime not null comment '更新时间',
|
||||
updated_by varchar(100) not null comment '更新人',
|
||||
data_format_type varchar(50) null comment '数值类型',
|
||||
data_format varchar(500) null comment '数值类型参数',
|
||||
alias varchar(500) collate utf8_unicode_ci null
|
||||
)
|
||||
comment '指标表' charset = utf8;
|
||||
) comment '指标表' charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_query_stat_info
|
||||
(
|
||||
id bigint unsigned auto_increment
|
||||
primary key,
|
||||
trace_id varchar(200) null comment '查询标识',
|
||||
domain_id bigint null comment '主题域ID',
|
||||
user varchar(200) null comment '执行sql的用户',
|
||||
created_at datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
query_type varchar(200) null comment '查询对应的场景',
|
||||
query_type_back int(10) default 0 null comment '查询类型, 0-正常查询, 1-预刷类型',
|
||||
query_sql_cmd mediumtext null comment '对应查询的struct',
|
||||
sql_cmd_md5 varchar(200) null comment 'sql md5值',
|
||||
query_struct_cmd mediumtext null comment '对应查询的struct',
|
||||
struct_cmd_md5 varchar(200) null comment 'sql md5值',
|
||||
`sql` mediumtext null comment '对应查询的sql',
|
||||
sql_md5 varchar(200) null comment 'sql md5值',
|
||||
query_engine varchar(20) null comment '查询引擎',
|
||||
elapsed_ms bigint(10) null comment '查询耗时',
|
||||
query_state varchar(20) null comment '查询最终状态',
|
||||
native_query int(10) null comment '1-明细查询,0-聚合查询',
|
||||
start_date varchar(50) null comment 'sql开始日期',
|
||||
end_date varchar(50) null comment 'sql结束日期',
|
||||
dimensions mediumtext null comment 'sql 涉及的维度',
|
||||
metrics mediumtext null comment 'sql 涉及的指标',
|
||||
select_cols mediumtext null comment 'sql select部分涉及的标签',
|
||||
agg_cols mediumtext null comment 'sql agg部分涉及的标签',
|
||||
filter_cols mediumtext null comment 'sql where部分涉及的标签',
|
||||
group_by_cols mediumtext null comment 'sql grouy by部分涉及的标签',
|
||||
order_by_cols mediumtext null comment 'sql order by部分涉及的标签',
|
||||
use_result_cache tinyint(1) default -1 null comment '是否命中sql缓存',
|
||||
use_sql_cache tinyint(1) default -1 null comment '是否命中sql缓存',
|
||||
sql_cache_key mediumtext null comment '缓存的key',
|
||||
result_cache_key mediumtext null comment '缓存的key'
|
||||
)
|
||||
comment '查询统计信息表' collate = utf8mb4_unicode_ci;
|
||||
trace_id varchar(200) null comment '查询标识',
|
||||
domain_id bigint null comment '主题域ID',
|
||||
user varchar(200) null comment '执行sql的用户',
|
||||
created_at datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
query_type varchar(200) null comment '查询对应的场景',
|
||||
query_type_back int(10) default 0 null comment '查询类型, 0-正常查询, 1-预刷类型',
|
||||
query_sql_cmd mediumtext null comment '对应查询的struct',
|
||||
sql_cmd_md5 varchar(200) null comment 'sql md5值',
|
||||
query_struct_cmd mediumtext null comment '对应查询的struct',
|
||||
struct_cmd_md5 varchar(200) null comment 'sql md5值',
|
||||
`sql` mediumtext null comment '对应查询的sql',
|
||||
sql_md5 varchar(200) null comment 'sql md5值',
|
||||
query_engine varchar(20) null comment '查询引擎',
|
||||
elapsed_ms bigint(10) null comment '查询耗时',
|
||||
query_state varchar(20) null comment '查询最终状态',
|
||||
native_query int(10) null comment '1-明细查询,0-聚合查询',
|
||||
start_date varchar(50) null comment 'sql开始日期',
|
||||
end_date varchar(50) null comment 'sql结束日期',
|
||||
dimensions mediumtext null comment 'sql 涉及的维度',
|
||||
metrics mediumtext null comment 'sql 涉及的指标',
|
||||
select_cols mediumtext null comment 'sql select部分涉及的标签',
|
||||
agg_cols mediumtext null comment 'sql agg部分涉及的标签',
|
||||
filter_cols mediumtext null comment 'sql where部分涉及的标签',
|
||||
group_by_cols mediumtext null comment 'sql grouy by部分涉及的标签',
|
||||
order_by_cols mediumtext null comment 'sql order by部分涉及的标签',
|
||||
use_result_cache tinyint(1) default -1 null comment '是否命中sql缓存',
|
||||
use_sql_cache tinyint(1) default -1 null comment '是否命中sql缓存',
|
||||
sql_cache_key mediumtext null comment '缓存的key',
|
||||
result_cache_key mediumtext null comment '缓存的key'
|
||||
) comment '查询统计信息表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
create index domain_index
|
||||
on supersonic_sit.s2_query_stat_info (domain_id);
|
||||
@@ -261,41 +247,42 @@ create table supersonic_sit.s2_semantic_pasre_info
|
||||
(
|
||||
id bigint unsigned auto_increment
|
||||
primary key,
|
||||
trace_id varchar(200) not null comment '查询标识',
|
||||
domain_id bigint not null comment '主体域ID',
|
||||
dimensions mediumtext null comment '查询相关的维度信息',
|
||||
metrics mediumtext null comment '查询相关的指标信息',
|
||||
orders mediumtext null comment '查询相关的排序信息',
|
||||
filters mediumtext null comment '查询相关的过滤信息',
|
||||
date_info mediumtext null comment '查询相关的日期信息',
|
||||
`limit` bigint not null comment '查询相关的limit信息',
|
||||
trace_id varchar(200) not null comment '查询标识',
|
||||
domain_id bigint not null comment '主体域ID',
|
||||
dimensions mediumtext null comment '查询相关的维度信息',
|
||||
metrics mediumtext null comment '查询相关的指标信息',
|
||||
orders mediumtext null comment '查询相关的排序信息',
|
||||
filters mediumtext null comment '查询相关的过滤信息',
|
||||
date_info mediumtext null comment '查询相关的日期信息',
|
||||
`limit` bigint not null comment '查询相关的limit信息',
|
||||
native_query tinyint(1) default 0 not null comment '1-明细查询,0-聚合查询',
|
||||
`sql` mediumtext null comment '解析后的sql',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
status int(10) not null comment '运行状态',
|
||||
elapsed_ms bigint(10) null comment 'sql解析耗时'
|
||||
`sql` mediumtext null comment '解析后的sql',
|
||||
created_at datetime not null comment '创建时间',
|
||||
created_by varchar(100) not null comment '创建人',
|
||||
status int(10) not null comment '运行状态',
|
||||
elapsed_ms bigint(10) null comment 'sql解析耗时'
|
||||
) comment '语义层sql解析信息表' charset = utf8;
|
||||
|
||||
create table supersonic_sit.s2_view_info
|
||||
(
|
||||
id bigint auto_increment
|
||||
primary key,
|
||||
domain_id bigint null,
|
||||
type varchar(20) null comment 'datasource、dimension、metric',
|
||||
config text null comment 'config detail',
|
||||
created_at datetime null,
|
||||
domain_id bigint null,
|
||||
type varchar(20) null comment 'datasource、dimension、metric',
|
||||
config text null comment 'config detail',
|
||||
created_at datetime null,
|
||||
created_by varchar(100) null,
|
||||
updated_at datetime null,
|
||||
updated_at datetime null,
|
||||
updated_by varchar(100) not null
|
||||
) charset = utf8;
|
||||
|
||||
|
||||
CREATE TABLE `s2_user` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`display_name` varchar(100) DEFAULT NULL,
|
||||
`password` varchar(100) DEFAULT NULL,
|
||||
`email` varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
CREATE TABLE `s2_user`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`display_name` varchar(100) DEFAULT NULL,
|
||||
`password` varchar(100) DEFAULT NULL,
|
||||
`email` varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
|
||||
@@ -1 +1,38 @@
|
||||
alter table s2_domain add column `entity`varchar(500) DEFAULT NULL COMMENT '主题域实体信息';
|
||||
alter table s2_domain
|
||||
add column `entity` varchar(500) DEFAULT NULL COMMENT '主题域实体信息';
|
||||
|
||||
|
||||
--20230808
|
||||
alter table s2_domain drop column entity;
|
||||
|
||||
create table s2_model
|
||||
(
|
||||
id bigint auto_increment
|
||||
primary key,
|
||||
name varchar(100) null,
|
||||
biz_name varchar(100) null,
|
||||
domain_id bigint null,
|
||||
viewer varchar(500) null,
|
||||
view_org varchar(500) null,
|
||||
admin varchar(500) null,
|
||||
admin_org varchar(500) null,
|
||||
is_open int null,
|
||||
created_by varchar(100) null,
|
||||
created_at datetime null,
|
||||
updated_by varchar(100) null,
|
||||
updated_at datetime null,
|
||||
entity text null
|
||||
) collate = utf8_unicode_ci;
|
||||
|
||||
alter table s2_datasource change column domain_id model_id bigint;
|
||||
alter table s2_dimension change column domain_id model_id bigint;
|
||||
alter table s2_metric change column domain_id model_id bigint;
|
||||
alter table s2_datasource_rela change column domain_id model_id bigint;
|
||||
alter table s2_view_info change column domain_id model_id bigint;
|
||||
alter table s2_domain_extend change column domain_id model_id bigint;
|
||||
alter table s2_chat_config change column domain_id model_id bigint;
|
||||
alter table s2_plugin change column domain model varchar (100);
|
||||
alter table s2_query_stat_info change column domain_id model_id bigint;
|
||||
|
||||
update s2_plugin
|
||||
set config = replace(config, 'domain', 'model');
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM docker-images.music.woa.com/di_base_img/tme_di_base_centos:8_7
|
||||
FROM centos:8
|
||||
MAINTAINER admin
|
||||
ADD ../../../../target/launchers-standalone-*.gz /app/
|
||||
RUN ls -l /app/launchers-standalone-*/bin/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true">
|
||||
<contextName>logback</contextName>
|
||||
<!-- <property name="LOG_PATH" value="${logback.logdir:-logs}"/>-->
|
||||
<!-- <property name="LOG_PATH" value="${logback.logdir:-logs}"/>-->
|
||||
<property name="LOG_PATH" value="${LOG_PATH:-logs}"/>
|
||||
<property name="LOG_APPNAME" value="chat"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} %line - %msg%n</pattern>
|
||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} %line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
|
||||
<FileNamePattern>${LOG_PATH}/error.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
|
||||
<FileNamePattern>${LOG_PATH}/error.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz
|
||||
</FileNamePattern>
|
||||
<!--只保留最近90天的日志-->
|
||||
<maxHistory>90</maxHistory>
|
||||
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
|
||||
@@ -74,7 +75,8 @@
|
||||
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
|
||||
<FileNamePattern>${LOG_PATH}/serviceinfo.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
|
||||
<FileNamePattern>${LOG_PATH}/serviceinfo.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz
|
||||
</FileNamePattern>
|
||||
<!--只保留最近30天的日志-->
|
||||
<maxHistory>30</maxHistory>
|
||||
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.tencent.supersonic.integration;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.tencent.supersonic.StandaloneLauncher;
|
||||
import com.tencent.supersonic.chat.api.pojo.ChatContext;
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElement;
|
||||
@@ -13,6 +15,9 @@ import com.tencent.supersonic.chat.service.ChatService;
|
||||
import com.tencent.supersonic.chat.service.ConfigService;
|
||||
import com.tencent.supersonic.chat.service.QueryService;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -20,12 +25,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = StandaloneLauncher.class)
|
||||
@ActiveProfiles("local")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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;
|
||||
@@ -9,10 +11,9 @@ import com.tencent.supersonic.chat.query.rule.metric.MetricEntityQuery;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.semantic.api.query.enums.FilterOperatorEnum;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EntityQueryTest extends BaseQueryTest {
|
||||
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
package com.tencent.supersonic.integration;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.SUM;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
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.api.pojo.request.ChatConfigEditReqReq;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.ChatConfigResp;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.ItemVisibility;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricDomainQuery;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.ChatConfigResp;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.QueryResult;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricFilterQuery;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricGroupByQuery;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricModelQuery;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricTopNQuery;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.semantic.api.query.enums.FilterOperatorEnum;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
|
||||
public class MetricQueryTest extends BaseQueryTest {
|
||||
@@ -56,7 +58,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
expectedResult.setChatContext(expectedParseInfo);
|
||||
|
||||
expectedResult.setQueryMode(MetricDomainQuery.QUERY_MODE);
|
||||
expectedResult.setQueryMode(MetricModelQuery.QUERY_MODE);
|
||||
expectedParseInfo.setAggType(NONE);
|
||||
|
||||
expectedParseInfo.getMetrics().add(DataUtils.getSchemaElement("访问次数"));
|
||||
@@ -180,7 +182,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
@Test
|
||||
public void queryTest_CONFIG_VISIBILITY() throws Exception {
|
||||
// 1. round_1 use blacklist
|
||||
ChatConfigResp chatConfig = configService.fetchConfigByDomainId(1L);
|
||||
ChatConfigResp chatConfig = configService.fetchConfigByModelId(1L);
|
||||
ChatConfigEditReqReq extendEditCmd = new ChatConfigEditReqReq();
|
||||
BeanUtils.copyProperties(chatConfig, extendEditCmd);
|
||||
// add blacklist
|
||||
@@ -193,7 +195,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
expectedResult.setChatContext(expectedParseInfo);
|
||||
|
||||
expectedResult.setQueryMode(MetricDomainQuery.QUERY_MODE);
|
||||
expectedResult.setQueryMode(MetricModelQuery.QUERY_MODE);
|
||||
expectedParseInfo.setAggType(NONE);
|
||||
|
||||
expectedParseInfo.getMetrics().add(DataUtils.getSchemaElement("访问次数"));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.tencent.supersonic.integration;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
|
||||
import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.QueryResult;
|
||||
import com.tencent.supersonic.chat.query.rule.metric.MetricFilterQuery;
|
||||
@@ -7,13 +9,10 @@ import com.tencent.supersonic.chat.query.rule.metric.MetricGroupByQuery;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.semantic.api.query.enums.FilterOperatorEnum;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Order;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Order;
|
||||
|
||||
public class MultiTurnsTest extends BaseQueryTest {
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = StandaloneLauncher.class)
|
||||
@ActiveProfiles("local")
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.tencent.supersonic.integration.plugin;
|
||||
|
||||
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.notNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.chat.parser.embedding.EmbeddingConfig;
|
||||
import com.tencent.supersonic.chat.parser.embedding.EmbeddingResp;
|
||||
@@ -8,7 +12,7 @@ import com.tencent.supersonic.chat.parser.embedding.RecallRetrieval;
|
||||
import com.tencent.supersonic.chat.plugin.PluginManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@@ -29,4 +33,9 @@ public class PluginMockConfiguration {
|
||||
when(embeddingConfig.getUrl()).thenReturn("test");
|
||||
}
|
||||
|
||||
public static void mockPluginManagerDoRequest(PluginManager pluginManager, String path,
|
||||
ResponseEntity<String> responseEntity) {
|
||||
when(pluginManager.doRequest(eq(path), notNull(String.class))).thenReturn(responseEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
package com.tencent.supersonic.integration.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilters;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.QueryResult;
|
||||
import com.tencent.supersonic.chat.parser.embedding.EmbeddingConfig;
|
||||
import com.tencent.supersonic.chat.plugin.PluginManager;
|
||||
import com.tencent.supersonic.chat.query.ContentInterpret.LLmAnswerResp;
|
||||
import com.tencent.supersonic.chat.service.QueryService;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
public class PluginRecognizeTest extends BasePluginTest{
|
||||
public class PluginRecognizeTest extends BasePluginTest {
|
||||
|
||||
@MockBean
|
||||
private EmbeddingConfig embeddingConfig;
|
||||
@@ -27,7 +31,7 @@ public class PluginRecognizeTest extends BasePluginTest{
|
||||
|
||||
@Test
|
||||
public void webPageRecognize() throws Exception {
|
||||
PluginMockConfiguration.mockEmbeddingRecognize(pluginManager, "最近的访问情况怎么样","1");
|
||||
PluginMockConfiguration.mockEmbeddingRecognize(pluginManager, "alice最近的访问情况怎么样", "1");
|
||||
PluginMockConfiguration.mockEmbeddingUrl(embeddingConfig);
|
||||
QueryReq queryContextReq = DataUtils.getQueryContextReq(1000, "alice最近的访问情况怎么样");
|
||||
QueryResult queryResult = queryService.executeQuery(queryContextReq);
|
||||
@@ -36,18 +40,32 @@ public class PluginRecognizeTest extends BasePluginTest{
|
||||
|
||||
@Test
|
||||
public void webPageRecognizeWithQueryFilter() throws Exception {
|
||||
PluginMockConfiguration.mockEmbeddingRecognize(pluginManager, "在超音数最近的情况怎么样","1");
|
||||
PluginMockConfiguration.mockEmbeddingRecognize(pluginManager, "在超音数最近的情况怎么样", "1");
|
||||
PluginMockConfiguration.mockEmbeddingUrl(embeddingConfig);
|
||||
QueryReq queryRequest = DataUtils.getQueryContextReq(1000, "在超音数最近的情况怎么样");
|
||||
QueryFilters queryFilters = new QueryFilters();
|
||||
QueryFilter queryFilter = new QueryFilter();
|
||||
queryFilter.setElementID(2L);
|
||||
queryFilter.setValue("alice");
|
||||
queryRequest.setDomainId(1L);
|
||||
queryRequest.setModelId(1L);
|
||||
queryFilters.getFilters().add(queryFilter);
|
||||
queryRequest.setQueryFilters(queryFilters);
|
||||
QueryResult queryResult = queryService.executeQuery(queryRequest);
|
||||
assertPluginRecognizeResult(queryResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contentInterpretRecognize() throws Exception {
|
||||
PluginMockConfiguration.mockEmbeddingRecognize(pluginManager, "超音数最近访问情况怎么样", "3");
|
||||
PluginMockConfiguration.mockEmbeddingUrl(embeddingConfig);
|
||||
LLmAnswerResp lLmAnswerResp = new LLmAnswerResp();
|
||||
lLmAnswerResp.setAssistant_message("超音数最近访问情况不错");
|
||||
PluginMockConfiguration.mockPluginManagerDoRequest(pluginManager, "answer_with_plugin_call",
|
||||
ResponseEntity.ok(JSONObject.toJSONString(lLmAnswerResp)));
|
||||
QueryReq queryRequest = DataUtils.getQueryContextReq(1000, "超音数最近访问情况怎么样");
|
||||
QueryResult queryResult = queryService.executeQuery(queryRequest);
|
||||
Assert.assertEquals(queryResult.getResponse(), lLmAnswerResp.getAssistant_message());
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.tencent.supersonic.util;
|
||||
|
||||
import static java.time.LocalDate.now;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElement;
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElementType;
|
||||
@@ -7,11 +9,8 @@ import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.semantic.api.query.enums.FilterOperatorEnum;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static java.time.LocalDate.now;
|
||||
|
||||
public class DataUtils {
|
||||
|
||||
private static final User user_test = new User(1L, "admin", "admin", "admin@email");
|
||||
@@ -34,9 +33,9 @@ public class DataUtils {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static SchemaElement getMetric(Long domainId, Long id, String name, String bizName) {
|
||||
public static SchemaElement getMetric(Long modelId, Long id, String name, String bizName) {
|
||||
return SchemaElement.builder()
|
||||
.domain(domainId)
|
||||
.model(modelId)
|
||||
.id(id)
|
||||
.name(name)
|
||||
.bizName(bizName)
|
||||
@@ -45,9 +44,9 @@ public class DataUtils {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static SchemaElement getDimension(Long domainId, Long id, String name, String bizName) {
|
||||
public static SchemaElement getDimension(Long modelId, Long id, String name, String bizName) {
|
||||
return SchemaElement.builder()
|
||||
.domain(domainId)
|
||||
.model(modelId)
|
||||
.id(id)
|
||||
.name(name)
|
||||
.bizName(bizName)
|
||||
@@ -56,8 +55,9 @@ public class DataUtils {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static QueryFilter getFilter(String bizName, FilterOperatorEnum filterOperatorEnum, Object value, String name,
|
||||
Long elementId) {
|
||||
public static QueryFilter getFilter(String bizName, FilterOperatorEnum filterOperatorEnum, Object value,
|
||||
String name,
|
||||
Long elementId) {
|
||||
QueryFilter filter = new QueryFilter();
|
||||
filter.setBizName(bizName);
|
||||
filter.setOperator(filterOperatorEnum);
|
||||
@@ -77,7 +77,8 @@ public class DataUtils {
|
||||
return dateInfo;
|
||||
}
|
||||
|
||||
public static DateConf getDateConf(DateConf.DateMode dateMode, Integer unit, String period, String startDate, String endDate) {
|
||||
public static DateConf getDateConf(DateConf.DateMode dateMode, Integer unit, String period, String startDate,
|
||||
String endDate) {
|
||||
DateConf dateInfo = new DateConf();
|
||||
dateInfo.setUnit(unit);
|
||||
dateInfo.setDateMode(dateMode);
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
com.tencent.supersonic.chat.api.component.SchemaMapper=\
|
||||
com.tencent.supersonic.chat.mapper.HanlpDictMapper
|
||||
|
||||
com.tencent.supersonic.chat.api.component.SemanticParser=\
|
||||
com.tencent.supersonic.chat.parser.rule.QueryModeParser, \
|
||||
com.tencent.supersonic.chat.parser.rule.ContextInheritParser, \
|
||||
com.tencent.supersonic.chat.parser.rule.TimeRangeParser, \
|
||||
com.tencent.supersonic.chat.parser.rule.AggregateTypeParser
|
||||
# com.tencent.supersonic.chat.parser.llm.DSLQueryFunction
|
||||
|
||||
com.tencent.supersonic.chat.api.component.QueryProcessor=\
|
||||
com.tencent.supersonic.chat.application.processor.SemanticQueryProcessor
|
||||
|
||||
com.tencent.supersonic.chat.api.component.SemanticLayer=\
|
||||
com.tencent.supersonic.knowledge.semantic.LocalSemanticLayer
|
||||
|
||||
com.tencent.supersonic.chat.query.QuerySelector=\
|
||||
com.tencent.supersonic.chat.query.HeuristicQuerySelector
|
||||
|
||||
com.tencent.supersonic.chat.application.query.DomainResolver=\
|
||||
com.tencent.supersonic.chat.application.query.HeuristicDomainResolver
|
||||
|
||||
com.tencent.supersonic.auth.authentication.interceptor.AuthenticationInterceptor=\
|
||||
com.tencent.supersonic.auth.authentication.interceptor.DefaultAuthenticationInterceptor
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true">
|
||||
<contextName>logback</contextName>
|
||||
<!-- <property name="LOG_PATH" value="${logback.logdir:-logs}"/>-->
|
||||
<!-- <property name="LOG_PATH" value="${logback.logdir:-logs}"/>-->
|
||||
<property name="LOG_PATH" value="${LOG_PATH:-logs}"/>
|
||||
<property name="LOG_APPNAME" value="chat"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} %line - %msg%n</pattern>
|
||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} %line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
|
||||
<FileNamePattern>${LOG_PATH}/error.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
|
||||
<FileNamePattern>${LOG_PATH}/error.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz
|
||||
</FileNamePattern>
|
||||
<!--只保留最近90天的日志-->
|
||||
<maxHistory>90</maxHistory>
|
||||
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
|
||||
@@ -74,7 +75,8 @@
|
||||
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
|
||||
<FileNamePattern>${LOG_PATH}/serviceinfo.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
|
||||
<FileNamePattern>${LOG_PATH}/serviceinfo.${LOG_APPNAME}.%d{yyyy-MM-dd}.log.gz
|
||||
</FileNamePattern>
|
||||
<!--只保留最近30天的日志-->
|
||||
<maxHistory>30</maxHistory>
|
||||
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
|
||||
|
||||
Reference in New Issue
Block a user