Skip to content

基础配置

本文档介绍插件的基础配置选项。

命令前缀

yaml
# 命令前缀,用于管理命令
commandPrefix: "#"

管理命令示例:

  • #ai管理面板
  • #ai状态
  • #结束对话

调试模式

yaml
# 开启调试模式
debug: false

调试模式会输出:

  • API 请求和响应详情
  • 工具调用日志
  • 错误堆栈信息

注意

生产环境应关闭调试模式,避免性能影响和信息泄露

欢迎消息

yaml
# 首次使用时显示欢迎消息
welcomeMessage: true

日志配置

yaml
log:
  # 日志级别: debug | info | warn | error
  level: info
  
  # 是否输出到文件
  file: false
  
  # 日志文件路径
  filePath: logs/chatai.log

Web 服务配置

yaml
web:
  # 是否启用 Web 服务
  enabled: true
  
  # 监听端口
  port: 3000
  
  # 监听地址
  host: "0.0.0.0"
  
  # TRSS 共享端口
  sharePort: false
  
  # 挂载路径(共享端口时使用)
  mountPath: /chatai

安全配置

yaml
security:
  # Token 有效期(小时)
  tokenExpiry: 24
  
  # 登录失败锁定次数
  maxLoginAttempts: 5
  
  # 锁定时间(分钟)
  lockoutDuration: 30

性能配置

yaml
performance:
  # 请求超时(毫秒)
  timeout: 60000
  
  # 最大并发请求数
  maxConcurrent: 10
  
  # 启用响应缓存
  cache: true
  
  # 缓存过期时间(秒)
  cacheTTL: 300

限流配置

yaml
rateLimit:
  # 启用限流
  enabled: true
  
  # 时间窗口(毫秒)
  windowMs: 60000
  
  # 窗口内最大请求数
  max: 30

完整示例

yaml
# 基础配置
commandPrefix: "#"
debug: false
welcomeMessage: true

# 日志配置
log:
  level: info
  file: false

# Web 服务
web:
  enabled: true
  port: 3000
  host: "0.0.0.0"

# 安全配置
security:
  tokenExpiry: 24
  maxLoginAttempts: 5

# 性能配置
performance:
  timeout: 60000
  maxConcurrent: 10
  cache: true

# 限流配置
rateLimit:
  enabled: true
  windowMs: 60000
  max: 30

下一步

基于 MIT 许可发布