refactor(chat):重构AI助手功能并集成文档读取能力
- 移除原有的手机号识别与消息发送逻辑 - 删除RabbitMQ和邮件相关配置及代码 - 引入PDF、HTML、JSON等多种文档读取器 - 集成向量存储与检索功能支持问答 - 更新Spring AI依赖并调整内存存储方式 - 添加新的工具类用于保存文档到向量库- 修改提示词模板去除强制附加句规则 - 调整Cassandra和PgVector相关配置项- 新增多种文件格式读取组件实现类
This commit is contained in:
@@ -9,18 +9,13 @@ spring:
|
||||
name: snails-ai
|
||||
banner:
|
||||
location: config/banner.txt
|
||||
cassandra:
|
||||
contact-points: 127.0.0.1 # Cassandra 集群节点地址(可配置多个,用逗号分隔)
|
||||
port: 9042 # 端口号
|
||||
local-datacenter: datacenter1 # 必须与集群配置的数据中心名称一致(大小写敏感)
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
mail:
|
||||
host: ${MAIL_HOST:smtp.qq.com}
|
||||
port: ${MAIL_PORT:587}
|
||||
username: ${MAIL_USERNAME:2628273921@qq.com}
|
||||
password: ENC(ARrAyZNZhbaG6tebogv6WSQbtCO+Vq93NfSA6tMAiD0tTogujERVwEGBECakH0LUhYq9oTaXgfw7tonxNAFEwg==)
|
||||
properties:
|
||||
mail.smtp.auth: true
|
||||
mail.smtp.starttls.enable: true
|
||||
mail.smtp.starttls.required: true
|
||||
data:
|
||||
redis:
|
||||
host: localhost
|
||||
@@ -35,15 +30,6 @@ spring:
|
||||
max-wait: 10000
|
||||
min-idle: 10
|
||||
time-between-eviction-runs: 10000
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: admin
|
||||
password: admin123
|
||||
virtual-host: /snailsAi
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://localhost:5432/postgres?serverTimezone=Asia/Shanghai
|
||||
@@ -56,18 +42,31 @@ spring:
|
||||
connection-timeout: 5000 # 获取连接超时 5 秒
|
||||
max-lifetime: 28800000 # 8 小时(确保在数据库连接超时前被回收)
|
||||
ai:
|
||||
memory:
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
timeout: 5000
|
||||
password: redis
|
||||
vectorstore:
|
||||
pgvector:
|
||||
initialize-schema: true
|
||||
table-name: snails_ai_vector
|
||||
index-type: hnsw
|
||||
dimensions: 1024
|
||||
chat:
|
||||
memory:
|
||||
repository:
|
||||
cassandra:
|
||||
keyspace: snails_ai
|
||||
table: t_ai_chat_memory # 表名
|
||||
time-to-live: 1095d # 数据的自动过期时间(1095天 ≈ 3年)
|
||||
initialize-schema: true # 自动初始化表结构
|
||||
dashscope:
|
||||
api-key: ENC(cMgcKZkFllyE88DIbGwLKot9Vg02co+gsmY8L8o4/o3UjhcmqO4lJzFU35Sx0n+qFG8pDL0wBjoWrT8X6BuRw9vNlQhY1LgRWHaF9S1zzyM=)
|
||||
chat:
|
||||
options:
|
||||
model: qwen-plus
|
||||
temperature: 0.5
|
||||
embedding:
|
||||
options:
|
||||
model: text-embedding-v4
|
||||
dimensions: 1024
|
||||
read-timeout: 60000
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
Reference in New Issue
Block a user