mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 22:46:49 +00:00
(feature) (common) add sys parameter setting (#377)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -8,6 +8,7 @@ import com.tencent.supersonic.chat.agent.AgentConfig;
|
||||
import com.tencent.supersonic.chat.agent.tool.AgentToolType;
|
||||
import com.tencent.supersonic.chat.agent.tool.LLMParserTool;
|
||||
import com.tencent.supersonic.chat.agent.tool.RuleQueryTool;
|
||||
import com.tencent.supersonic.common.pojo.SysParameter;
|
||||
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;
|
||||
@@ -23,6 +24,7 @@ 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.AgentService;
|
||||
import com.tencent.supersonic.common.service.SysParameterService;
|
||||
import com.tencent.supersonic.chat.service.ChatService;
|
||||
import com.tencent.supersonic.chat.service.ConfigService;
|
||||
import com.tencent.supersonic.chat.service.PluginService;
|
||||
@@ -55,6 +57,9 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
private PluginService pluginService;
|
||||
@Autowired
|
||||
private AgentService agentService;
|
||||
@Autowired
|
||||
private SysParameterService sysParameterService;
|
||||
|
||||
@Value("${spring.h2.demo.enabled:false}")
|
||||
private boolean demoEnable;
|
||||
|
||||
@@ -94,6 +99,13 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
parseAndExecute(2, "访问次数最高的部门");
|
||||
}
|
||||
|
||||
public void addChatParameter() {
|
||||
SysParameter chatParameter = new SysParameter();
|
||||
chatParameter.setId(1);
|
||||
chatParameter.init();
|
||||
sysParameterService.save(chatParameter);
|
||||
}
|
||||
|
||||
public void addDemoChatConfig_1() {
|
||||
ChatConfigBaseReq chatConfigBaseReq = new ChatConfigBaseReq();
|
||||
chatConfigBaseReq.setModelId(1L);
|
||||
@@ -294,6 +306,7 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
||||
return;
|
||||
}
|
||||
try {
|
||||
addChatParameter();
|
||||
addDemoChatConfig_1();
|
||||
addDemoChatConfig_2();
|
||||
addPlugin_1();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.tencent.supersonic.db;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -19,8 +20,8 @@ public class MybatisConfig {
|
||||
|
||||
@Bean
|
||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
|
||||
org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
bean.setConfiguration(configuration);
|
||||
bean.setDataSource(dataSource);
|
||||
|
||||
@@ -527,3 +527,9 @@ CREATE TABLE s2_materialization_record
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE s2_sys_parameter
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
admin varchar(500),
|
||||
parameters text null
|
||||
);
|
||||
@@ -445,3 +445,9 @@ CREATE TABLE `s2_materialization_record`
|
||||
UNIQUE KEY `uq_id` (`materialization_id`,`element_type`,`element_id`,`data_time`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE s2_sys_parameter
|
||||
(
|
||||
id int primary key AUTO_INCREMENT COMMENT '主键id',
|
||||
admin varchar(500) COMMENT '系统管理员',
|
||||
parameters text null COMMENT '配置项'
|
||||
);
|
||||
@@ -79,4 +79,12 @@ update s2_metric set status = 1;
|
||||
update s2_dimension set status = 1;
|
||||
|
||||
--20231110
|
||||
UPDATE `s2_agent` SET `config` = replace (`config`,'LLM_S2QL','LLM_S2SQL') WHERE `config` LIKE '%LLM_S2QL%';
|
||||
UPDATE `s2_agent` SET `config` = replace (`config`,'LLM_S2QL','LLM_S2SQL') WHERE `config` LIKE '%LLM_S2QL%';
|
||||
|
||||
--20231113
|
||||
CREATE TABLE s2_sys_parameter
|
||||
(
|
||||
id int primary key AUTO_INCREMENT COMMENT '主键id',
|
||||
admin varchar(500) COMMENT '系统管理员',
|
||||
parameters text null COMMENT '配置项'
|
||||
);
|
||||
@@ -467,6 +467,12 @@ CREATE TABLE s2_materialization_record
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE s2_sys_parameter
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
admin varchar(500),
|
||||
parameters text null
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user