mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
[fix][launcher]Fix mysql scripts.
This commit is contained in:
@@ -37,8 +37,8 @@ public class OnePassSCSqlGenStrategy extends SqlGenStrategy {
|
|||||||
+ "please convert it to a SQL query so that relevant data could be returned "
|
+ "please convert it to a SQL query so that relevant data could be returned "
|
||||||
+ "by executing the SQL query against underlying database." + "\n#Rules:"
|
+ "by executing the SQL query against underlying database." + "\n#Rules:"
|
||||||
+ "\n1.SQL columns and values must be mentioned in the `Schema`, DO NOT hallucinate."
|
+ "\n1.SQL columns and values must be mentioned in the `Schema`, DO NOT hallucinate."
|
||||||
+ "\n2.ALWAYS specify date filter using `>`,`<`,`>=`,`<=` operator."
|
+ "\n2.ALWAYS specify time range using `>`,`<`,`>=`,`<=` operator."
|
||||||
+ "\n3.DO NOT include date filter in the where clause if not explicitly expressed in the `Question`."
|
+ "\n3.DO NOT include time range in the where clause if not explicitly expressed in the `Question`."
|
||||||
+ "\n4.DO NOT calculate date range using functions."
|
+ "\n4.DO NOT calculate date range using functions."
|
||||||
+ "\n5.ALWAYS use `with` statement if nested aggregation is needed."
|
+ "\n5.ALWAYS use `with` statement if nested aggregation is needed."
|
||||||
+ "\n6.ALWAYS enclose alias declared by `AS` command in underscores."
|
+ "\n6.ALWAYS enclose alias declared by `AS` command in underscores."
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ public abstract class S2BaseDemo implements CommandLineRunner {
|
|||||||
}
|
}
|
||||||
String url = dataSourceProperties.getUrl();
|
String url = dataSourceProperties.getUrl();
|
||||||
DatabaseReq databaseReq = new DatabaseReq();
|
DatabaseReq databaseReq = new DatabaseReq();
|
||||||
databaseReq.setName("H2数据库DEMO");
|
databaseReq.setName("S2数据库DEMO");
|
||||||
databaseReq.setDescription("样例数据库实例仅用于体验,正式使用请切换持久化数据库");
|
databaseReq.setDescription("样例数据库实例仅用于体验");
|
||||||
if (StringUtils.isNotBlank(url)
|
if (StringUtils.isNotBlank(url)
|
||||||
&& url.toLowerCase().contains(DataType.MYSQL.getFeature().toLowerCase())) {
|
&& url.toLowerCase().contains(DataType.MYSQL.getFeature().toLowerCase())) {
|
||||||
databaseReq.setType(DataType.MYSQL.getFeature());
|
databaseReq.setType(DataType.MYSQL.getFeature());
|
||||||
|
|||||||
@@ -12,3 +12,19 @@ spring:
|
|||||||
console:
|
console:
|
||||||
path: /h2-console/semantic
|
path: /h2-console/semantic
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
### Comment out following lines if using MySQL
|
||||||
|
#spring:
|
||||||
|
# datasource:
|
||||||
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
# url: jdbc:mysql://localhost:3306/s2_database?user=root
|
||||||
|
# username: root
|
||||||
|
# password:
|
||||||
|
# sql:
|
||||||
|
# init:
|
||||||
|
# schema-locations: classpath:db/schema-mysql.sql,classpath:db/schema-mysql-demo.sql
|
||||||
|
# data-locations: classpath:db/data-mysql.sql,classpath:db/data-mysql-demo.sql
|
||||||
|
# h2:
|
||||||
|
# console:
|
||||||
|
# path: /h2-console/semantic
|
||||||
|
# enabled: true
|
||||||
@@ -396,5 +396,5 @@ ALTER TABLE s2_agent DROP COLUMN `enable_memory_review`;
|
|||||||
alter table s2_agent add column `enable_feedback` tinyint DEFAULT 1;
|
alter table s2_agent add column `enable_feedback` tinyint DEFAULT 1;
|
||||||
|
|
||||||
--20241116
|
--20241116
|
||||||
alter table s2_agent add column `admin` varchar(1000);
|
alter table s2_agent add column `admin` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL;
|
||||||
alter table s2_agent add column `viewer` varchar(1000);
|
alter table s2_agent add column `viewer` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
-------S2VisitsDemo
|
-- S2VisitsDemo
|
||||||
insert into s2_user_department (user_name, department) values ('jack','HR');
|
insert into s2_user_department (user_name, department) values ('jack','HR');
|
||||||
insert into s2_user_department (user_name, department) values ('tom','sales');
|
insert into s2_user_department (user_name, department) values ('tom','sales');
|
||||||
insert into s2_user_department (user_name, department) values ('lucy','marketing');
|
insert into s2_user_department (user_name, department) values ('lucy','marketing');
|
||||||
@@ -1019,7 +1019,7 @@ INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (
|
|||||||
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATE_SUB(CURRENT_DATE(), INTERVAL 15 DAY), 'lucy', '0.8124302447925607', 'p4');
|
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATE_SUB(CURRENT_DATE(), INTERVAL 15 DAY), 'lucy', '0.8124302447925607', 'p4');
|
||||||
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATE_SUB(CURRENT_DATE(), INTERVAL 8 DAY), 'lucy', '0.039935860913407284', 'p2');
|
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATE_SUB(CURRENT_DATE(), INTERVAL 8 DAY), 'lucy', '0.039935860913407284', 'p2');
|
||||||
|
|
||||||
-------S2ArtistDemo
|
-- S2ArtistDemo
|
||||||
INSERT INTO singer (singer_name, act_area, song_name, genre, js_play_cnt, down_cnt, favor_cnt)
|
INSERT INTO singer (singer_name, act_area, song_name, genre, js_play_cnt, down_cnt, favor_cnt)
|
||||||
VALUES ('周杰伦', '港台', '青花瓷', '国风', 1000000, 1000000, 1000000);
|
VALUES ('周杰伦', '港台', '青花瓷', '国风', 1000000, 1000000, 1000000);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-------S2VisitsDemo
|
-- S2VisitsDemo
|
||||||
CREATE TABLE IF NOT EXISTS `s2_user_department` (
|
CREATE TABLE IF NOT EXISTS `s2_user_department` (
|
||||||
`user_name` varchar(200) NOT NULL,
|
`user_name` varchar(200) NOT NULL,
|
||||||
`department` varchar(200) NOT NULL
|
`department` varchar(200) NOT NULL
|
||||||
@@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `singer` (
|
|||||||
`favor_cnt` bigint DEFAULT NULL
|
`favor_cnt` bigint DEFAULT NULL
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
-------S2ArtistDemo
|
-- S2ArtistDemo
|
||||||
CREATE TABLE IF NOT EXISTS `genre` (
|
CREATE TABLE IF NOT EXISTS `genre` (
|
||||||
`g_name` varchar(20) NOT NULL , -- genre name
|
`g_name` varchar(20) NOT NULL , -- genre name
|
||||||
`rating` INT ,
|
`rating` INT ,
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ CREATE TABLE IF NOT EXISTS `s2_agent` (
|
|||||||
`created_at` datetime DEFAULT NULL,
|
`created_at` datetime DEFAULT NULL,
|
||||||
`updated_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
`updated_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
`updated_at` datetime DEFAULT NULL,
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`admin` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`viewer` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,12 @@ public class LLMConfigUtils {
|
|||||||
OPENAI_GLM(false),
|
OPENAI_GLM(false),
|
||||||
OLLAMA_LLAMA3(true),
|
OLLAMA_LLAMA3(true),
|
||||||
OLLAMA_QWEN2(true),
|
OLLAMA_QWEN2(true),
|
||||||
OLLAMA_QWEN25(true);
|
OLLAMA_QWEN25_7B(true),
|
||||||
|
OLLAMA_QWEN25_14B(true),
|
||||||
|
OLLAMA_QWEN25_CODE_7B(true),
|
||||||
|
OLLAMA_QWEN25_CODE_3B(true),
|
||||||
|
OLLAMA_GLM4(true);
|
||||||
|
|
||||||
|
|
||||||
public boolean isOllam;
|
public boolean isOllam;
|
||||||
|
|
||||||
@@ -35,10 +40,26 @@ public class LLMConfigUtils {
|
|||||||
baseUrl = "http://localhost:11434";
|
baseUrl = "http://localhost:11434";
|
||||||
modelName = "qwen2:7b";
|
modelName = "qwen2:7b";
|
||||||
break;
|
break;
|
||||||
case OLLAMA_QWEN25:
|
case OLLAMA_QWEN25_7B:
|
||||||
baseUrl = "http://localhost:11434";
|
baseUrl = "http://localhost:11434";
|
||||||
modelName = "qwen2.5:7b";
|
modelName = "qwen2.5:7b";
|
||||||
break;
|
break;
|
||||||
|
case OLLAMA_QWEN25_14B:
|
||||||
|
baseUrl = "http://localhost:11434";
|
||||||
|
modelName = "qwen2.5:14b";
|
||||||
|
break;
|
||||||
|
case OLLAMA_QWEN25_CODE_7B:
|
||||||
|
baseUrl = "http://localhost:11434";
|
||||||
|
modelName = "qwen2.5-coder:7b";
|
||||||
|
break;
|
||||||
|
case OLLAMA_QWEN25_CODE_3B:
|
||||||
|
baseUrl = "http://localhost:11434";
|
||||||
|
modelName = "qwen2.5-coder:3b";
|
||||||
|
break;
|
||||||
|
case OLLAMA_GLM4:
|
||||||
|
baseUrl = "http://localhost:11434";
|
||||||
|
modelName = "glm4:latest";
|
||||||
|
break;
|
||||||
case OPENAI_GLM:
|
case OPENAI_GLM:
|
||||||
baseUrl = "https://open.bigmodel.cn/api/pas/v4/";
|
baseUrl = "https://open.bigmodel.cn/api/pas/v4/";
|
||||||
apiKey = "REPLACE_WITH_YOUR_KEY";
|
apiKey = "REPLACE_WITH_YOUR_KEY";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.h2.Driver
|
driver-class-name: org.h2.Driver
|
||||||
url: jdbc:h2:mem:semantic;DATABASE_TO_UPPER=false;QUERY_TIMEOUT=100
|
url: jdbc:h2:mem:semantic;DATABASE_TO_UPPER=false;QUERY_TIMEOUT=30
|
||||||
username: root
|
username: root
|
||||||
password: semantic
|
password: semantic
|
||||||
sql:
|
sql:
|
||||||
@@ -12,3 +12,19 @@ spring:
|
|||||||
console:
|
console:
|
||||||
path: /h2-console/semantic
|
path: /h2-console/semantic
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
### Comment out following lines if using MySQL
|
||||||
|
#spring:
|
||||||
|
# datasource:
|
||||||
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
# url: jdbc:mysql://localhost:3306/s2_database?user=root
|
||||||
|
# username: root
|
||||||
|
# password:
|
||||||
|
# sql:
|
||||||
|
# init:
|
||||||
|
# schema-locations: classpath:db/schema-mysql.sql,classpath:db/schema-mysql-demo.sql
|
||||||
|
# data-locations: classpath:db/data-mysql.sql,classpath:db/data-mysql-demo.sql
|
||||||
|
# h2:
|
||||||
|
# console:
|
||||||
|
# path: /h2-console/semantic
|
||||||
|
# enabled: true
|
||||||
Reference in New Issue
Block a user