mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-28 20:04:27 +08:00
headless integrates knowledge (#722)
This commit is contained in:
@@ -23,6 +23,7 @@ import com.tencent.supersonic.common.pojo.SysParameter;
|
||||
import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import com.tencent.supersonic.common.service.SysParameterService;
|
||||
import com.tencent.supersonic.common.util.JsonUtil;
|
||||
import com.tencent.supersonic.headless.server.service.KnowledgeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -51,6 +53,8 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
private AgentService agentService;
|
||||
@Autowired
|
||||
private SysParameterService sysParameterService;
|
||||
@Autowired
|
||||
private KnowledgeService knowledgeService;
|
||||
|
||||
@Value("${demo.enabled:false}")
|
||||
private boolean demoEnabled;
|
||||
@@ -91,7 +95,10 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
queryRequest.setAgentId(1);
|
||||
queryRequest.setUser(User.getFakeUser());
|
||||
ParseResp parseResp = queryService.performParsing(queryRequest);
|
||||
|
||||
if (CollectionUtils.isEmpty(parseResp.getSelectedParses())) {
|
||||
log.info("parseResp.getSelectedParses() is empty");
|
||||
return;
|
||||
}
|
||||
ExecuteQueryReq executeReq = ExecuteQueryReq.builder().build();
|
||||
executeReq.setQueryId(parseResp.getQueryId());
|
||||
executeReq.setParseId(parseResp.getSelectedParses().get(0).getId());
|
||||
|
||||
@@ -28,8 +28,8 @@ com.tencent.supersonic.chat.server.processor.parse.ParseResultProcessor=\
|
||||
com.tencent.supersonic.chat.server.processor.parse.RespBuildProcessor, \
|
||||
com.tencent.supersonic.chat.server.processor.parse.QueryRecommendProcessor
|
||||
|
||||
com.tencent.supersonic.chat.core.knowledge.semantic.SemanticInterpreter=\
|
||||
com.tencent.supersonic.chat.core.knowledge.semantic.LocalSemanticInterpreter
|
||||
com.tencent.supersonic.chat.core.query.semantic.SemanticInterpreter=\
|
||||
com.tencent.supersonic.chat.core.query.semantic.LocalSemanticInterpreter
|
||||
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.ViewResolver=\
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.HeuristicViewResolver
|
||||
|
||||
@@ -393,19 +393,30 @@ CREATE TABLE IF NOT EXISTS `singer` (
|
||||
);
|
||||
COMMENT ON TABLE singer IS 'singer_info';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_dictionary_conf` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`description` varchar(255) ,
|
||||
`type` varchar(255) NOT NULL ,
|
||||
`item_id` INT NOT NULL , -- task Request Parameters md5
|
||||
`config` LONGVARCHAR , -- remark related information
|
||||
`status` varchar(255) NOT NULL , -- the final status of the task
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_dictionary_conf IS 'dictionary conf information table';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL , -- task name
|
||||
`description` varchar(255) ,
|
||||
`command`LONGVARCHAR NOT NULL , -- task Request Parameters
|
||||
`command_md5` varchar(255) NOT NULL , -- task Request Parameters md5
|
||||
`status` INT NOT NULL , -- the final status of the task
|
||||
`dimension_ids` varchar(500) NULL ,
|
||||
`type` varchar(255) NOT NULL ,
|
||||
`item_id` INT NOT NULL , -- task Request Parameters md5
|
||||
`config` LONGVARCHAR , -- remark related information
|
||||
`status` varchar(255) NOT NULL , -- the final status of the task
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`progress` DOUBLE default 0.00 , -- task real-time progress
|
||||
`elapsed_ms` bigINT DEFAULT NULL , -- the task takes time in milliseconds
|
||||
`message` LONGVARCHAR , -- remark related information
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_dictionary_task IS 'dictionary task information table';
|
||||
|
||||
@@ -201,37 +201,33 @@ CREATE TABLE `s2_database` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据库实例表';
|
||||
|
||||
CREATE TABLE `s2_dictionary` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`item_id` bigint(20) DEFAULT NULL COMMENT '对应维度id、指标id等',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '对应维度、指标等',
|
||||
`black_list` mediumtext COMMENT '字典黑名单',
|
||||
`white_list` mediumtext COMMENT '字典白名单',
|
||||
`rule_list` mediumtext COMMENT '字典规则',
|
||||
`is_dict_Info` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-开启写入字典,0-不开启',
|
||||
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||
`updated_by` varchar(100) DEFAULT NULL COMMENT '更新人',
|
||||
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-删除,0-可用',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典配置信息表';
|
||||
CREATE TABLE IF NOT EXISTS `s2_dictionary_conf` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`description` varchar(255) ,
|
||||
`type` varchar(255) NOT NULL ,
|
||||
`item_id` INT NOT NULL , -- task Request Parameters md5
|
||||
`config` mediumtext , -- remark related information
|
||||
`status` varchar(255) NOT NULL , -- the final status of the task
|
||||
`created_at` datetime NOT NULL COMMENT '创建时间' ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_dictionary_conf IS '字典配置信息表';
|
||||
|
||||
CREATE TABLE `s2_dictionary_task` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务名称',
|
||||
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '任务描述',
|
||||
`command` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务请求参数',
|
||||
`command_md5` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务请求参数',
|
||||
`dimension_ids` mediumtext NULL COMMENT '本次执行维度列表',
|
||||
`status` int(10) NOT NULL COMMENT '任务最终运行状态',
|
||||
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`created_by` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建人',
|
||||
`progress` double(3,2) DEFAULT '0.00' COMMENT '任务进度',
|
||||
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT '任务耗时',
|
||||
`message` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '备注相关信息',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典任务信息表';
|
||||
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL , -- task name
|
||||
`description` varchar(255) ,
|
||||
`type` varchar(255) NOT NULL ,
|
||||
`item_id` INT NOT NULL , -- task Request Parameters md5
|
||||
`config` mediumtext , -- remark related information
|
||||
`status` varchar(255) NOT NULL , -- the final status of the task
|
||||
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`elapsed_ms` int(10) DEFAULT NULL , -- the task takes time in milliseconds
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_dictionary_task IS 'dictionary task information table';
|
||||
|
||||
|
||||
CREATE TABLE `s2_dimension` (
|
||||
|
||||
Reference in New Issue
Block a user