[PR #24898] [CLOSED] fix: forward channel document files to model replies #131581

Closed
opened 2026-05-21 17:15:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24898
Author: @rozgo
Created: 5/19/2026
Status: Closed

Base: devHead: fix/channel-model-document-files


📝 Commits (1)

  • a390ff9 fix: forward channel document files to model replies

📊 Changes

1 file changed (+33 additions, -6 deletions)

View changed files

📝 backend/open_webui/routers/channels.py (+33 -6)

📄 Description

Pull Request Checklist

  • Linked Issue/Discussion: Closes #24896; related to [PR #15024] [CLOSED] feat: Added permission to enable/disable image capture (#23686)
  • Target branch: This pull request targets the dev branch.
  • Description: This PR forwards channel document attachments through the existing chat/RAG file pipeline for channel model replies.
  • Changelog: A changelog entry is included below.
  • Documentation: Not applicable; this is a backend bug fix with no new user-facing configuration or workflow.
  • Dependencies: No new or updated dependencies.
  • Testing: Manual and targeted local tests were performed; details below.
  • No Unchecked AI Code: This patch was prepared with AI assistance and manually tested. It should still receive maintainer review before merge.
  • Self-Review: The code path and downstream file/RAG pipeline handoff were reviewed.
  • Architecture: Uses the existing form_data["files"] request shape consumed by the chat completion file/RAG handler. No new settings or architecture changes.
  • Git Hygiene: Atomic PR, based on dev, with no unrelated commits.
  • Title Prefix: The PR title uses the fix: prefix.

Summary

Channel model replies currently build a synthetic chat completion request from the channel thread. That request collected text and image attachments, but dropped non-image files such as PDFs and DOCX files.

This PR forwards non-image channel attachments as form_data["files"], matching the request shape already used by normal direct chat. That lets the existing chat completion file/RAG pipeline process uploaded channel documents for tagged model replies.

The existing image handling is preserved, and repeated file references are deduplicated before forwarding.

Root Cause

backend/open_webui/routers/channels.py iterated over thread_message.data.files inside model_response_handler, but only appended image attachments to the model request. Non-image documents were neither added to the image content nor passed through form_data["files"], so the downstream chat_completion_files_handler never received them.

Direct chat worked because it already passes uploaded files through form_data["files"] into request metadata.

Testing

  • Uploaded PDF/DOCX files to a channel, tagged a model, and confirmed the model could use the uploaded documents instead of asking for them again.
  • Ran python -m py_compile backend/open_webui/routers/channels.py.
  • Ran uvx ruff format --check backend/open_webui/routers/channels.py.
  • Ran git diff --check HEAD~1..HEAD.
  • Ran a focused mocked behavior check for model_response_handler confirming:
    • PDF and DOCX attachments are forwarded in form_data["files"].
    • Image attachments stay in the existing image path.
    • Duplicate non-image file references are deduplicated.
    • Channel routing still uses chat_id = "channel:<id>".

Changelog Entry

Description

  • Fix channel model replies so uploaded non-image documents are forwarded to the existing file/RAG context pipeline.

Added

  • N/A

Changed

  • Channel model reply request construction now includes non-image channel attachments in form_data["files"].

Deprecated

  • N/A

Removed

  • N/A

Fixed

  • Channel model replies no longer ignore uploaded PDF/DOCX and other non-image document attachments.

Security

  • N/A

Breaking Changes

  • N/A

Additional Information

Screenshots or Videos

  • Manual test confirmed the channel model response can use uploaded documents. A screenshot or recording can be added before marking ready for review if desired.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24898 **Author:** [@rozgo](https://github.com/rozgo) **Created:** 5/19/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/channel-model-document-files` --- ### 📝 Commits (1) - [`a390ff9`](https://github.com/open-webui/open-webui/commit/a390ff901ab188e6ed54da690d14ec6714cfbc8f) fix: forward channel document files to model replies ### 📊 Changes **1 file changed** (+33 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/channels.py` (+33 -6) </details> ### 📄 Description # Pull Request Checklist - [x] **Linked Issue/Discussion:** Closes #24896; related to #23686 - [x] **Target branch:** This pull request targets the `dev` branch. - [x] **Description:** This PR forwards channel document attachments through the existing chat/RAG file pipeline for channel model replies. - [x] **Changelog:** A changelog entry is included below. - [x] **Documentation:** Not applicable; this is a backend bug fix with no new user-facing configuration or workflow. - [x] **Dependencies:** No new or updated dependencies. - [x] **Testing:** Manual and targeted local tests were performed; details below. - [x] **No Unchecked AI Code:** This patch was prepared with AI assistance and manually tested. It should still receive maintainer review before merge. - [x] **Self-Review:** The code path and downstream file/RAG pipeline handoff were reviewed. - [x] **Architecture:** Uses the existing `form_data["files"]` request shape consumed by the chat completion file/RAG handler. No new settings or architecture changes. - [x] **Git Hygiene:** Atomic PR, based on `dev`, with no unrelated commits. - [x] **Title Prefix:** The PR title uses the `fix:` prefix. ## Summary Channel model replies currently build a synthetic chat completion request from the channel thread. That request collected text and image attachments, but dropped non-image files such as PDFs and DOCX files. This PR forwards non-image channel attachments as `form_data["files"]`, matching the request shape already used by normal direct chat. That lets the existing chat completion file/RAG pipeline process uploaded channel documents for tagged model replies. The existing image handling is preserved, and repeated file references are deduplicated before forwarding. ## Root Cause `backend/open_webui/routers/channels.py` iterated over `thread_message.data.files` inside `model_response_handler`, but only appended image attachments to the model request. Non-image documents were neither added to the image content nor passed through `form_data["files"]`, so the downstream `chat_completion_files_handler` never received them. Direct chat worked because it already passes uploaded files through `form_data["files"]` into request metadata. ## Testing - Uploaded PDF/DOCX files to a channel, tagged a model, and confirmed the model could use the uploaded documents instead of asking for them again. - Ran `python -m py_compile backend/open_webui/routers/channels.py`. - Ran `uvx ruff format --check backend/open_webui/routers/channels.py`. - Ran `git diff --check HEAD~1..HEAD`. - Ran a focused mocked behavior check for `model_response_handler` confirming: - PDF and DOCX attachments are forwarded in `form_data["files"]`. - Image attachments stay in the existing image path. - Duplicate non-image file references are deduplicated. - Channel routing still uses `chat_id = "channel:<id>"`. # Changelog Entry ### Description - Fix channel model replies so uploaded non-image documents are forwarded to the existing file/RAG context pipeline. ### Added - N/A ### Changed - Channel model reply request construction now includes non-image channel attachments in `form_data["files"]`. ### Deprecated - N/A ### Removed - N/A ### Fixed - Channel model replies no longer ignore uploaded PDF/DOCX and other non-image document attachments. ### Security - N/A ### Breaking Changes - N/A --- ### Additional Information - Closes #24896 - Related to #23686 - No new dependencies or configuration changes. ### Screenshots or Videos - Manual test confirmed the channel model response can use uploaded documents. A screenshot or recording can be added before marking ready for review if desired. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:15:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#131581