222 lines
4.7 KiB
YAML
222 lines
4.7 KiB
YAML
# AI服务测试环境配置
|
|
server:
|
|
port: 9002
|
|
|
|
spring:
|
|
application:
|
|
name: emotion-ai
|
|
profiles:
|
|
active: test
|
|
cloud:
|
|
nacos:
|
|
discovery:
|
|
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
|
|
namespace: emotion-test
|
|
group: TEST_GROUP
|
|
enabled: true
|
|
ip: ${SERVER_IP:localhost}
|
|
port: ${server.port}
|
|
metadata:
|
|
version: 1.0.0
|
|
environment: test
|
|
config:
|
|
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
|
|
file-extension: yml
|
|
namespace: emotion-test
|
|
group: TEST_GROUP
|
|
enabled: true
|
|
datasource:
|
|
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
|
|
username: ${MYSQL_USERNAME:emotion}
|
|
password: ${MYSQL_PASSWORD:emotion123}
|
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
hikari:
|
|
pool-name: EmotionAITestHikariCP
|
|
minimum-idle: 3
|
|
maximum-pool-size: 15
|
|
auto-commit: true
|
|
idle-timeout: 30000
|
|
max-lifetime: 1800000
|
|
connection-timeout: 30000
|
|
connection-test-query: SELECT 1
|
|
data:
|
|
redis:
|
|
host: ${REDIS_HOST:localhost}
|
|
port: ${REDIS_PORT:6379}
|
|
password: ${REDIS_PASSWORD:}
|
|
database: 2
|
|
timeout: 6000ms
|
|
lettuce:
|
|
pool:
|
|
max-active: 8
|
|
max-wait: -1ms
|
|
max-idle: 8
|
|
min-idle: 2
|
|
|
|
# MyBatis Plus配置
|
|
mybatis-plus:
|
|
configuration:
|
|
map-underscore-to-camel-case: true
|
|
cache-enabled: true
|
|
call-setters-on-nulls: true
|
|
jdbc-type-for-null: 'null'
|
|
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
|
global-config:
|
|
db-config:
|
|
id-type: assign_uuid
|
|
logic-delete-field: is_deleted
|
|
logic-delete-value: 1
|
|
logic-not-delete-value: 0
|
|
banner: false
|
|
mapper-locations: classpath*:mapper/**/*.xml
|
|
|
|
# 日志配置
|
|
logging:
|
|
level:
|
|
root: INFO
|
|
com.emotionmuseum: INFO
|
|
com.emotionmuseum.ai.mapper: DEBUG
|
|
org.springframework.ai: INFO
|
|
org.springframework.web: INFO
|
|
pattern:
|
|
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] - %msg%n"
|
|
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] - %msg%n"
|
|
file:
|
|
name: /data/logs/emotion-museum/ai-service.log
|
|
max-size: 100MB
|
|
max-history: 30
|
|
|
|
# 管理端点
|
|
management:
|
|
endpoints:
|
|
web:
|
|
exposure:
|
|
include: health,info,metrics,prometheus,env,configprops
|
|
base-path: /actuator
|
|
endpoint:
|
|
health:
|
|
show-details: always
|
|
show-components: always
|
|
metrics:
|
|
export:
|
|
prometheus:
|
|
enabled: true
|
|
health:
|
|
redis:
|
|
enabled: true
|
|
db:
|
|
enabled: true
|
|
|
|
# COZE AI配置
|
|
coze:
|
|
api:
|
|
token: ${COZE_API_TOKEN:your-coze-api-token}
|
|
base-url: https://api.coze.cn
|
|
bot-id: 7523042446285439016
|
|
workflow-id: 7523047462895796287
|
|
timeout: 30000
|
|
retry-count: 3
|
|
max-tokens: 2000
|
|
temperature: 0.7
|
|
endpoints:
|
|
chat: /v3/chat
|
|
bot-info: /v1/bot/get_online_info
|
|
conversation: /v1/conversation/create
|
|
rate-limit:
|
|
requests-per-minute: 60
|
|
requests-per-hour: 1000
|
|
|
|
# Spring AI配置
|
|
spring:
|
|
ai:
|
|
retry:
|
|
max-attempts: 3
|
|
backoff:
|
|
initial-interval: 1000
|
|
multiplier: 2
|
|
max-interval: 10000
|
|
timeout: 30s
|
|
|
|
# 对话配置
|
|
conversation:
|
|
max-history: 20
|
|
session-timeout: 1800
|
|
guest-session-timeout: 600
|
|
max-message-length: 2000
|
|
auto-save: true
|
|
cache:
|
|
enabled: true
|
|
ttl: 3600
|
|
|
|
# 情感分析配置
|
|
emotion:
|
|
analysis:
|
|
enabled: true
|
|
confidence-threshold: 0.6
|
|
cache-results: true
|
|
cache-ttl: 1800
|
|
categories:
|
|
- joy
|
|
- sadness
|
|
- anger
|
|
- fear
|
|
- surprise
|
|
- disgust
|
|
- neutral
|
|
|
|
# 限流配置
|
|
rate-limit:
|
|
enabled: true
|
|
default-limit: 20
|
|
default-window: 60
|
|
api-limits:
|
|
"/chat": 10
|
|
"/emotion/analyze": 30
|
|
"/conversation/create": 5
|
|
|
|
# 缓存配置
|
|
cache:
|
|
redis:
|
|
default-ttl: 3600
|
|
conversation-ttl: 1800
|
|
emotion-analysis-ttl: 7200
|
|
user-session-ttl: 3600
|
|
|
|
# 安全配置
|
|
security:
|
|
ignore-urls:
|
|
- /actuator/**
|
|
- /api/public/**
|
|
- /swagger-ui/**
|
|
- /v3/api-docs/**
|
|
|
|
# 文件配置
|
|
file:
|
|
temp-dir: /tmp/emotion-ai
|
|
max-size: 5MB
|
|
cleanup-interval: 3600
|
|
|
|
# 监控告警配置
|
|
alert:
|
|
enabled: true
|
|
thresholds:
|
|
api-response-time: 5000
|
|
error-rate: 10
|
|
coze-api-failure-rate: 20
|
|
notification:
|
|
enabled: false
|
|
|
|
# 测试环境特殊配置
|
|
test:
|
|
debug:
|
|
enabled: true
|
|
log-requests: true
|
|
log-responses: false
|
|
log-ai-interactions: true
|
|
mock:
|
|
enabled: false
|
|
coze-api: false
|
|
data:
|
|
auto-init: true
|
|
sample-conversations: true
|