Skip to content

思考 / 渲染 / 输出优化配置 进阶

本文对照 config 默认配置版本(config/config.jsgetDefaultConfig(),对应提交 5351e7d7)。仅收录能在该默认配置中核实的字段。

思考配置 thinking

thinking 段是思考(推理)相关的全局默认值,可被渠道、预设、单次请求逐级覆盖(由 src/services/llm/ThinkingOptions.jsresolveThinkingOptions 解析,优先级:请求 > 预设 > 渠道 > 全局)。

yaml
thinking:
  enabled: true               # 思考适配总开关(关闭后不解析和显示思考内容)
  defaultLevel: 'low'         # 思考深度: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'auto'
  enableReasoning: false      # 启用推理模式(发送 reasoning 参数给 API)
  reasoningBudgetTokens: 0    # 推理预算 tokens,0 表示不指定
  showThinkingContent: true   # 显示思考内容
  useForwardMsg: true         # 思考内容使用合并转发
字段类型默认值说明
thinking.enabledbooleantrue思考适配总开关,为 false 时关闭推理相关的解析与展示
thinking.defaultLevelstring'low'默认思考深度,枚举值见上方代码块注释
thinking.enableReasoningbooleanfalse是否发送 reasoning 参数(启用推理)
thinking.reasoningBudgetTokensnumber0推理 token 预算,0 表示不指定
thinking.showThinkingContentbooleantrue是否向用户显示思考内容
thinking.useForwardMsgbooleantrue思考内容是否以合并转发消息发送

可选键 thinking.vendorThinkingControl(默认配置中无该字段):可选值 'auto' / 'off' / 'glm',由 resolveThinkingOptions 读取 globalThinking.vendorThinkingControl,用于智谱等厂商需在请求体传 thinking.type 的场景。各渠道单独的思考配置见 渠道高级配置advanced.thinking

渲染配置 render

yaml
render:
  mathFormula: true          # 启用数学公式自动渲染为图片
  theme: 'light'             # 渲染主题: 'light' | 'dark'
  width: 800                 # 渲染宽度
字段类型默认值说明
render.mathFormulabooleantrue数学公式自动渲染为图片
render.themestring'light'渲染主题,可选 'light' / 'dark'
render.widthnumber800渲染宽度

消费点:apps/chat.jsrender.mathFormula !== falserender.theme || 'light'render.width || 800)。

输出优化配置 output

yaml
output:
  # 长文本处理
  longText:
    enabled: true            # 启用长文本优化
    threshold: 500           # 长文本阈值(字符数)
    mode: 'forward'          # 处理模式: 'auto' | 'forward' | 'image' | 'none'(默认合并转发)
    forwardTitle: 'AI 回复'  # 合并转发标题
  # 按句输出
  sentenceOutput:
    enabled: false           # 启用按句输出
    allSentences: false      # 全部按句输出(否则仅伪人模式)
    minDelay: 300            # 句子间最小延迟(毫秒)
    maxDelay: 1500           # 句子间最大延迟(毫秒)
    randomDelay: true        # 随机延迟(更自然)
字段类型默认值说明
output.longText.enabledbooleantrue长文本优化开关
output.longText.thresholdnumber500触发长文本处理的字符数阈值
output.longText.modestring'forward''auto' / 'forward' / 'image' / 'none',默认行为为合并转发
output.longText.forwardTitlestring'AI 回复'合并转发的标题
output.sentenceOutput.enabledbooleanfalse按句输出开关
output.sentenceOutput.allSentencesbooleanfalse是否对所有消息按句输出;为 false 时仅伪人模式按句输出
output.sentenceOutput.minDelaynumber300句子间最小延迟(毫秒)
output.sentenceOutput.maxDelaynumber1500句子间最大延迟(毫秒)
output.sentenceOutput.randomDelaybooleantrue是否在 min/max 之间随机延迟

消费点:apps/chat.jsapps/bym.js 均读取 output.longTextoutput.sentenceOutput

基础设施配置(同属顶层默认配置段)

流式输出 streaming

yaml
streaming:
  enabled: true

默认配置中 streaming 仅含 enabled: trueconfig.yaml 实例另有 chunkSize: 1024 键(同样出现在渠道 advanced.streaming 中),该键不在默认配置注释中,如需全局调整请以面板行为为准。

负载均衡 loadBalancing

yaml
loadBalancing:
  strategy: priority   # 'priority' | 'round-robin' | 'random'
字段类型默认值说明
loadBalancing.strategystring'priority'渠道选择策略。ChannelManager.selectBestChannel 支持 'priority' / 'round-robin' / 'random' / 'least-connection',未配置时回退 'priority'

IP 探针 probe

yaml
probe:
  serverUrl: 'http://127.0.0.1:9527'       # 探针服务器地址
  secretKey: 'your-secret-key-change-me'   # API 密钥,需与服务端一致
字段类型默认值说明
probe.serverUrlstring'http://127.0.0.1:9527'探针服务器地址
probe.secretKeystring'your-secret-key-change-me'API 密钥,需与服务端一致

AI 声聊配置 voice

yaml
voice:
  enabled: false             # 全局开关
  defaultCharacter: ''       # 默认 AI 声聊角色
  maxTextLength: 500         # 最大文本长度
字段类型默认值说明
voice.enabledbooleanfalseAI 声聊全局开关(QQ 原生功能)
voice.defaultCharacterstring''默认 AI 声聊角色
voice.maxTextLengthnumber500最大文本长度

区分两处「语音」配置

  • 顶层 voice 段(本页):AI 声聊(QQ 原生功能)。
  • features.voiceReply 段(功能配置):语音回复(旧配置,兼容),含 enabled / ttsProvider / triggerOnTool / triggerAlways / maxTextLength

更新配置 update

yaml
update:
  autoCheck: true       # 启用自动检查更新
  checkOnStart: true    # 启动时检查更新
  autoUpdate: false     # 自动更新(不推荐)
  autoRestart: false    # 更新后自动重启
  notifyMaster: true    # 有更新时通知主人
字段类型默认值说明
update.autoCheckbooleantrue自动检查更新
update.checkOnStartbooleantrue启动时检查更新
update.autoUpdatebooleanfalse自动更新(默认关闭,注释标注「不推荐」)
update.autoRestartbooleanfalse更新后自动重启
update.notifyMasterbooleantrue有更新时通知主人

Web 服务配置 web

yaml
web:
  port: 3000          # 监听端口
  sharePort: false    # TRSS 环境下共享端口
  mountPath: /chatai  # TRSS 共享端口时的挂载路径
  corsOrigins: []     # 额外允许跨域访问的来源,形如 https://panel.example.com
字段类型默认值说明
web.portnumber3000Web 面板监听端口。端口被占用(EADDRINUSE)时服务会尝试自动切换(src/services/webServer.js
web.sharePortbooleanfalseTRSS 环境下共享 Yunzai 端口
web.mountPathstring'/chatai'TRSS 共享端口时的挂载路径
web.corsOriginsstring[][]额外允许的跨域来源。同源、本机回环、web.publicUrlweb.loginLinks 已默认放行,无需重复填写

默认配置之外、由运行时自动写入或按需配置的键(不在默认配置中,据 src/services/webServer.jssrc/services/routes/configRoutes.js):web.jwtSecret(未配置时自动生成 UUID)、web.publicUrlweb.loginLinksweb.permanentAuthTokenweb.groupAdminSecret(实例配置中出现)。这些键不是默认配置内容,本页不作字段表收录。

图片存储配置 images

yaml
images:
  storagePath: './data/images'
  maxSize: 10485760                 # 10 * 1024 * 1024 字节
  allowedFormats:
    - jpg
    - jpeg
    - png
    - gif
    - webp
字段类型默认值说明
images.storagePathstring'./data/images'图片存储路径
images.maxSizenumber10485760图片大小上限(字节,10 MB)
images.allowedFormatsstring[]['jpg','jpeg','png','gif','webp']允许的图片格式

Redis 缓存配置 redis

yaml
redis:
  enabled: true
  host: '127.0.0.1'
  port: 6379
  password: ''
  db: 0
字段类型默认值说明
redis.enabledbooleantrue启用 Redis 缓存
redis.hoststring'127.0.0.1'Redis 主机
redis.portnumber6379Redis 端口
redis.passwordstring''Redis 密码,留空表示无密码
redis.dbnumber0Redis 数据库编号

消费点:src/core/cache/RedisClient.jsconfig.get('redis'))、配置接口 src/services/routes/configRoutes.jsGET /redisPOST /redis 写入)。

B 站视频配置 bilibili

yaml
bilibili:
  sessdata: ''   # B 站登录 Cookie 的 SESSDATA,用于获取 AI 视频总结
字段类型默认值说明
bilibili.sessdatastring''B 站登录 Cookie 的 SESSDATA,用于获取 AI 视频总结

消费点:src/mcp/tools/bltools.jsconfig.get('bilibili.sessdata'))。

下一步

基于 MIT 许可发布