Commit 2c0d4073b670f38cef348adc70698e678c267f92

Authored by 芋道源码
Committed by Gitee
2 parents 9fe1ce8e 72144950

!1458 spring ai from 1.0.1 to 1.1.0

Merge pull request !1458 from 芋道源码/feature/ai
sql/postgresql/ruoyi-vue-pro.sql
@@ -33,7 +33,7 @@ INSERT INTO dual VALUES (1); @@ -33,7 +33,7 @@ INSERT INTO dual VALUES (1);
33 DROP TABLE IF EXISTS infra_api_access_log; 33 DROP TABLE IF EXISTS infra_api_access_log;
34 CREATE TABLE infra_api_access_log 34 CREATE TABLE infra_api_access_log
35 ( 35 (
36 - id int8 NOT NULL, 36 + id int8 NOT NULL DEFAULT NEXTVAL('infra_api_access_log_seq'),
37 trace_id varchar(64) NOT NULL DEFAULT '', 37 trace_id varchar(64) NOT NULL DEFAULT '',
38 user_id int8 NOT NULL DEFAULT 0, 38 user_id int8 NOT NULL DEFAULT 0,
39 user_type int2 NOT NULL DEFAULT 0, 39 user_type int2 NOT NULL DEFAULT 0,
@@ -102,7 +102,7 @@ CREATE SEQUENCE infra_api_access_log_seq @@ -102,7 +102,7 @@ CREATE SEQUENCE infra_api_access_log_seq
102 DROP TABLE IF EXISTS infra_api_error_log; 102 DROP TABLE IF EXISTS infra_api_error_log;
103 CREATE TABLE infra_api_error_log 103 CREATE TABLE infra_api_error_log
104 ( 104 (
105 - id int8 NOT NULL, 105 + id int8 NOT NULL DEFAULT NEXTVAL('infra_api_error_log_seq'),
106 trace_id varchar(64) NOT NULL, 106 trace_id varchar(64) NOT NULL,
107 user_id int8 NOT NULL DEFAULT 0, 107 user_id int8 NOT NULL DEFAULT 0,
108 user_type int2 NOT NULL DEFAULT 0, 108 user_type int2 NOT NULL DEFAULT 0,
@@ -175,7 +175,7 @@ CREATE SEQUENCE infra_api_error_log_seq @@ -175,7 +175,7 @@ CREATE SEQUENCE infra_api_error_log_seq
175 DROP TABLE IF EXISTS infra_codegen_column; 175 DROP TABLE IF EXISTS infra_codegen_column;
176 CREATE TABLE infra_codegen_column 176 CREATE TABLE infra_codegen_column
177 ( 177 (
178 - id int8 NOT NULL, 178 + id int8 NOT NULL default nextval('infra_codegen_column_seq'),
179 table_id int8 NOT NULL, 179 table_id int8 NOT NULL,
180 column_name varchar(200) NOT NULL, 180 column_name varchar(200) NOT NULL,
181 data_type varchar(100) NOT NULL, 181 data_type varchar(100) NOT NULL,
@@ -238,7 +238,7 @@ CREATE SEQUENCE infra_codegen_column_seq @@ -238,7 +238,7 @@ CREATE SEQUENCE infra_codegen_column_seq
238 DROP TABLE IF EXISTS infra_codegen_table; 238 DROP TABLE IF EXISTS infra_codegen_table;
239 CREATE TABLE infra_codegen_table 239 CREATE TABLE infra_codegen_table
240 ( 240 (
241 - id int8 NOT NULL, 241 + id int8 NOT NULL default nextval('infra_codegen_table_seq'),
242 data_source_config_id int8 NOT NULL, 242 data_source_config_id int8 NOT NULL,
243 scene int2 NOT NULL DEFAULT 1, 243 scene int2 NOT NULL DEFAULT 1,
244 table_name varchar(200) NOT NULL DEFAULT '', 244 table_name varchar(200) NOT NULL DEFAULT '',
@@ -303,7 +303,7 @@ CREATE SEQUENCE infra_codegen_table_seq @@ -303,7 +303,7 @@ CREATE SEQUENCE infra_codegen_table_seq
303 DROP TABLE IF EXISTS infra_config; 303 DROP TABLE IF EXISTS infra_config;
304 CREATE TABLE infra_config 304 CREATE TABLE infra_config
305 ( 305 (
306 - id int8 NOT NULL, 306 + id int8 NOT NULL default nextval('infra_config_seq'),
307 category varchar(50) NOT NULL, 307 category varchar(50) NOT NULL,
308 type int2 NOT NULL, 308 type int2 NOT NULL,
309 name varchar(100) NOT NULL DEFAULT '', 309 name varchar(100) NOT NULL DEFAULT '',
@@ -362,7 +362,7 @@ CREATE SEQUENCE infra_config_seq @@ -362,7 +362,7 @@ CREATE SEQUENCE infra_config_seq
362 DROP TABLE IF EXISTS infra_data_source_config; 362 DROP TABLE IF EXISTS infra_data_source_config;
363 CREATE TABLE infra_data_source_config 363 CREATE TABLE infra_data_source_config
364 ( 364 (
365 - id int8 NOT NULL, 365 + id int8 NOT NULL default nextval('infra_data_source_config_seq'),
366 name varchar(100) NOT NULL DEFAULT '', 366 name varchar(100) NOT NULL DEFAULT '',
367 url varchar(1024) NOT NULL, 367 url varchar(1024) NOT NULL,
368 username varchar(255) NOT NULL, 368 username varchar(255) NOT NULL,
@@ -399,7 +399,7 @@ CREATE SEQUENCE infra_data_source_config_seq @@ -399,7 +399,7 @@ CREATE SEQUENCE infra_data_source_config_seq
399 DROP TABLE IF EXISTS infra_file; 399 DROP TABLE IF EXISTS infra_file;
400 CREATE TABLE infra_file 400 CREATE TABLE infra_file
401 ( 401 (
402 - id int8 NOT NULL, 402 + id int8 NOT NULL default nextval('infra_file_seq'),
403 config_id int8 NULL DEFAULT NULL, 403 config_id int8 NULL DEFAULT NULL,
404 name varchar(256) NULL DEFAULT NULL, 404 name varchar(256) NULL DEFAULT NULL,
405 path varchar(512) NOT NULL, 405 path varchar(512) NOT NULL,
@@ -440,7 +440,7 @@ CREATE SEQUENCE infra_file_seq @@ -440,7 +440,7 @@ CREATE SEQUENCE infra_file_seq
440 DROP TABLE IF EXISTS infra_file_config; 440 DROP TABLE IF EXISTS infra_file_config;
441 CREATE TABLE infra_file_config 441 CREATE TABLE infra_file_config
442 ( 442 (
443 - id int8 NOT NULL, 443 + id int8 NOT NULL default nextval('infra_file_config_seq'),
444 name varchar(63) NOT NULL, 444 name varchar(63) NOT NULL,
445 storage int2 NOT NULL, 445 storage int2 NOT NULL,
446 remark varchar(255) NULL DEFAULT NULL, 446 remark varchar(255) NULL DEFAULT NULL,
@@ -496,7 +496,7 @@ CREATE SEQUENCE infra_file_config_seq @@ -496,7 +496,7 @@ CREATE SEQUENCE infra_file_config_seq
496 DROP TABLE IF EXISTS infra_file_content; 496 DROP TABLE IF EXISTS infra_file_content;
497 CREATE TABLE infra_file_content 497 CREATE TABLE infra_file_content
498 ( 498 (
499 - id int8 NOT NULL, 499 + id int8 NOT NULL default nextval('infra_file_content_seq'),
500 config_id int8 NOT NULL, 500 config_id int8 NOT NULL,
501 path varchar(512) NOT NULL, 501 path varchar(512) NOT NULL,
502 content bytea NOT NULL, 502 content bytea NOT NULL,
@@ -531,7 +531,7 @@ CREATE SEQUENCE infra_file_content_seq @@ -531,7 +531,7 @@ CREATE SEQUENCE infra_file_content_seq
531 DROP TABLE IF EXISTS infra_job; 531 DROP TABLE IF EXISTS infra_job;
532 CREATE TABLE infra_job 532 CREATE TABLE infra_job
533 ( 533 (
534 - id int8 NOT NULL, 534 + id int8 NOT NULL default nextval('infra_job_seq'),
535 name varchar(32) NOT NULL, 535 name varchar(32) NOT NULL,
536 status int2 NOT NULL, 536 status int2 NOT NULL,
537 handler_name varchar(64) NOT NULL, 537 handler_name varchar(64) NOT NULL,
@@ -597,7 +597,7 @@ CREATE SEQUENCE infra_job_seq @@ -597,7 +597,7 @@ CREATE SEQUENCE infra_job_seq
597 DROP TABLE IF EXISTS infra_job_log; 597 DROP TABLE IF EXISTS infra_job_log;
598 CREATE TABLE infra_job_log 598 CREATE TABLE infra_job_log
599 ( 599 (
600 - id int8 NOT NULL, 600 + id int8 NOT NULL default nextval('infra_job_log_seq'),
601 job_id int8 NOT NULL, 601 job_id int8 NOT NULL,
602 handler_name varchar(64) NOT NULL, 602 handler_name varchar(64) NOT NULL,
603 handler_param varchar(255) NULL DEFAULT NULL, 603 handler_param varchar(255) NULL DEFAULT NULL,
@@ -644,7 +644,7 @@ CREATE SEQUENCE infra_job_log_seq @@ -644,7 +644,7 @@ CREATE SEQUENCE infra_job_log_seq
644 DROP TABLE IF EXISTS system_dept; 644 DROP TABLE IF EXISTS system_dept;
645 CREATE TABLE system_dept 645 CREATE TABLE system_dept
646 ( 646 (
647 - id int8 NOT NULL, 647 + id int8 NOT NULL default nextval('system_dept_seq'),
648 name varchar(30) NOT NULL DEFAULT '', 648 name varchar(30) NOT NULL DEFAULT '',
649 parent_id int8 NOT NULL DEFAULT 0, 649 parent_id int8 NOT NULL DEFAULT 0,
650 sort int4 NOT NULL DEFAULT 0, 650 sort int4 NOT NULL DEFAULT 0,
@@ -711,7 +711,7 @@ CREATE SEQUENCE system_dept_seq @@ -711,7 +711,7 @@ CREATE SEQUENCE system_dept_seq
711 DROP TABLE IF EXISTS system_dict_data; 711 DROP TABLE IF EXISTS system_dict_data;
712 CREATE TABLE system_dict_data 712 CREATE TABLE system_dict_data
713 ( 713 (
714 - id int8 NOT NULL, 714 + id int8 NOT NULL default nextval('system_dict_data_seq'),
715 sort int4 NOT NULL DEFAULT 0, 715 sort int4 NOT NULL DEFAULT 0,
716 label varchar(100) NOT NULL DEFAULT '', 716 label varchar(100) NOT NULL DEFAULT '',
717 value varchar(100) NOT NULL DEFAULT '', 717 value varchar(100) NOT NULL DEFAULT '',
@@ -1367,7 +1367,7 @@ CREATE SEQUENCE system_dict_data_seq @@ -1367,7 +1367,7 @@ CREATE SEQUENCE system_dict_data_seq
1367 DROP TABLE IF EXISTS system_dict_type; 1367 DROP TABLE IF EXISTS system_dict_type;
1368 CREATE TABLE system_dict_type 1368 CREATE TABLE system_dict_type
1369 ( 1369 (
1370 - id int8 NOT NULL, 1370 + id int8 NOT NULL default nextval('system_dict_type_seq'),
1371 name varchar(100) NOT NULL DEFAULT '', 1371 name varchar(100) NOT NULL DEFAULT '',
1372 type varchar(100) NOT NULL DEFAULT '', 1372 type varchar(100) NOT NULL DEFAULT '',
1373 status int2 NOT NULL DEFAULT 0, 1373 status int2 NOT NULL DEFAULT 0,
@@ -1521,7 +1521,7 @@ CREATE SEQUENCE system_dict_type_seq @@ -1521,7 +1521,7 @@ CREATE SEQUENCE system_dict_type_seq
1521 DROP TABLE IF EXISTS system_login_log; 1521 DROP TABLE IF EXISTS system_login_log;
1522 CREATE TABLE system_login_log 1522 CREATE TABLE system_login_log
1523 ( 1523 (
1524 - id int8 NOT NULL, 1524 + id int8 NOT NULL default nextval('system_login_log_seq'),
1525 log_type int8 NOT NULL, 1525 log_type int8 NOT NULL,
1526 trace_id varchar(64) NOT NULL DEFAULT '', 1526 trace_id varchar(64) NOT NULL DEFAULT '',
1527 user_id int8 NOT NULL DEFAULT 0, 1527 user_id int8 NOT NULL DEFAULT 0,
@@ -1568,7 +1568,7 @@ CREATE SEQUENCE system_login_log_seq @@ -1568,7 +1568,7 @@ CREATE SEQUENCE system_login_log_seq
1568 DROP TABLE IF EXISTS system_mail_account; 1568 DROP TABLE IF EXISTS system_mail_account;
1569 CREATE TABLE system_mail_account 1569 CREATE TABLE system_mail_account
1570 ( 1570 (
1571 - id int8 NOT NULL, 1571 + id int8 NOT NULL default nextval('system_mail_account_seq'),
1572 mail varchar(255) NOT NULL, 1572 mail varchar(255) NOT NULL,
1573 username varchar(255) NOT NULL, 1573 username varchar(255) NOT NULL,
1574 password varchar(255) NOT NULL, 1574 password varchar(255) NOT NULL,
@@ -1623,7 +1623,7 @@ CREATE SEQUENCE system_mail_account_seq @@ -1623,7 +1623,7 @@ CREATE SEQUENCE system_mail_account_seq
1623 DROP TABLE IF EXISTS system_mail_log; 1623 DROP TABLE IF EXISTS system_mail_log;
1624 CREATE TABLE system_mail_log 1624 CREATE TABLE system_mail_log
1625 ( 1625 (
1626 - id int8 NOT NULL, 1626 + id int8 NOT NULL default nextval('system_mail_log_seq'),
1627 user_id int8 NULL DEFAULT NULL, 1627 user_id int8 NULL DEFAULT NULL,
1628 user_type int2 NULL DEFAULT NULL, 1628 user_type int2 NULL DEFAULT NULL,
1629 to_mail varchar(255) NOT NULL, 1629 to_mail varchar(255) NOT NULL,
@@ -1682,7 +1682,7 @@ CREATE SEQUENCE system_mail_log_seq @@ -1682,7 +1682,7 @@ CREATE SEQUENCE system_mail_log_seq
1682 DROP TABLE IF EXISTS system_mail_template; 1682 DROP TABLE IF EXISTS system_mail_template;
1683 CREATE TABLE system_mail_template 1683 CREATE TABLE system_mail_template
1684 ( 1684 (
1685 - id int8 NOT NULL, 1685 + id int8 NOT NULL default nextval('system_mail_template_seq'),
1686 name varchar(63) NOT NULL, 1686 name varchar(63) NOT NULL,
1687 code varchar(63) NOT NULL, 1687 code varchar(63) NOT NULL,
1688 account_id int8 NOT NULL, 1688 account_id int8 NOT NULL,
@@ -1740,7 +1740,7 @@ CREATE SEQUENCE system_mail_template_seq @@ -1740,7 +1740,7 @@ CREATE SEQUENCE system_mail_template_seq
1740 DROP TABLE IF EXISTS system_menu; 1740 DROP TABLE IF EXISTS system_menu;
1741 CREATE TABLE system_menu 1741 CREATE TABLE system_menu
1742 ( 1742 (
1743 - id int8 NOT NULL, 1743 + id int8 NOT NULL default nextval('system_menu_seq'),
1744 name varchar(50) NOT NULL, 1744 name varchar(50) NOT NULL,
1745 permission varchar(100) NOT NULL DEFAULT '', 1745 permission varchar(100) NOT NULL DEFAULT '',
1746 type int2 NOT NULL, 1746 type int2 NOT NULL,
@@ -2714,7 +2714,7 @@ CREATE SEQUENCE system_menu_seq @@ -2714,7 +2714,7 @@ CREATE SEQUENCE system_menu_seq
2714 DROP TABLE IF EXISTS system_notice; 2714 DROP TABLE IF EXISTS system_notice;
2715 CREATE TABLE system_notice 2715 CREATE TABLE system_notice
2716 ( 2716 (
2717 - id int8 NOT NULL, 2717 + id int8 NOT NULL default nextval('system_notice_seq'),
2718 title varchar(50) NOT NULL, 2718 title varchar(50) NOT NULL,
2719 content text NOT NULL, 2719 content text NOT NULL,
2720 type int2 NOT NULL, 2720 type int2 NOT NULL,
@@ -2764,7 +2764,7 @@ CREATE SEQUENCE system_notice_seq @@ -2764,7 +2764,7 @@ CREATE SEQUENCE system_notice_seq
2764 DROP TABLE IF EXISTS system_notify_message; 2764 DROP TABLE IF EXISTS system_notify_message;
2765 CREATE TABLE system_notify_message 2765 CREATE TABLE system_notify_message
2766 ( 2766 (
2767 - id int8 NOT NULL, 2767 + id int8 NOT NULL default nextval('system_notify_message_seq'),
2768 user_id int8 NOT NULL, 2768 user_id int8 NOT NULL,
2769 user_type int2 NOT NULL, 2769 user_type int2 NOT NULL,
2770 template_id int8 NOT NULL, 2770 template_id int8 NOT NULL,
@@ -2832,7 +2832,7 @@ CREATE SEQUENCE system_notify_message_seq @@ -2832,7 +2832,7 @@ CREATE SEQUENCE system_notify_message_seq
2832 DROP TABLE IF EXISTS system_notify_template; 2832 DROP TABLE IF EXISTS system_notify_template;
2833 CREATE TABLE system_notify_template 2833 CREATE TABLE system_notify_template
2834 ( 2834 (
2835 - id int8 NOT NULL, 2835 + id int8 NOT NULL default nextval('system_notify_template_seq'),
2836 name varchar(63) NOT NULL, 2836 name varchar(63) NOT NULL,
2837 code varchar(64) NOT NULL, 2837 code varchar(64) NOT NULL,
2838 nickname varchar(255) NOT NULL, 2838 nickname varchar(255) NOT NULL,
@@ -2877,7 +2877,7 @@ CREATE SEQUENCE system_notify_template_seq @@ -2877,7 +2877,7 @@ CREATE SEQUENCE system_notify_template_seq
2877 DROP TABLE IF EXISTS system_oauth2_access_token; 2877 DROP TABLE IF EXISTS system_oauth2_access_token;
2878 CREATE TABLE system_oauth2_access_token 2878 CREATE TABLE system_oauth2_access_token
2879 ( 2879 (
2880 - id int8 NOT NULL, 2880 + id int8 NOT NULL default nextval('system_oauth2_access_token_seq'),
2881 user_id int8 NOT NULL, 2881 user_id int8 NOT NULL,
2882 user_type int2 NOT NULL, 2882 user_type int2 NOT NULL,
2883 user_info varchar(512) NOT NULL, 2883 user_info varchar(512) NOT NULL,
@@ -2927,7 +2927,7 @@ CREATE SEQUENCE system_oauth2_access_token_seq @@ -2927,7 +2927,7 @@ CREATE SEQUENCE system_oauth2_access_token_seq
2927 DROP TABLE IF EXISTS system_oauth2_approve; 2927 DROP TABLE IF EXISTS system_oauth2_approve;
2928 CREATE TABLE system_oauth2_approve 2928 CREATE TABLE system_oauth2_approve
2929 ( 2929 (
2930 - id int8 NOT NULL, 2930 + id int8 NOT NULL default nextval('system_oauth2_approve_seq'),
2931 user_id int8 NOT NULL, 2931 user_id int8 NOT NULL,
2932 user_type int2 NOT NULL, 2932 user_type int2 NOT NULL,
2933 client_id varchar(255) NOT NULL, 2933 client_id varchar(255) NOT NULL,
@@ -2970,7 +2970,7 @@ CREATE SEQUENCE system_oauth2_approve_seq @@ -2970,7 +2970,7 @@ CREATE SEQUENCE system_oauth2_approve_seq
2970 DROP TABLE IF EXISTS system_oauth2_client; 2970 DROP TABLE IF EXISTS system_oauth2_client;
2971 CREATE TABLE system_oauth2_client 2971 CREATE TABLE system_oauth2_client
2972 ( 2972 (
2973 - id int8 NOT NULL, 2973 + id int8 NOT NULL default nextval('system_oauth2_client_seq'),
2974 client_id varchar(255) NOT NULL, 2974 client_id varchar(255) NOT NULL,
2975 secret varchar(255) NOT NULL, 2975 secret varchar(255) NOT NULL,
2976 name varchar(255) NOT NULL, 2976 name varchar(255) NOT NULL,
@@ -3041,7 +3041,7 @@ CREATE SEQUENCE system_oauth2_client_seq @@ -3041,7 +3041,7 @@ CREATE SEQUENCE system_oauth2_client_seq
3041 DROP TABLE IF EXISTS system_oauth2_code; 3041 DROP TABLE IF EXISTS system_oauth2_code;
3042 CREATE TABLE system_oauth2_code 3042 CREATE TABLE system_oauth2_code
3043 ( 3043 (
3044 - id int8 NOT NULL, 3044 + id int8 NOT NULL default nextval('system_oauth2_code_seq'),
3045 user_id int8 NOT NULL, 3045 user_id int8 NOT NULL,
3046 user_type int2 NOT NULL, 3046 user_type int2 NOT NULL,
3047 code varchar(32) NOT NULL, 3047 code varchar(32) NOT NULL,
@@ -3088,7 +3088,7 @@ CREATE SEQUENCE system_oauth2_code_seq @@ -3088,7 +3088,7 @@ CREATE SEQUENCE system_oauth2_code_seq
3088 DROP TABLE IF EXISTS system_oauth2_refresh_token; 3088 DROP TABLE IF EXISTS system_oauth2_refresh_token;
3089 CREATE TABLE system_oauth2_refresh_token 3089 CREATE TABLE system_oauth2_refresh_token
3090 ( 3090 (
3091 - id int8 NOT NULL, 3091 + id int8 NOT NULL default nextval('system_oauth2_refresh_token_seq'),
3092 user_id int8 NOT NULL, 3092 user_id int8 NOT NULL,
3093 refresh_token varchar(32) NOT NULL, 3093 refresh_token varchar(32) NOT NULL,
3094 user_type int2 NOT NULL, 3094 user_type int2 NOT NULL,
@@ -3131,7 +3131,7 @@ CREATE SEQUENCE system_oauth2_refresh_token_seq @@ -3131,7 +3131,7 @@ CREATE SEQUENCE system_oauth2_refresh_token_seq
3131 DROP TABLE IF EXISTS system_operate_log; 3131 DROP TABLE IF EXISTS system_operate_log;
3132 CREATE TABLE system_operate_log 3132 CREATE TABLE system_operate_log
3133 ( 3133 (
3134 - id int8 NOT NULL, 3134 + id int8 NOT NULL default nextval('system_operate_log_seq'),
3135 trace_id varchar(64) NOT NULL DEFAULT '', 3135 trace_id varchar(64) NOT NULL DEFAULT '',
3136 user_id int8 NOT NULL, 3136 user_id int8 NOT NULL,
3137 user_type int2 NOT NULL DEFAULT 0, 3137 user_type int2 NOT NULL DEFAULT 0,
@@ -3188,7 +3188,7 @@ CREATE SEQUENCE system_operate_log_seq @@ -3188,7 +3188,7 @@ CREATE SEQUENCE system_operate_log_seq
3188 DROP TABLE IF EXISTS system_post; 3188 DROP TABLE IF EXISTS system_post;
3189 CREATE TABLE system_post 3189 CREATE TABLE system_post
3190 ( 3190 (
3191 - id int8 NOT NULL, 3191 + id int8 NOT NULL default nextval('system_post_seq'),
3192 code varchar(64) NOT NULL, 3192 code varchar(64) NOT NULL,
3193 name varchar(50) NOT NULL, 3193 name varchar(50) NOT NULL,
3194 sort int4 NOT NULL, 3194 sort int4 NOT NULL,
@@ -3241,7 +3241,7 @@ CREATE SEQUENCE system_post_seq @@ -3241,7 +3241,7 @@ CREATE SEQUENCE system_post_seq
3241 DROP TABLE IF EXISTS system_role; 3241 DROP TABLE IF EXISTS system_role;
3242 CREATE TABLE system_role 3242 CREATE TABLE system_role
3243 ( 3243 (
3244 - id int8 NOT NULL, 3244 + id int8 NOT NULL default nextval('system_role_seq'),
3245 name varchar(30) NOT NULL, 3245 name varchar(30) NOT NULL,
3246 code varchar(100) NOT NULL, 3246 code varchar(100) NOT NULL,
3247 sort int4 NOT NULL, 3247 sort int4 NOT NULL,
@@ -3304,7 +3304,7 @@ CREATE SEQUENCE system_role_seq @@ -3304,7 +3304,7 @@ CREATE SEQUENCE system_role_seq
3304 DROP TABLE IF EXISTS system_role_menu; 3304 DROP TABLE IF EXISTS system_role_menu;
3305 CREATE TABLE system_role_menu 3305 CREATE TABLE system_role_menu
3306 ( 3306 (
3307 - id int8 NOT NULL, 3307 + id int8 NOT NULL default nextval('system_role_menu_seq'),
3308 role_id int8 NOT NULL, 3308 role_id int8 NOT NULL,
3309 menu_id int8 NOT NULL, 3309 menu_id int8 NOT NULL,
3310 creator varchar(64) NULL DEFAULT '', 3310 creator varchar(64) NULL DEFAULT '',
@@ -4210,7 +4210,7 @@ CREATE SEQUENCE system_role_menu_seq @@ -4210,7 +4210,7 @@ CREATE SEQUENCE system_role_menu_seq
4210 DROP TABLE IF EXISTS system_sms_channel; 4210 DROP TABLE IF EXISTS system_sms_channel;
4211 CREATE TABLE system_sms_channel 4211 CREATE TABLE system_sms_channel
4212 ( 4212 (
4213 - id int8 NOT NULL, 4213 + id int8 NOT NULL default nextval('system_sms_channel_seq'),
4214 signature varchar(12) NOT NULL, 4214 signature varchar(12) NOT NULL,
4215 code varchar(63) NOT NULL, 4215 code varchar(63) NOT NULL,
4216 status int2 NOT NULL, 4216 status int2 NOT NULL,
@@ -4264,7 +4264,7 @@ CREATE SEQUENCE system_sms_channel_seq @@ -4264,7 +4264,7 @@ CREATE SEQUENCE system_sms_channel_seq
4264 DROP TABLE IF EXISTS system_sms_code; 4264 DROP TABLE IF EXISTS system_sms_code;
4265 CREATE TABLE system_sms_code 4265 CREATE TABLE system_sms_code
4266 ( 4266 (
4267 - id int8 NOT NULL, 4267 + id int8 NOT NULL default nextval('system_sms_code_seq'),
4268 mobile varchar(11) NOT NULL, 4268 mobile varchar(11) NOT NULL,
4269 code varchar(6) NOT NULL, 4269 code varchar(6) NOT NULL,
4270 create_ip varchar(15) NOT NULL, 4270 create_ip varchar(15) NOT NULL,
@@ -4313,7 +4313,7 @@ CREATE SEQUENCE system_sms_code_seq @@ -4313,7 +4313,7 @@ CREATE SEQUENCE system_sms_code_seq
4313 DROP TABLE IF EXISTS system_sms_log; 4313 DROP TABLE IF EXISTS system_sms_log;
4314 CREATE TABLE system_sms_log 4314 CREATE TABLE system_sms_log
4315 ( 4315 (
4316 - id int8 NOT NULL, 4316 + id int8 NOT NULL default nextval('system_sms_log_seq'),
4317 channel_id int8 NOT NULL, 4317 channel_id int8 NOT NULL,
4318 channel_code varchar(63) NOT NULL, 4318 channel_code varchar(63) NOT NULL,
4319 template_id int8 NOT NULL, 4319 template_id int8 NOT NULL,
@@ -4384,7 +4384,7 @@ CREATE SEQUENCE system_sms_log_seq @@ -4384,7 +4384,7 @@ CREATE SEQUENCE system_sms_log_seq
4384 DROP TABLE IF EXISTS system_sms_template; 4384 DROP TABLE IF EXISTS system_sms_template;
4385 CREATE TABLE system_sms_template 4385 CREATE TABLE system_sms_template
4386 ( 4386 (
4387 - id int8 NOT NULL, 4387 + id int8 NOT NULL default nextval('system_sms_template_seq'),
4388 type int2 NOT NULL, 4388 type int2 NOT NULL,
4389 status int2 NOT NULL, 4389 status int2 NOT NULL,
4390 code varchar(63) NOT NULL, 4390 code varchar(63) NOT NULL,
@@ -4456,7 +4456,7 @@ CREATE SEQUENCE system_sms_template_seq @@ -4456,7 +4456,7 @@ CREATE SEQUENCE system_sms_template_seq
4456 DROP TABLE IF EXISTS system_social_client; 4456 DROP TABLE IF EXISTS system_social_client;
4457 CREATE TABLE system_social_client 4457 CREATE TABLE system_social_client
4458 ( 4458 (
4459 - id int8 NOT NULL, 4459 + id int8 NOT NULL default nextval('system_social_client_seq'),
4460 name varchar(255) NOT NULL, 4460 name varchar(255) NOT NULL,
4461 social_type int2 NOT NULL, 4461 social_type int2 NOT NULL,
4462 user_type int2 NOT NULL, 4462 user_type int2 NOT NULL,
@@ -4514,7 +4514,7 @@ CREATE SEQUENCE system_social_client_seq @@ -4514,7 +4514,7 @@ CREATE SEQUENCE system_social_client_seq
4514 DROP TABLE IF EXISTS system_social_user; 4514 DROP TABLE IF EXISTS system_social_user;
4515 CREATE TABLE system_social_user 4515 CREATE TABLE system_social_user
4516 ( 4516 (
4517 - id int8 NOT NULL, 4517 + id int8 NOT NULL default nextval('system_social_user_seq'),
4518 type int2 NOT NULL, 4518 type int2 NOT NULL,
4519 openid varchar(32) NOT NULL, 4519 openid varchar(32) NOT NULL,
4520 token varchar(256) NULL DEFAULT NULL, 4520 token varchar(256) NULL DEFAULT NULL,
@@ -4563,7 +4563,7 @@ CREATE SEQUENCE system_social_user_seq @@ -4563,7 +4563,7 @@ CREATE SEQUENCE system_social_user_seq
4563 DROP TABLE IF EXISTS system_social_user_bind; 4563 DROP TABLE IF EXISTS system_social_user_bind;
4564 CREATE TABLE system_social_user_bind 4564 CREATE TABLE system_social_user_bind
4565 ( 4565 (
4566 - id int8 NOT NULL, 4566 + id int8 NOT NULL default nextval('system_social_user_bind_seq'),
4567 user_id int8 NOT NULL, 4567 user_id int8 NOT NULL,
4568 user_type int2 NOT NULL, 4568 user_type int2 NOT NULL,
4569 social_type int2 NOT NULL, 4569 social_type int2 NOT NULL,
@@ -4602,7 +4602,7 @@ CREATE SEQUENCE system_social_user_bind_seq @@ -4602,7 +4602,7 @@ CREATE SEQUENCE system_social_user_bind_seq
4602 DROP TABLE IF EXISTS system_tenant; 4602 DROP TABLE IF EXISTS system_tenant;
4603 CREATE TABLE system_tenant 4603 CREATE TABLE system_tenant
4604 ( 4604 (
4605 - id int8 NOT NULL, 4605 + id int8 NOT NULL default nextval('system_tenant_seq'),
4606 name varchar(30) NOT NULL, 4606 name varchar(30) NOT NULL,
4607 contact_user_id int8 NULL DEFAULT NULL, 4607 contact_user_id int8 NULL DEFAULT NULL,
4608 contact_name varchar(30) NOT NULL, 4608 contact_name varchar(30) NOT NULL,
@@ -4660,7 +4660,7 @@ CREATE SEQUENCE system_tenant_seq @@ -4660,7 +4660,7 @@ CREATE SEQUENCE system_tenant_seq
4660 DROP TABLE IF EXISTS system_tenant_package; 4660 DROP TABLE IF EXISTS system_tenant_package;
4661 CREATE TABLE system_tenant_package 4661 CREATE TABLE system_tenant_package
4662 ( 4662 (
4663 - id int8 NOT NULL, 4663 + id int8 NOT NULL default nextval('system_tenant_package_seq'),
4664 name varchar(30) NOT NULL, 4664 name varchar(30) NOT NULL,
4665 status int2 NOT NULL DEFAULT 0, 4665 status int2 NOT NULL DEFAULT 0,
4666 remark varchar(256) NULL DEFAULT '', 4666 remark varchar(256) NULL DEFAULT '',
@@ -4707,7 +4707,7 @@ CREATE SEQUENCE system_tenant_package_seq @@ -4707,7 +4707,7 @@ CREATE SEQUENCE system_tenant_package_seq
4707 DROP TABLE IF EXISTS system_user_post; 4707 DROP TABLE IF EXISTS system_user_post;
4708 CREATE TABLE system_user_post 4708 CREATE TABLE system_user_post
4709 ( 4709 (
4710 - id int8 NOT NULL, 4710 + id int8 NOT NULL default nextval('system_user_post_seq'),
4711 user_id int8 NOT NULL DEFAULT 0, 4711 user_id int8 NOT NULL DEFAULT 0,
4712 post_id int8 NOT NULL DEFAULT 0, 4712 post_id int8 NOT NULL DEFAULT 0,
4713 creator varchar(64) NULL DEFAULT '', 4713 creator varchar(64) NULL DEFAULT '',
@@ -4759,7 +4759,7 @@ CREATE SEQUENCE system_user_post_seq @@ -4759,7 +4759,7 @@ CREATE SEQUENCE system_user_post_seq
4759 DROP TABLE IF EXISTS system_user_role; 4759 DROP TABLE IF EXISTS system_user_role;
4760 CREATE TABLE system_user_role 4760 CREATE TABLE system_user_role
4761 ( 4761 (
4762 - id int8 NOT NULL, 4762 + id int8 NOT NULL default nextval('system_user_role_seq'),
4763 user_id int8 NOT NULL, 4763 user_id int8 NOT NULL,
4764 role_id int8 NOT NULL, 4764 role_id int8 NOT NULL,
4765 creator varchar(64) NULL DEFAULT '', 4765 creator varchar(64) NULL DEFAULT '',
@@ -4819,7 +4819,7 @@ CREATE SEQUENCE system_user_role_seq @@ -4819,7 +4819,7 @@ CREATE SEQUENCE system_user_role_seq
4819 DROP TABLE IF EXISTS system_users; 4819 DROP TABLE IF EXISTS system_users;
4820 CREATE TABLE system_users 4820 CREATE TABLE system_users
4821 ( 4821 (
4822 - id int8 NOT NULL, 4822 + id int8 NOT NULL default nextval('system_users_seq'),
4823 username varchar(30) NOT NULL, 4823 username varchar(30) NOT NULL,
4824 password varchar(100) NOT NULL DEFAULT '', 4824 password varchar(100) NOT NULL DEFAULT '',
4825 nickname varchar(30) NOT NULL, 4825 nickname varchar(30) NOT NULL,
@@ -4902,7 +4902,7 @@ CREATE SEQUENCE system_users_seq @@ -4902,7 +4902,7 @@ CREATE SEQUENCE system_users_seq
4902 DROP TABLE IF EXISTS yudao_demo01_contact; 4902 DROP TABLE IF EXISTS yudao_demo01_contact;
4903 CREATE TABLE yudao_demo01_contact 4903 CREATE TABLE yudao_demo01_contact
4904 ( 4904 (
4905 - id int8 NOT NULL, 4905 + id int8 NOT NULL default nextval('yudao_demo01_contact_seq'),
4906 name varchar(100) NOT NULL DEFAULT '', 4906 name varchar(100) NOT NULL DEFAULT '',
4907 sex int2 NOT NULL, 4907 sex int2 NOT NULL,
4908 birthday timestamp NOT NULL, 4908 birthday timestamp NOT NULL,
@@ -4952,7 +4952,7 @@ CREATE SEQUENCE yudao_demo01_contact_seq @@ -4952,7 +4952,7 @@ CREATE SEQUENCE yudao_demo01_contact_seq
4952 DROP TABLE IF EXISTS yudao_demo02_category; 4952 DROP TABLE IF EXISTS yudao_demo02_category;
4953 CREATE TABLE yudao_demo02_category 4953 CREATE TABLE yudao_demo02_category
4954 ( 4954 (
4955 - id int8 NOT NULL, 4955 + id int8 NOT NULL default nextval('yudao_demo02_category_seq'),
4956 name varchar(100) NOT NULL DEFAULT '', 4956 name varchar(100) NOT NULL DEFAULT '',
4957 parent_id int8 NOT NULL, 4957 parent_id int8 NOT NULL,
4958 creator varchar(64) NULL DEFAULT '', 4958 creator varchar(64) NULL DEFAULT '',
@@ -5001,7 +5001,7 @@ CREATE SEQUENCE yudao_demo02_category_seq @@ -5001,7 +5001,7 @@ CREATE SEQUENCE yudao_demo02_category_seq
5001 DROP TABLE IF EXISTS yudao_demo03_course; 5001 DROP TABLE IF EXISTS yudao_demo03_course;
5002 CREATE TABLE yudao_demo03_course 5002 CREATE TABLE yudao_demo03_course
5003 ( 5003 (
5004 - id int8 NOT NULL, 5004 + id int8 NOT NULL default nextval('yudao_demo03_course_seq'),
5005 student_id int8 NOT NULL, 5005 student_id int8 NOT NULL,
5006 name varchar(100) NOT NULL DEFAULT '', 5006 name varchar(100) NOT NULL DEFAULT '',
5007 score int2 NOT NULL, 5007 score int2 NOT NULL,
@@ -5063,7 +5063,7 @@ CREATE SEQUENCE yudao_demo03_course_seq @@ -5063,7 +5063,7 @@ CREATE SEQUENCE yudao_demo03_course_seq
5063 DROP TABLE IF EXISTS yudao_demo03_grade; 5063 DROP TABLE IF EXISTS yudao_demo03_grade;
5064 CREATE TABLE yudao_demo03_grade 5064 CREATE TABLE yudao_demo03_grade
5065 ( 5065 (
5066 - id int8 NOT NULL, 5066 + id int8 NOT NULL default nextval('yudao_demo03_grade_seq'),
5067 student_id int8 NOT NULL, 5067 student_id int8 NOT NULL,
5068 name varchar(100) NOT NULL DEFAULT '', 5068 name varchar(100) NOT NULL DEFAULT '',
5069 teacher varchar(255) NOT NULL, 5069 teacher varchar(255) NOT NULL,
@@ -5111,7 +5111,7 @@ CREATE SEQUENCE yudao_demo03_grade_seq @@ -5111,7 +5111,7 @@ CREATE SEQUENCE yudao_demo03_grade_seq
5111 DROP TABLE IF EXISTS yudao_demo03_student; 5111 DROP TABLE IF EXISTS yudao_demo03_student;
5112 CREATE TABLE yudao_demo03_student 5112 CREATE TABLE yudao_demo03_student
5113 ( 5113 (
5114 - id int8 NOT NULL, 5114 + id int8 NOT NULL default nextval('yudao_demo03_student_seq'),
5115 name varchar(100) NOT NULL DEFAULT '', 5115 name varchar(100) NOT NULL DEFAULT '',
5116 sex int2 NOT NULL, 5116 sex int2 NOT NULL,
5117 birthday timestamp NOT NULL, 5117 birthday timestamp NOT NULL,
yudao-module-ai/pom.xml
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 国外:OpenAI、Ollama、Midjourney、StableDiffusion、Suno 19 国外:OpenAI、Ollama、Midjourney、StableDiffusion、Suno
20 </description> 20 </description>
21 <properties> 21 <properties>
22 - <spring-ai.version>1.0.1</spring-ai.version>  
23 - <alibaba-ai.version>1.0.0.3</alibaba-ai.version>  
24 - <tinyflow.version>1.0.2</tinyflow.version> 22 + <spring-ai.version>1.1.0</spring-ai.version>
  23 + <alibaba-ai.version>1.0.0.4</alibaba-ai.version>
  24 + <tinyflow.version>1.2.6</tinyflow.version>
25 </properties> 25 </properties>
26 26
27 <dependencies> 27 <dependencies>
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/enums/model/AiPlatformEnum.java
@@ -40,6 +40,7 @@ public enum AiPlatformEnum implements ArrayValuable&lt;String&gt; { @@ -40,6 +40,7 @@ public enum AiPlatformEnum implements ArrayValuable&lt;String&gt; {
40 STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI 40 STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI
41 MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney 41 MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney
42 SUNO("Suno", "Suno"), // Suno AI 42 SUNO("Suno", "Suno"), // Suno AI
  43 + GROK("Grok","Grok"), // Grok
43 44
44 ; 45 ;
45 46
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/config/AiAutoConfiguration.java
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.ai.framework.ai.core.model.AiModelFactoryImpl; @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.ai.framework.ai.core.model.AiModelFactoryImpl;
7 import cn.iocoder.yudao.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel; 7 import cn.iocoder.yudao.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel;
8 import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel; 8 import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel;
9 import cn.iocoder.yudao.module.ai.framework.ai.core.model.gemini.GeminiChatModel; 9 import cn.iocoder.yudao.module.ai.framework.ai.core.model.gemini.GeminiChatModel;
  10 +import cn.iocoder.yudao.module.ai.framework.ai.core.model.grok.GrokChatModel;
10 import cn.iocoder.yudao.module.ai.framework.ai.core.model.hunyuan.HunYuanChatModel; 11 import cn.iocoder.yudao.module.ai.framework.ai.core.model.hunyuan.HunYuanChatModel;
11 import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; 12 import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi;
12 import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; 13 import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowApiConstants;
@@ -16,7 +17,9 @@ import cn.iocoder.yudao.module.ai.framework.ai.core.model.xinghuo.XingHuoChatMod @@ -16,7 +17,9 @@ import cn.iocoder.yudao.module.ai.framework.ai.core.model.xinghuo.XingHuoChatMod
16 import cn.iocoder.yudao.module.ai.framework.ai.core.webserch.AiWebSearchClient; 17 import cn.iocoder.yudao.module.ai.framework.ai.core.webserch.AiWebSearchClient;
17 import cn.iocoder.yudao.module.ai.framework.ai.core.webserch.bocha.AiBoChaWebSearchClient; 18 import cn.iocoder.yudao.module.ai.framework.ai.core.webserch.bocha.AiBoChaWebSearchClient;
18 import cn.iocoder.yudao.module.ai.tool.method.PersonService; 19 import cn.iocoder.yudao.module.ai.tool.method.PersonService;
  20 +import io.micrometer.observation.ObservationRegistry;
19 import lombok.extern.slf4j.Slf4j; 21 import lombok.extern.slf4j.Slf4j;
  22 +import org.springframework.ai.chat.model.ChatModel;
20 import org.springframework.ai.deepseek.DeepSeekChatModel; 23 import org.springframework.ai.deepseek.DeepSeekChatModel;
21 import org.springframework.ai.deepseek.DeepSeekChatOptions; 24 import org.springframework.ai.deepseek.DeepSeekChatOptions;
22 import org.springframework.ai.deepseek.api.DeepSeekApi; 25 import org.springframework.ai.deepseek.api.DeepSeekApi;
@@ -34,12 +37,14 @@ import org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusServiceClie @@ -34,12 +37,14 @@ import org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusServiceClie
34 import org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreProperties; 37 import org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreProperties;
35 import org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreProperties; 38 import org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreProperties;
36 import org.springframework.ai.vectorstore.redis.autoconfigure.RedisVectorStoreProperties; 39 import org.springframework.ai.vectorstore.redis.autoconfigure.RedisVectorStoreProperties;
  40 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
37 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 41 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
38 import org.springframework.boot.context.properties.EnableConfigurationProperties; 42 import org.springframework.boot.context.properties.EnableConfigurationProperties;
39 import org.springframework.context.annotation.Bean; 43 import org.springframework.context.annotation.Bean;
40 import org.springframework.context.annotation.Configuration; 44 import org.springframework.context.annotation.Configuration;
41 45
42 import java.util.List; 46 import java.util.List;
  47 +import java.util.Optional;
43 48
44 /** 49 /**
45 * 芋道 AI 自动配置 50 * 芋道 AI 自动配置
@@ -60,6 +65,13 @@ public class AiAutoConfiguration { @@ -60,6 +65,13 @@ public class AiAutoConfiguration {
60 return new AiModelFactoryImpl(); 65 return new AiModelFactoryImpl();
61 } 66 }
62 67
  68 + @Bean
  69 + @ConditionalOnMissingBean
  70 + public ObservationRegistry observationRegistry() {
  71 + // 特殊:兜底有 ObservationRegistry Bean,避免相关的 ChatModel 创建报错。相关 issue:https://t.zsxq.com/CuPu4
  72 + return ObservationRegistry.NOOP;
  73 + }
  74 +
63 // ========== 各种 AI Client 创建 ========== 75 // ========== 各种 AI Client 创建 ==========
64 76
65 @Bean 77 @Bean
@@ -252,6 +264,28 @@ public class AiAutoConfiguration { @@ -252,6 +264,28 @@ public class AiAutoConfiguration {
252 return new SunoApi(yudaoAiProperties.getSuno().getBaseUrl()); 264 return new SunoApi(yudaoAiProperties.getSuno().getBaseUrl());
253 } 265 }
254 266
  267 + public ChatModel buildGrokChatClient(YudaoAiProperties.Grok properties) {
  268 + if (StrUtil.isEmpty(properties.getModel())) {
  269 + properties.setModel(GrokChatModel.MODEL_DEFAULT);
  270 + }
  271 + OpenAiChatModel openAiChatModel = OpenAiChatModel.builder()
  272 + .openAiApi(OpenAiApi.builder()
  273 + .baseUrl(Optional.ofNullable(properties.getBaseUrl())
  274 + .orElse(GrokChatModel.BASE_URL))
  275 + .completionsPath(GrokChatModel.COMPLETE_PATH)
  276 + .apiKey(properties.getApiKey())
  277 + .build())
  278 + .defaultOptions(OpenAiChatOptions.builder()
  279 + .model(properties.getModel())
  280 + .temperature(properties.getTemperature())
  281 + .maxTokens(properties.getMaxTokens())
  282 + .topP(properties.getTopP())
  283 + .build())
  284 + .toolCallingManager(getToolCallingManager())
  285 + .build();
  286 + return new DouBaoChatModel(openAiChatModel);
  287 + }
  288 +
255 // ========== RAG 相关 ========== 289 // ========== RAG 相关 ==========
256 290
257 @Bean 291 @Bean
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/config/YudaoAiProperties.java
@@ -161,6 +161,20 @@ public class YudaoAiProperties { @@ -161,6 +161,20 @@ public class YudaoAiProperties {
161 } 161 }
162 162
163 @Data 163 @Data
  164 + public static class Grok {
  165 +
  166 + private String enable;
  167 + private String apiKey;
  168 + private String baseUrl;
  169 +
  170 + private String model;
  171 + private Double temperature;
  172 + private Integer maxTokens;
  173 + private Double topP;
  174 +
  175 + }
  176 +
  177 + @Data
164 public static class WebSearch { 178 public static class WebSearch {
165 179
166 private boolean enable; 180 private boolean enable;
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/AiModelFactoryImpl.java
@@ -87,7 +87,7 @@ import org.springframework.ai.model.zhipuai.autoconfigure.ZhiPuAiImageAutoConfig @@ -87,7 +87,7 @@ import org.springframework.ai.model.zhipuai.autoconfigure.ZhiPuAiImageAutoConfig
87 import org.springframework.ai.ollama.OllamaChatModel; 87 import org.springframework.ai.ollama.OllamaChatModel;
88 import org.springframework.ai.ollama.OllamaEmbeddingModel; 88 import org.springframework.ai.ollama.OllamaEmbeddingModel;
89 import org.springframework.ai.ollama.api.OllamaApi; 89 import org.springframework.ai.ollama.api.OllamaApi;
90 -import org.springframework.ai.ollama.api.OllamaOptions; 90 +import org.springframework.ai.ollama.api.OllamaEmbeddingOptions;
91 import org.springframework.ai.openai.OpenAiChatModel; 91 import org.springframework.ai.openai.OpenAiChatModel;
92 import org.springframework.ai.openai.OpenAiEmbeddingModel; 92 import org.springframework.ai.openai.OpenAiEmbeddingModel;
93 import org.springframework.ai.openai.OpenAiEmbeddingOptions; 93 import org.springframework.ai.openai.OpenAiEmbeddingOptions;
@@ -178,6 +178,8 @@ public class AiModelFactoryImpl implements AiModelFactory { @@ -178,6 +178,8 @@ public class AiModelFactoryImpl implements AiModelFactory {
178 return buildGeminiChatModel(apiKey); 178 return buildGeminiChatModel(apiKey);
179 case OLLAMA: 179 case OLLAMA:
180 return buildOllamaChatModel(url); 180 return buildOllamaChatModel(url);
  181 + case GROK:
  182 + return buildGrokChatModel(apiKey,url);
181 default: 183 default:
182 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform)); 184 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
183 } 185 }
@@ -436,10 +438,12 @@ public class AiModelFactoryImpl implements AiModelFactory { @@ -436,10 +438,12 @@ public class AiModelFactoryImpl implements AiModelFactory {
436 * 可参考 {@link ZhiPuAiChatAutoConfiguration} 的 zhiPuAiChatModel 方法 438 * 可参考 {@link ZhiPuAiChatAutoConfiguration} 的 zhiPuAiChatModel 方法
437 */ 439 */
438 private ZhiPuAiChatModel buildZhiPuChatModel(String apiKey, String url) { 440 private ZhiPuAiChatModel buildZhiPuChatModel(String apiKey, String url) {
439 - ZhiPuAiApi zhiPuAiApi = StrUtil.isEmpty(url) ? new ZhiPuAiApi(apiKey)  
440 - : new ZhiPuAiApi(url, apiKey); 441 + ZhiPuAiApi.Builder zhiPuAiApiBuilder = ZhiPuAiApi.builder().apiKey(apiKey);
  442 + if (StrUtil.isNotEmpty(url)) {
  443 + zhiPuAiApiBuilder.baseUrl(url);
  444 + }
441 ZhiPuAiChatOptions options = ZhiPuAiChatOptions.builder().model(ZhiPuAiApi.DEFAULT_CHAT_MODEL).temperature(0.7).build(); 445 ZhiPuAiChatOptions options = ZhiPuAiChatOptions.builder().model(ZhiPuAiApi.DEFAULT_CHAT_MODEL).temperature(0.7).build();
442 - return new ZhiPuAiChatModel(zhiPuAiApi, options, getToolCallingManager(), DEFAULT_RETRY_TEMPLATE, 446 + return new ZhiPuAiChatModel(zhiPuAiApiBuilder.build(), options, getToolCallingManager(), DEFAULT_RETRY_TEMPLATE,
443 getObservationRegistry().getIfAvailable()); 447 getObservationRegistry().getIfAvailable());
444 } 448 }
445 449
@@ -586,6 +590,13 @@ public class AiModelFactoryImpl implements AiModelFactory { @@ -586,6 +590,13 @@ public class AiModelFactoryImpl implements AiModelFactory {
586 return new StabilityAiImageModel(stabilityAiApi); 590 return new StabilityAiImageModel(stabilityAiApi);
587 } 591 }
588 592
  593 + private ChatModel buildGrokChatModel(String apiKey,String url) {
  594 + YudaoAiProperties.Grok properties = new YudaoAiProperties.Grok()
  595 + .setBaseUrl(url)
  596 + .setApiKey(apiKey);
  597 + return new AiAutoConfiguration().buildGrokChatClient(properties);
  598 + }
  599 +
589 // ========== 各种创建 EmbeddingModel 的方法 ========== 600 // ========== 各种创建 EmbeddingModel 的方法 ==========
590 601
591 /** 602 /**
@@ -601,10 +612,12 @@ public class AiModelFactoryImpl implements AiModelFactory { @@ -601,10 +612,12 @@ public class AiModelFactoryImpl implements AiModelFactory {
601 * 可参考 {@link ZhiPuAiEmbeddingAutoConfiguration} 的 zhiPuAiEmbeddingModel 方法 612 * 可参考 {@link ZhiPuAiEmbeddingAutoConfiguration} 的 zhiPuAiEmbeddingModel 方法
602 */ 613 */
603 private ZhiPuAiEmbeddingModel buildZhiPuEmbeddingModel(String apiKey, String url, String model) { 614 private ZhiPuAiEmbeddingModel buildZhiPuEmbeddingModel(String apiKey, String url, String model) {
604 - ZhiPuAiApi zhiPuAiApi = StrUtil.isEmpty(url) ? new ZhiPuAiApi(apiKey)  
605 - : new ZhiPuAiApi(url, apiKey); 615 + ZhiPuAiApi.Builder zhiPuAiApiBuilder = ZhiPuAiApi.builder().apiKey(apiKey);
  616 + if (StrUtil.isNotEmpty(url)) {
  617 + zhiPuAiApiBuilder.baseUrl(url);
  618 + }
606 ZhiPuAiEmbeddingOptions zhiPuAiEmbeddingOptions = ZhiPuAiEmbeddingOptions.builder().model(model).build(); 619 ZhiPuAiEmbeddingOptions zhiPuAiEmbeddingOptions = ZhiPuAiEmbeddingOptions.builder().model(model).build();
607 - return new ZhiPuAiEmbeddingModel(zhiPuAiApi, MetadataMode.EMBED, zhiPuAiEmbeddingOptions); 620 + return new ZhiPuAiEmbeddingModel(zhiPuAiApiBuilder.build(), MetadataMode.EMBED, zhiPuAiEmbeddingOptions);
608 } 621 }
609 622
610 /** 623 /**
@@ -632,7 +645,7 @@ public class AiModelFactoryImpl implements AiModelFactory { @@ -632,7 +645,7 @@ public class AiModelFactoryImpl implements AiModelFactory {
632 645
633 private OllamaEmbeddingModel buildOllamaEmbeddingModel(String url, String model) { 646 private OllamaEmbeddingModel buildOllamaEmbeddingModel(String url, String model) {
634 OllamaApi ollamaApi = OllamaApi.builder().baseUrl(url).build(); 647 OllamaApi ollamaApi = OllamaApi.builder().baseUrl(url).build();
635 - OllamaOptions ollamaOptions = OllamaOptions.builder().model(model).build(); 648 + OllamaEmbeddingOptions ollamaOptions = OllamaEmbeddingOptions.builder().model(model).build();
636 return OllamaEmbeddingModel.builder() 649 return OllamaEmbeddingModel.builder()
637 .ollamaApi(ollamaApi) 650 .ollamaApi(ollamaApi)
638 .defaultOptions(ollamaOptions) 651 .defaultOptions(ollamaOptions)
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/grok/GrokChatModel.java 0 → 100644
  1 +package cn.iocoder.yudao.module.ai.framework.ai.core.model.grok;
  2 +
  3 +import lombok.RequiredArgsConstructor;
  4 +import lombok.extern.slf4j.Slf4j;
  5 +import org.springframework.ai.chat.model.ChatModel;
  6 +import org.springframework.ai.chat.model.ChatResponse;
  7 +import org.springframework.ai.chat.prompt.ChatOptions;
  8 +import org.springframework.ai.chat.prompt.Prompt;
  9 +import reactor.core.publisher.Flux;
  10 +
  11 +/**
  12 + * Grok {@link ChatModel} 实现类
  13 + *
  14 + *
  15 + */
  16 +@Slf4j
  17 +@RequiredArgsConstructor
  18 +public class GrokChatModel implements ChatModel {
  19 +
  20 + public static final String BASE_URL = "https://api.x.ai";
  21 + public static final String COMPLETE_PATH = "/v1/chat/completions";
  22 + public static final String MODEL_DEFAULT = "grok-4-fast-reasoning";
  23 +
  24 + /**
  25 + * 兼容 OpenAI 接口,进行复用
  26 + */
  27 + private final ChatModel openAiChatModel;
  28 +
  29 + @Override
  30 + public ChatResponse call(Prompt prompt) {
  31 + return openAiChatModel.call(prompt);
  32 + }
  33 +
  34 + @Override
  35 + public Flux<ChatResponse> stream(Prompt prompt) {
  36 + return openAiChatModel.stream(prompt);
  37 + }
  38 +
  39 + @Override
  40 + public ChatOptions getDefaultOptions() {
  41 + return openAiChatModel.getDefaultOptions();
  42 + }
  43 +
  44 +}
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/security/config/SecurityConfiguration.java
@@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.ai.framework.security.config; @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.ai.framework.security.config;
2 2
3 import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer; 3 import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
4 import jakarta.annotation.Resource; 4 import jakarta.annotation.Resource;
5 -import org.springframework.ai.mcp.server.autoconfigure.McpServerProperties; 5 +import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerSseProperties;
  6 +import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties;
6 import org.springframework.context.annotation.Bean; 7 import org.springframework.context.annotation.Bean;
7 import org.springframework.context.annotation.Configuration; 8 import org.springframework.context.annotation.Configuration;
8 import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -17,7 +18,9 @@ import java.util.Optional; @@ -17,7 +18,9 @@ import java.util.Optional;
17 public class SecurityConfiguration { 18 public class SecurityConfiguration {
18 19
19 @Resource 20 @Resource
20 - private Optional<McpServerProperties> serverProperties; 21 + private Optional<McpServerSseProperties> mcpServerSseProperties;
  22 + @Resource
  23 + private Optional<McpServerStreamableHttpProperties> mcpServerStreamableHttpProperties;
21 24
22 @Bean("aiAuthorizeRequestsCustomizer") 25 @Bean("aiAuthorizeRequestsCustomizer")
23 public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { 26 public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
@@ -25,11 +28,12 @@ public class SecurityConfiguration { @@ -25,11 +28,12 @@ public class SecurityConfiguration {
25 28
26 @Override 29 @Override
27 public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) { 30 public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
28 - // MCP Server  
29 - serverProperties.ifPresent(properties -> { 31 + mcpServerSseProperties.ifPresent(properties -> {
30 registry.requestMatchers(properties.getSseEndpoint()).permitAll(); 32 registry.requestMatchers(properties.getSseEndpoint()).permitAll();
31 registry.requestMatchers(properties.getSseMessageEndpoint()).permitAll(); 33 registry.requestMatchers(properties.getSseMessageEndpoint()).permitAll();
32 }); 34 });
  35 + mcpServerStreamableHttpProperties.ifPresent(properties ->
  36 + registry.requestMatchers(properties.getMcpEndpoint()).permitAll());
33 } 37 }
34 38
35 }; 39 };
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/service/chat/AiChatMessageServiceImpl.java
@@ -49,7 +49,7 @@ import org.springframework.ai.chat.model.StreamingChatModel; @@ -49,7 +49,7 @@ import org.springframework.ai.chat.model.StreamingChatModel;
49 import org.springframework.ai.chat.prompt.ChatOptions; 49 import org.springframework.ai.chat.prompt.ChatOptions;
50 import org.springframework.ai.chat.prompt.Prompt; 50 import org.springframework.ai.chat.prompt.Prompt;
51 import org.springframework.ai.mcp.SyncMcpToolCallbackProvider; 51 import org.springframework.ai.mcp.SyncMcpToolCallbackProvider;
52 -import org.springframework.ai.mcp.client.autoconfigure.properties.McpClientCommonProperties; 52 +import org.springframework.ai.mcp.client.common.autoconfigure.properties.McpClientCommonProperties;
53 import org.springframework.ai.tool.ToolCallback; 53 import org.springframework.ai.tool.ToolCallback;
54 import org.springframework.ai.tool.resolution.ToolCallbackResolver; 54 import org.springframework.ai.tool.resolution.ToolCallbackResolver;
55 import org.springframework.beans.factory.annotation.Autowired; 55 import org.springframework.beans.factory.annotation.Autowired;
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
@@ -16,7 +16,7 @@ import org.springframework.ai.chat.prompt.ChatOptions; @@ -16,7 +16,7 @@ import org.springframework.ai.chat.prompt.ChatOptions;
16 import org.springframework.ai.deepseek.DeepSeekAssistantMessage; 16 import org.springframework.ai.deepseek.DeepSeekAssistantMessage;
17 import org.springframework.ai.deepseek.DeepSeekChatOptions; 17 import org.springframework.ai.deepseek.DeepSeekChatOptions;
18 import org.springframework.ai.minimax.MiniMaxChatOptions; 18 import org.springframework.ai.minimax.MiniMaxChatOptions;
19 -import org.springframework.ai.ollama.api.OllamaOptions; 19 +import org.springframework.ai.ollama.api.OllamaChatOptions;
20 import org.springframework.ai.openai.OpenAiChatOptions; 20 import org.springframework.ai.openai.OpenAiChatOptions;
21 import org.springframework.ai.tool.ToolCallback; 21 import org.springframework.ai.tool.ToolCallback;
22 import org.springframework.ai.zhipuai.ZhiPuAiChatOptions; 22 import org.springframework.ai.zhipuai.ZhiPuAiChatOptions;
@@ -68,6 +68,7 @@ public class AiUtils { @@ -68,6 +68,7 @@ public class AiUtils {
68 case OPENAI: 68 case OPENAI:
69 case GEMINI: // 复用 OpenAI 客户端 69 case GEMINI: // 复用 OpenAI 客户端
70 case BAI_CHUAN: // 复用 OpenAI 客户端 70 case BAI_CHUAN: // 复用 OpenAI 客户端
  71 + case GROK: // 复用 OpenAI 客户端
71 return OpenAiChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens) 72 return OpenAiChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens)
72 .toolCallbacks(toolCallbacks).toolContext(toolContext).build(); 73 .toolCallbacks(toolCallbacks).toolContext(toolContext).build();
73 case AZURE_OPENAI: 74 case AZURE_OPENAI:
@@ -77,7 +78,7 @@ public class AiUtils { @@ -77,7 +78,7 @@ public class AiUtils {
77 return AnthropicChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens) 78 return AnthropicChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens)
78 .toolCallbacks(toolCallbacks).toolContext(toolContext).build(); 79 .toolCallbacks(toolCallbacks).toolContext(toolContext).build();
79 case OLLAMA: 80 case OLLAMA:
80 - return OllamaOptions.builder().model(model).temperature(temperature).numPredict(maxTokens) 81 + return OllamaChatOptions.builder().model(model).temperature(temperature).numPredict(maxTokens)
81 .toolCallbacks(toolCallbacks).toolContext(toolContext).build(); 82 .toolCallbacks(toolCallbacks).toolContext(toolContext).build();
82 default: 83 default:
83 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform)); 84 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
yudao-server/src/main/resources/application.yaml
@@ -211,6 +211,8 @@ spring: @@ -211,6 +211,8 @@ spring:
211 filesystem: 211 filesystem:
212 url: http://127.0.0.1:8089 212 url: http://127.0.0.1:8089
213 sse-endpoint: /sse 213 sse-endpoint: /sse
  214 + annotation-scanner:
  215 + enabled: false # TODO @芋艿:有 bug https://github.com/spring-projects/spring-ai/issues/4917 需要官方修复
214 216
215 yudao: 217 yudao:
216 ai: 218 ai: