- 添加DashScope AI配置项,包括API密钥和模型参数 - 实现ChatClient配置类用于构建AI聊天客户端 - 创建控制器接口支持用户通过HTTP请求与AI交互 - 引入Jasypt加密库用于敏感信息加密 - 添加Spring AI和Alibaba DashScope依赖管理- 升级项目依赖并引入WebFlux支持异步处理
42 lines
1.6 KiB
YAML
42 lines
1.6 KiB
YAML
#file: noinspection SpringBootConfigYamlInspection
|
|
spring:
|
|
application:
|
|
name: snails-ai
|
|
banner:
|
|
location: config/banner.txt
|
|
jpa:
|
|
hibernate:
|
|
ddl-auto: update
|
|
properties:
|
|
# 开启 SQL 语句格式化 (重点:让 SQL 易读)
|
|
hibernate.format_sql: true
|
|
# 开启 SQL 语法高亮 (重点:让 SQL 醒目)
|
|
hibernate.highlight_sql: true
|
|
datasource:
|
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
url: jdbc:mysql://127.0.0.1:3306/snails_ai?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true
|
|
username: root
|
|
password: mysql
|
|
# HikariCP 连接池配置
|
|
hikari:
|
|
maximum-pool-size: 20 # 最大连接数设置为 20
|
|
minimum-idle: 20 # 保持 20 个空闲连接(与最大连接数一致)
|
|
connection-timeout: 5000 # 获取连接超时 5 秒
|
|
max-lifetime: 28800000 # 8 小时(确保在数据库连接超时前被回收)
|
|
ai:
|
|
dashscope:
|
|
api-key: ENC(cMgcKZkFllyE88DIbGwLKot9Vg02co+gsmY8L8o4/o3UjhcmqO4lJzFU35Sx0n+qFG8pDL0wBjoWrT8X6BuRw9vNlQhY1LgRWHaF9S1zzyM=)
|
|
chat:
|
|
options:
|
|
model: qwen-plus
|
|
temperature: 0.5
|
|
logging:
|
|
level:
|
|
org.hibernate.SQL: debug
|
|
# 隐藏掉 Hibernate 冗长的连接池 INFO 信息
|
|
org.hibernate.orm.connections.pooling: WARN
|
|
jasypt:
|
|
encryptor:
|
|
password: ${jasypt.encryptor.password}
|
|
algorithm: PBEWithHMACSHA512AndAES_256
|
|
iv-generator-classname: org.jasypt.iv.RandomIvGenerator |