mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-26 10:14:19 +08:00
(improvement)(headless)(chat) Add views and adapt chat and headless (#700)
* (improvement)(headless)(chat) Add views and adapt chat and headless --------- Co-authored-by: jolunoluo
This commit is contained in:
@@ -2,8 +2,7 @@ com.tencent.supersonic.chat.core.mapper.SchemaMapper=\
|
||||
com.tencent.supersonic.chat.core.mapper.EmbeddingMapper, \
|
||||
com.tencent.supersonic.chat.core.mapper.KeywordMapper, \
|
||||
com.tencent.supersonic.chat.core.mapper.QueryFilterMapper, \
|
||||
com.tencent.supersonic.chat.core.mapper.EntityMapper, \
|
||||
com.tencent.supersonic.chat.core.mapper.ModelClusterMapper
|
||||
com.tencent.supersonic.chat.core.mapper.EntityMapper
|
||||
|
||||
com.tencent.supersonic.chat.core.parser.SemanticParser=\
|
||||
com.tencent.supersonic.chat.core.parser.sql.rule.RuleSqlParser, \
|
||||
@@ -17,8 +16,7 @@ com.tencent.supersonic.chat.core.corrector.SemanticCorrector=\
|
||||
com.tencent.supersonic.chat.core.corrector.SelectCorrector, \
|
||||
com.tencent.supersonic.chat.core.corrector.WhereCorrector, \
|
||||
com.tencent.supersonic.chat.core.corrector.GroupByCorrector, \
|
||||
com.tencent.supersonic.chat.core.corrector.HavingCorrector, \
|
||||
com.tencent.supersonic.chat.core.corrector.FromCorrector
|
||||
com.tencent.supersonic.chat.core.corrector.HavingCorrector
|
||||
|
||||
com.tencent.supersonic.chat.server.processor.parse.ParseResultProcessor=\
|
||||
com.tencent.supersonic.chat.server.processor.parse.MetricCheckProcessor, \
|
||||
@@ -33,8 +31,8 @@ com.tencent.supersonic.chat.server.processor.parse.ParseResultProcessor=\
|
||||
com.tencent.supersonic.chat.core.knowledge.semantic.SemanticInterpreter=\
|
||||
com.tencent.supersonic.chat.core.knowledge.semantic.LocalSemanticInterpreter
|
||||
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.ModelResolver=\
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.HeuristicModelResolver
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.ViewResolver=\
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.HeuristicViewResolver
|
||||
|
||||
com.tencent.supersonic.auth.authentication.interceptor.AuthenticationInterceptor=\
|
||||
com.tencent.supersonic.auth.authentication.interceptor.DefaultAuthenticationInterceptor
|
||||
|
||||
@@ -168,4 +168,25 @@ CREATE TABLE `s2_app`
|
||||
|
||||
--20240115
|
||||
alter table s2_metric add column `define_type` varchar(50) DEFAULT NULL; -- MEASURE, FIELD, METRIC
|
||||
update s2_metric set define_type = 'MEASURE';
|
||||
update s2_metric set define_type = 'MEASURE';
|
||||
|
||||
--20240129
|
||||
CREATE TABLE s2_view(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
domain_id BIGINT,
|
||||
`name` VARCHAR(255),
|
||||
biz_name VARCHAR(255),
|
||||
`description` VARCHAR(255),
|
||||
`status` INT,
|
||||
alias VARCHAR(255),
|
||||
view_detail text,
|
||||
created_at datetime,
|
||||
created_by VARCHAR(255),
|
||||
updated_at datetime,
|
||||
updated_by VARCHAR(255)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
alter table s2_plugin change column model `view` varchar(100);
|
||||
alter table s2_view_info rename to s2_canvas;
|
||||
|
||||
alter table s2_query_stat_info add column `view_id` bigint(20) DEFAULT NULL after `model_id`;
|
||||
@@ -5,14 +5,14 @@ dean _1_2 36
|
||||
john _1_2 50
|
||||
jack _1_2 38
|
||||
admin _1_2 70
|
||||
周杰伦 _4_7 100
|
||||
陈奕迅 _4_7 100
|
||||
林俊杰 _4_7 100
|
||||
张碧晨 _4_7 100
|
||||
程响 _4_7 100
|
||||
Taylor#Swift _4_7 100
|
||||
内地 _4_4 100
|
||||
欧美 _4_4 100
|
||||
港台 _4_4 100
|
||||
流行 _4_6 100
|
||||
国风 _4_6 100
|
||||
周杰伦 _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_4 100
|
||||
流行 _2_6 100
|
||||
国风 _2_6 100
|
||||
@@ -1,6 +1,6 @@
|
||||
p1 _3_3 52
|
||||
p2 _3_3 47
|
||||
p3 _3_3 31
|
||||
p4 _3_3 36
|
||||
p5 _3_3 50
|
||||
p6 _3_3 38
|
||||
p1 _2_3 52
|
||||
p2 _2_3 47
|
||||
p3 _2_3 31
|
||||
p4 _2_3 36
|
||||
p5 _2_3 50
|
||||
p6 _2_3 38
|
||||
@@ -1,9 +1,9 @@
|
||||
周杰伦 _4_7 9000
|
||||
周深 _4_7 8000
|
||||
周传雄 _4_7 7000
|
||||
周华建 _4_7 6000
|
||||
陈奕迅 _4_7 8000
|
||||
林俊杰 _4_7 7000
|
||||
张碧晨 _4_7 7000
|
||||
程响 _4_7 7000
|
||||
Taylor#Swift _4_7 7000
|
||||
周杰伦 _2_7 9000
|
||||
周深 _2_7 8000
|
||||
周传雄 _2_7 7000
|
||||
周华建 _2_7 6000
|
||||
陈奕迅 _2_7 8000
|
||||
林俊杰 _2_7 7000
|
||||
张碧晨 _2_7 7000
|
||||
程响 _2_7 7000
|
||||
Taylor#Swift _2_7 7000
|
||||
@@ -12,7 +12,7 @@ values (2 , 2, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), D
|
||||
MERGE INTO s2_available_date_info(`id`,`item_id` ,`type` ,`date_format` ,`start_date` ,`end_date` ,`unavailable_date` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (3 , 3, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), DATEADD('DAY', -1, CURRENT_DATE()), '[]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
MERGE INTO s2_view_info(`id`, `domain_id`, `type`, `config` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
MERGE INTO s2_canvas(`id`, `domain_id`, `type`, `config` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (1, 1, 'modelEdgeRelation', '[{"source":"datasource-1","target":"datasource-3","type":"polyline","id":"edge-0.305251275235679741702883718912","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"stroke":"#296df3","endArrow":true},"startPoint":{"x":-94,"y":-137.5,"anchorIndex":0,"id":"-94|||-137.5"},"endPoint":{"x":-234,"y":-45,"anchorIndex":1,"id":"-234|||-45"},"sourceAnchor":2,"targetAnchor":1,"label":"模型关系编辑"},{"source":"datasource-1","target":"datasource-2","type":"polyline","id":"edge-0.466237264629309141702883756359","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"stroke":"#296df3","endArrow":true},"startPoint":{"x":-12,"y":-137.5,"anchorIndex":1,"id":"-12|||-137.5"},"endPoint":{"x":85,"y":31.5,"anchorIndex":0,"id":"85|||31.5"},"sourceAnchor":1,"targetAnchor":2,"label":"模型关系编辑"}]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
-- sample data
|
||||
|
||||
@@ -12,7 +12,7 @@ VALUES (2, 'dimension', 'yyyy-MM-dd', DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY),
|
||||
INSERT INTO s2_available_date_info (`item_id`, `type`, `date_format`, `start_date`, `end_date`, `unavailable_date`, `created_at`, `created_by`, `updated_at`, `updated_by`)
|
||||
VALUES (3, 'dimension', 'yyyy-MM-dd', DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY), DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY), '[]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
insert into s2_view_info(`id`, `domain_id`, `type`, `config` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
insert into s2_canvas(`id`, `domain_id`, `type`, `config` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (1, 1, 'modelEdgeRelation', '[{"source":"datasource-1","target":"datasource-3","type":"polyline","id":"edge-0.305251275235679741702883718912","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"stroke":"#296df3","endArrow":true},"startPoint":{"x":-94,"y":-137.5,"anchorIndex":0,"id":"-94|||-137.5"},"endPoint":{"x":-234,"y":-45,"anchorIndex":1,"id":"-234|||-45"},"sourceAnchor":2,"targetAnchor":1,"label":"模型关系编辑"},{"source":"datasource-1","target":"datasource-2","type":"polyline","id":"edge-0.466237264629309141702883756359","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"stroke":"#296df3","endArrow":true},"startPoint":{"x":-12,"y":-137.5,"anchorIndex":1,"id":"-12|||-137.5"},"endPoint":{"x":85,"y":31.5,"anchorIndex":0,"id":"85|||31.5"},"sourceAnchor":1,"targetAnchor":2,"label":"模型关系编辑"}]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
-- sample data
|
||||
|
||||
@@ -230,8 +230,7 @@ CREATE TABLE IF NOT EXISTS s2_model_rela
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
create table IF NOT EXISTS s2_view_info
|
||||
(
|
||||
create table IF NOT EXISTS `s2_canvas` (
|
||||
id INT auto_increment,
|
||||
domain_id INT null,
|
||||
type varchar(20) null comment 'model、dimension、metric',
|
||||
@@ -242,13 +241,14 @@ create table IF NOT EXISTS s2_view_info
|
||||
updated_by varchar(100) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_view_info IS 'view information table';
|
||||
COMMENT ON TABLE s2_canvas IS 'canvas table';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) DEFAULT NULL, -- query unique identifier
|
||||
`model_id` INT DEFAULT NULL,
|
||||
`view_id` INT DEFAULT NULL,
|
||||
`user` varchar(200) DEFAULT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
|
||||
`query_type` varchar(200) DEFAULT NULL, -- the corresponding scene
|
||||
@@ -326,7 +326,7 @@ CREATE TABLE IF NOT EXISTS `s2_plugin`
|
||||
(
|
||||
`id` INT AUTO_INCREMENT,
|
||||
`type` varchar(50) NULL,
|
||||
`model` varchar(100) NULL,
|
||||
`view` varchar(100) NULL,
|
||||
`pattern` varchar(500) NULL,
|
||||
`parse_mode` varchar(100) NULL,
|
||||
`parse_mode_config` LONGVARCHAR NULL,
|
||||
@@ -544,3 +544,22 @@ CREATE TABLE IF NOT EXISTS `s2_app` (
|
||||
updated_at TIMESTAMP,
|
||||
updated_by VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_view` (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
domain_id BIGINT,
|
||||
`name` VARCHAR(255),
|
||||
biz_name VARCHAR(255),
|
||||
description VARCHAR(255),
|
||||
status INT,
|
||||
alias VARCHAR(255),
|
||||
view_detail TEXT,
|
||||
created_at TIMESTAMP,
|
||||
created_by VARCHAR(255),
|
||||
updated_at TIMESTAMP,
|
||||
updated_by VARCHAR(255),
|
||||
filter_sql VARCHAR(1000),
|
||||
query_config VARCHAR(3000),
|
||||
`admin` varchar(3000) DEFAULT NULL,
|
||||
`admin_org` varchar(3000) DEFAULT NULL
|
||||
);
|
||||
@@ -1,4 +1,3 @@
|
||||
-------demo for semantic and chat
|
||||
CREATE TABLE `s2_user_department` (
|
||||
`user_name` varchar(200) NOT NULL,
|
||||
`department` varchar(200) NOT NULL
|
||||
@@ -336,7 +335,7 @@ CREATE TABLE `s2_model` (
|
||||
CREATE TABLE `s2_plugin` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'DASHBOARD,WIDGET,URL',
|
||||
`model` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`view` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`pattern` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`parse_mode` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`parse_mode_config` text COLLATE utf8mb4_unicode_ci,
|
||||
@@ -354,6 +353,7 @@ CREATE TABLE `s2_query_stat_info` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询标识',
|
||||
`model_id` bigint(20) DEFAULT NULL,
|
||||
`view_id` bigint(20) DEFAULT NULL,
|
||||
`user` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '执行sql的用户',
|
||||
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`query_type` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询对应的场景',
|
||||
@@ -406,17 +406,18 @@ CREATE TABLE `s2_semantic_pasre_info` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='语义层sql解析信息表';
|
||||
|
||||
|
||||
CREATE TABLE `s2_view_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`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,
|
||||
`created_by` varchar(100) DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE `s2_canvas`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`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,
|
||||
`created_by` varchar(100) DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
||||
|
||||
create table s2_user
|
||||
(
|
||||
@@ -481,4 +482,24 @@ CREATE TABLE `s2_app`
|
||||
`updated_at` datetime null,
|
||||
`created_by` varchar(255) null,
|
||||
`updated_by` varchar(255) null
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE s2_view
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
domain_id BIGINT,
|
||||
`name` VARCHAR(255),
|
||||
biz_name VARCHAR(255),
|
||||
`description` VARCHAR(255),
|
||||
`status` INT,
|
||||
alias VARCHAR(255),
|
||||
view_detail text,
|
||||
created_at datetime,
|
||||
created_by VARCHAR(255),
|
||||
updated_at datetime,
|
||||
updated_by VARCHAR(255),
|
||||
filter_sql VARCHAR(1000),
|
||||
query_config VARCHAR(3000),
|
||||
`admin` varchar(3000) DEFAULT NULL,
|
||||
`admin_org` varchar(3000) DEFAULT NULL
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Reference in New Issue
Block a user