issue: bug: Channel model reply stores empty content — channel emitter reads contentbut pipeline emits output`**

用户在 Ubuntu 24.04 系统上通过 Docker 部署 Open WebUI v0.10.2,启用 Channel 功能(ENABLE_CHANNELS=true 和 ENABLE_WEBSOCKET_SUPPORT=true),连接到兼容 OpenAI API 的 vLLM 后端。在 S

issue: bug: Channel model reply stores empty content — channel emitter reads contentbut pipeline emits output`**

issue: bug: Channel model reply stores empty content — channel emitter reads contentbut pipeline emits output`**

快速结论:此问题通常出现在 Open WebUI Channel 中使用 @ 提及模型时,模型虽完成推理(meta 中 done: true),但回复内容始终存储为空字符串,气泡只显示脉冲圆点。优先排查 backend/open_webui/socket/main.py 中的 channel emitter 是否从事件数据的 output 字段正确读取响应内容。

问题场景

用户在 Ubuntu 24.04 系统上通过 Docker 部署 Open WebUI v0.10.2,启用 Channel 功能(ENABLE_CHANNELS=true 和 ENABLE_WEBSOCKET_SUPPORT=true),连接到兼容 OpenAI API 的 vLLM 后端。在 Standard 频道中使用 @model 提及模型并发送问题后,模型成功被调用且 pipeline 完整执行(meta 中 done: true),但回复内容始终为空。

报错原文

Database query confirms:
  content: ""
  meta: {"model_id": "...", "model_name": "...", "done": true}

原因分析

源代码中存在 key 名称不匹配的问题:

  • backend/open_webui/socket/main.py 中的 _make_channel_emitter 函数通过 data.get('content', '') 读取响应文本,即期望从事件数据中获取 content 字段。
  • 但在 backend/open_webui/utils/middleware.py(约第3525行)中,最终发出的 chat:completion 事件使用的是 'output': response_output,即文本内容位于 output 字段下(格式为 output[].content[].text),而顶层 content 键缺失。

由于 channel emitter 未读取 output 字段,content 默认为空字符串,导致回复内容被存储为空。

环境排查

  • Docker 版本:29.6.1
  • Open WebUI 版本:v0.10.2(Docker 部署)
  • 操作系统:Ubuntu 24.04
  • 浏览器:Chrome
  • 后端 LLM 服务:vLLM 或其他兼容 OpenAI API 的服务(通过 OPENAI_API_BASE_URL 连接)
  • 需要确认的环境变量:ENABLE_CHANNELS=true, ENABLE_WEBSOCKET_SUPPORT=true

解决步骤

  1. 修改 backend/open_webui/socket/main.py_make_channel_emitter 函数,使其在读取响应内容时优先检查 output 字段,若 output 存在则从其内容中提取文本,否则回退到 content 字段。
  2. 修改 backend/open_webui/utils/middleware.py 中发送 chat:completion 事件的代码,确保顶层 content 字段包含响应文本,以保持与现有 emitter 兼容。
  3. 重建并部署修改后的 Docker 镜像,或直接替换容器中的对应文件后重启服务。

注:以上步骤基于 Issue 作者提供的修复思路,若当前版本已有官方补丁,建议优先更新到包含该修复的版本。

验证方法

在 Channel 中再次使用 @model 发送一条消息,确认回复内容正常渲染显示。也可通过数据库查询验证 message 表中的 content 字段不再是空字符串:

docker exec open-webui python3 -c "
import sqlite3
conn = sqlite3.connect('/app/backend/data/webui.db')
cur = conn.cursor()
cur.execute('SELECT content, meta FROM message ORDER BY created_at DESC LIMIT 3')
for row in cur.fetchall(): print(row)
conn.close()"

参考来源

open-webui/open-webui #26960

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

celebrityanime
celebrityanime
文章: 12333

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注