issue: Attached documents are merged into the latest message instead of staying scoped to their original user message

用户使用 Open WebUI v0.9.6(Docker 安装),在 Oracle Linux Server 8.10 环境下开启 Admin Panel > Settings > Documents > Bypass Embedding and Retrieval 选项后,在单轮对话中先后上传不

issue: Attached documents are merged into the latest message instead of staying scoped to their original user message

issue: Attached documents are merged into the latest message instead of staying scoped to their original user message

快速结论:当开启 Bypass Embedding and Retrieval 时,Open WebUI 会将所有历史上传的附件内容合并到最新一条用户消息的上下文中,而不是将每个文件限定在其原始消息中。优先排查是否关闭了“绕过嵌入与检索”功能,或检查是否有相关缓存优化行为影响了上下文范围。

问题场景

用户使用 Open WebUI v0.9.6(Docker 安装),在 Oracle Linux Server 8.10 环境下开启 Admin Panel > Settings > Documents > Bypass Embedding and Retrieval 选项后,在单轮对话中先后上传不同 PDF 文件并发送消息。预期每个附件应仅随其对应的用户消息发送,但实际观察到的行为是所有历史附件的内容都被注入到最新消息的上下文中。

报错原文

Open WebUI flattens all previously attached documents into the latest message context.

In the final request sent to the model, the prompt is reconstructed as if both documents belong to the latest user message:

[user message A]

<context>
  <source name="document_A.pdf">
    full content of document A
  </source>
  <source name="document_B.pdf">
    full content of document B
  </source>
</context>

原因分析

根本原因是 Open WebUI 在 Bypass Embedding and Retrieval 模式下对附件上下文的处理机制存在设计问题。当用户连续在不同消息中附加不同文件时,系统未按照每条消息的原始附件范围进行隔离,而是将所有历史附件的全文累积到最新一条用户消息的 payload 中。Issue 开发者确认此行为与 #17720 相关但不同——#17720 解决了 RAG 文件上下文是否被注入为系统消息还是用户消息的问题,而当前问题在于附件内容被全局累积。

注意:根据评论,该行为在某些场景下被视为预期设计(与缓存优化相关),当前 Issue 被关闭并转为功能请求。因此,如果你遇到此问题,它可能是当前版本中的固有特性而非缺陷。

环境排查

  • Open WebUI 版本:v0.9.6(请确认是否仍在使用该版本或更新版本)
  • 安装方式:Docker
  • 操作系统:Oracle Linux Server 8.10
  • 确认已开启 Bypass Embedding and Retrieval 选项
  • 检查是否使用了“Use entire document”设置(参见 #23057 中的相关现象)
  • 确认聊天历史中是否存在多条连续的附件消息

解决步骤

  1. 确认是否为预期行为:进入你的 Open WebUI 实例,在开启 Bypass Embedding and Retrieval 的情况下,新建一个聊天,按以下步骤测试:
    • 发送消息 A 并附加 document_A.pdf
    • 等待助手回复
    • 发送消息 B 并附加 document_B.pdf
    • 检查发送给模型的最终请求 payload,观察是否包含了两个文档的全文
  2. 关闭 Bypass Embedding and Retrieval 作为临时方案:Admin Panel > Settings > Documents 中禁用“Bypass Embedding and Retrieval”选项,改为使用默认的嵌入与检索流程。这是目前保证每个附件仅作用于当前消息最直接的方法。
  3. 升级到最新版:虽然这个问题在 v0.9.6 中被关闭并转为功能请求,但请检查你是否在运行最新版本的 Open WebUI。开发者可能已经在后续版本中对此行为进行了调整或增加了配置选项。执行 docker pull ghcr.io/open-webui/open-webui:latest 并重新部署。
  4. 提交功能请求:如果你认为保持附件范围正确是必要功能,可以关注或参与相关讨论(Issue #26040 已被关闭,但相关讨论在 #17720 等链接中)。你也可以在 GitHub Discussions 中提出你的使用场景。

验证方法

在修复或应用临时方案后,进行以下验证:

  • 新建一个聊天,重复重现步骤(发送消息 A 带 document_A.pdf,发送消息 B 带 document_B.pdf)。
  • 通过浏览器开发者工具或服务器日志检查发送到模型的 payload 结构,确认消息 B 的上下文中仅包含 document_B.pdf 的内容,而不包含 document_A.pdf
  • 确认每一条历史消息的附件内容没有被错误地累积到后续消息的上下文中。

参考来源

open-webui/open-webui #26040

GamsGo AI

AI 工具推荐

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

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

了解 GamsGo AI

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

celebrityanime
celebrityanime
文章: 7756

发表回复

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