mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 18:49:06 +08:00 
			
		
		
		
	增加自动配置
This commit is contained in:
		| @ -0,0 +1,32 @@ | |||||||
|  | package cn.iocoder.yudao.framework.ai.config; | ||||||
|  |  | ||||||
|  | import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoChatClient; | ||||||
|  | import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoOptions; | ||||||
|  | import cn.iocoder.yudao.framework.ai.chatxinghuo.api.XingHuoApi; | ||||||
|  | import org.springframework.boot.autoconfigure.AutoConfiguration; | ||||||
|  | import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||||||
|  | import org.springframework.context.annotation.Bean; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * ai 自动配置 | ||||||
|  |  * | ||||||
|  |  * @author fansili | ||||||
|  |  * @time 2024/4/12 16:29 | ||||||
|  |  * @since 1.0 | ||||||
|  |  */ | ||||||
|  | @AutoConfiguration | ||||||
|  | @EnableConfigurationProperties(YudaoAiProperties.class) | ||||||
|  | public class YudaoAiAutoConfiguration { | ||||||
|  |  | ||||||
|  |     @Bean | ||||||
|  |     public XingHuoChatClient xingHuoChatClient(YudaoAiProperties yudaoAiProperties) { | ||||||
|  |         return new XingHuoChatClient( | ||||||
|  |                 new XingHuoApi( | ||||||
|  |                         yudaoAiProperties.getXingHuo().getAppId(), | ||||||
|  |                         yudaoAiProperties.getXingHuo().getAppKey(), | ||||||
|  |                         yudaoAiProperties.getXingHuo().getSecretKey() | ||||||
|  |                 ), | ||||||
|  |                 new XingHuoOptions().setChatModel(yudaoAiProperties.getXingHuo().getChatModel()) | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,85 @@ | |||||||
|  | package cn.iocoder.yudao.framework.ai.config; | ||||||
|  |  | ||||||
|  | import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoChatModel; | ||||||
|  | import cn.iocoder.yudao.framework.ai.chatyiyan.YiYanChatModel; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.experimental.Accessors; | ||||||
|  | import org.springframework.boot.context.properties.ConfigurationProperties; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * ai 自动配置 | ||||||
|  |  * | ||||||
|  |  * @author fansili | ||||||
|  |  * @time 2024/4/12 16:29 | ||||||
|  |  * @since 1.0 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @ConfigurationProperties(prefix = "yudao.ai") | ||||||
|  | public class YudaoAiProperties { | ||||||
|  |  | ||||||
|  |     private QianWenProperties qianWen; | ||||||
|  |     private XingHuoProperties xingHuo; | ||||||
|  |     private YiYanProperties yiYan; | ||||||
|  |  | ||||||
|  |     @Data | ||||||
|  |     @Accessors(chain = true) | ||||||
|  |     public static class ChatProperties { | ||||||
|  |  | ||||||
|  |         private Float temperature; | ||||||
|  |  | ||||||
|  |         private Float topP; | ||||||
|  |  | ||||||
|  |         private Integer topK; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Data | ||||||
|  |     @Accessors(chain = true) | ||||||
|  |     public static class QianWenProperties extends ChatProperties { | ||||||
|  |         /** | ||||||
|  |          * 阿里云:服务器接入点 | ||||||
|  |          */ | ||||||
|  |         private String endpoint = "bailian.cn-beijing.aliyuncs.com"; | ||||||
|  |         /** | ||||||
|  |          * 阿里云:权限 accessKeyId | ||||||
|  |          */ | ||||||
|  |         private String accessKeyId; | ||||||
|  |         /** | ||||||
|  |          * 阿里云:权限 accessKeySecret | ||||||
|  |          */ | ||||||
|  |         private String accessKeySecret; | ||||||
|  |         /** | ||||||
|  |          * 阿里云:agentKey(相当于应用id) | ||||||
|  |          */ | ||||||
|  |         private String agentKey; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Data | ||||||
|  |     @Accessors(chain = true) | ||||||
|  |     public static class XingHuoProperties extends ChatProperties { | ||||||
|  |         private String appId; | ||||||
|  |         private String appKey; | ||||||
|  |         private String secretKey; | ||||||
|  |         private XingHuoChatModel chatModel; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Data | ||||||
|  |     @Accessors(chain = true) | ||||||
|  |     public static class YiYanProperties extends ChatProperties { | ||||||
|  |         /** | ||||||
|  |          * appKey | ||||||
|  |          */ | ||||||
|  |         private String appKey; | ||||||
|  |         /** | ||||||
|  |          * secretKey | ||||||
|  |          */ | ||||||
|  |         private String secretKey; | ||||||
|  |         /** | ||||||
|  |          * 模型 | ||||||
|  |          */ | ||||||
|  |         private YiYanChatModel chatModel = YiYanChatModel.ERNIE4_3_5_8K; | ||||||
|  |         /** | ||||||
|  |          * token 刷新时间(默认 86400 = 24小时) | ||||||
|  |          */ | ||||||
|  |         private int refreshTokenSecondTime = 86400; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1 @@ | |||||||
|  | cn.iocoder.yudao.framework.ai.config.YudaoAiAutoConfiguration | ||||||
| @ -54,7 +54,7 @@ spring: | |||||||
|           #          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例 |           #          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例 | ||||||
|           #          url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 |           #          url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 | ||||||
|           username: root |           username: root | ||||||
|           password: 123456 |           password: root | ||||||
|         #          username: sa |         #          username: sa | ||||||
|         #          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W |         #          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W | ||||||
|         #          username: SYSDBA # DM 连接的示例 |         #          username: SYSDBA # DM 连接的示例 | ||||||
| @ -68,7 +68,7 @@ spring: | |||||||
|           #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 |           #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 | ||||||
|           #          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 |           #          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 | ||||||
|           username: root |           username: root | ||||||
|           password: 123456 |           password: root | ||||||
|   #          username: sa |   #          username: sa | ||||||
|   #          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W |   #          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W | ||||||
|  |  | ||||||
| @ -223,6 +223,25 @@ wx: | |||||||
|  |  | ||||||
| # 芋道配置项,设置当前项目所有自定义的配置 | # 芋道配置项,设置当前项目所有自定义的配置 | ||||||
| yudao: | yudao: | ||||||
|  |   ai: | ||||||
|  |     temperature: 1 | ||||||
|  |     topP: 1 | ||||||
|  |     topK: 1 | ||||||
|  |     qianWen: | ||||||
|  |       endpoint: bailian.cn-beijing.aliyuncs.com | ||||||
|  |       accessKeyId: LTAI5tNTVhXW4fLKUjMrr98z | ||||||
|  |       accessKeySecret: ZJ0JQeyjzxxm5CfeTV6k1wNE9UsvZP | ||||||
|  |       agentKey: f0c1088824594f589c8f10567ccd929f_p_efm | ||||||
|  |     xingHuo: | ||||||
|  |       appId: 13c8cca6 | ||||||
|  |       appKey: cb6415c19d6162cda07b47316fcb0416 | ||||||
|  |       secretKey: Y2JiYTIxZjA3MDMxMjNjZjQzYzVmNzdh | ||||||
|  |       chatModel: XING_HUO_3_5 | ||||||
|  |     yiYan: | ||||||
|  |       appKey: x0cuLZ7XsaTCU08vuJWO87Lg | ||||||
|  |       secretKey: R9mYF9dl9KASgi5RUq0FQt3wRisSnOcK | ||||||
|  |       refreshTokenSecondTime: 86400 | ||||||
|  |       chatModel: ERNIE4_3_5_8K | ||||||
|   captcha: |   captcha: | ||||||
|     enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试; |     enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试; | ||||||
|   security: |   security: | ||||||
| @ -235,6 +254,7 @@ yudao: | |||||||
|   pay: |   pay: | ||||||
|     order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址 |     order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址 | ||||||
|     refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址 |     refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址 | ||||||
|  |  | ||||||
|   access-log: # 访问日志的配置项 |   access-log: # 访问日志的配置项 | ||||||
|     enable: false |     enable: false | ||||||
|   error-code: # 错误码相关配置项 |   error-code: # 错误码相关配置项 | ||||||
| @ -267,7 +287,6 @@ justauth: | |||||||
|     type: REDIS |     type: REDIS | ||||||
|     prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: |     prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: | ||||||
|     timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 |     timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 | ||||||
|  |  | ||||||
| # TODO 赤焰:这个配置的目的是? | # TODO 赤焰:这个配置的目的是? | ||||||
| #ureport配置 | #ureport配置 | ||||||
| #ureport: | #ureport: | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 cherishsince
					cherishsince