Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
Target branch: Please verify that the pull request targets the dev branch.
Description: Provide a concise description of the changes made in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Have you written and run sufficient tests to validate the changes?
Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
BREAKING CHANGE: Significant changes that may affect compatibility
build: Changes that affect the build system or external dependencies
ci: Changes to our continuous integration processes or workflows
chore: Refactor, cleanup, or other non-functional code changes
docs: Documentation update or addition
feat: Introduces a new feature or enhancement to the codebase
fix: Bug fix or error correction
i18n: Internationalization or localization changes
perf: Performance improvement
refactor: Code restructuring for better maintainability, readability, or scalability
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
test: Adding missing tests or correcting existing tests
WIP: Work in progress, a temporary label for incomplete or ongoing work
Changelog Entry
Description
Follow-Up on https://github.com/open-webui/open-webui/issues/13834 to remove inline markdown images (base64, urls, ...) before sending the messages to the task models. This allows title/tag generation even when inline images are present.
Changed
Added another regex string for replacement before task execution
Put content cleaning in separate method for less complexity in middleware method
Additional Information
Tested the method with the following function
importpytestdeftest_filter_message_content_for_tasks():# Test case 1: Basic string contentmessage_list=[{"role":"user","content":"Hello, what's the task?"},{"role":"assistant","content":"The task is to create a Python script."}]filtered=filter_message_content_for_tasks(message_list)assertfiltered==message_list# Content should remain unchanged# Test case 2: Content with details tagsmessage_list=[{"role":"user","content":"Please help me with this.<details>Extra info</details>"},{"role":"assistant","content":"<details type=\"reasoning\">Reasoning: I think this is the best approach.</details>My answer is 42."}]filtered=filter_message_content_for_tasks(message_list)assertfiltered[0]["content"]=="Please help me with this."assertfiltered[1]["content"]=="My answer is 42."# Test case 3: Content with imagesmessage_list=[{"role":"user","content":"Here's my diagram:  What do you think?"},{"role":"assistant","content":" This looks good."}]filtered=filter_message_content_for_tasks(message_list)assertfiltered[0]["content"]=="Here's my diagram: What do you think?",filtered[0]["content"]assertfiltered[1]["content"]=="This looks good.",filtered[1]["content"]# Test case 4: Content as list with text itemsmessage_list=[{"role":"user","content":[{"type":"text","text":"Here's my question"}]},{"role":"assistant","content":[{"type":"text","text":"Here's my answer"}]}]filtered=filter_message_content_for_tasks(message_list)assertfiltered[0]["content"]=="Here's my question"assertfiltered[1]["content"]=="Here's my answer"# Test case 5: Mixed contentmessage_list=[{"role":"user","content":"Query with <details>hidden details</details> and "},{"role":"assistant","content":[{"type":"text","text":"<details>Reasoning</details>Answer"}]}]filtered=filter_message_content_for_tasks(message_list)assertfiltered[0]["content"]=="Query with and"assertfiltered[1]["content"]=="Answer"# Test case 6: Content with base64 encoded imagesmessage_list=[{"role":"user","content":"Here's my screenshot: "},{"role":"assistant","content":"I see your \n and it looks good."}]filtered=filter_message_content_for_tasks(message_list)assertfiltered[0]["content"]=="Here's my screenshot:",filtered[0]["content"]assertfiltered[1]["content"]=="I see your \n and it looks good.",filtered[1]["content"]print("Running tests...")test_filter_message_content_for_tasks()print("All tests passed!")
Screenshots or Videos
[Attach any relevant screenshots or videos demonstrating the changes]
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 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/14036
**Author:** [@almajo](https://github.com/almajo)
**Created:** 5/19/2025
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `task/ignore_base64_images_tasks`
---
### 📝 Commits (1)
- [`83c50d6`](https://github.com/open-webui/open-webui/commit/83c50d6476736157ce76f65fccbf6ff33ed4f9f7) Refac and remove inline images
### 📊 Changes
**2 files changed** (+0 additions, -0 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/utils/middleware.py` (+2 -24)
📝 `backend/open_webui/utils/task.py` (+44 -0)
</details>
### 📄 Description
# Pull Request Checklist
### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request.
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Please verify that the pull request targets the `dev` branch.
- [x] **Description:** Provide a concise description of the changes made in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [x] **Testing:** Have you written and run sufficient tests to validate the changes?
- [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
- [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following:
- **BREAKING CHANGE**: Significant changes that may affect compatibility
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our continuous integration processes or workflows
- **chore**: Refactor, cleanup, or other non-functional code changes
- **docs**: Documentation update or addition
- **feat**: Introduces a new feature or enhancement to the codebase
- **fix**: Bug fix or error correction
- **i18n**: Internationalization or localization changes
- **perf**: Performance improvement
- **refactor**: Code restructuring for better maintainability, readability, or scalability
- **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
- **test**: Adding missing tests or correcting existing tests
- **WIP**: Work in progress, a temporary label for incomplete or ongoing work
# Changelog Entry
### Description
Follow-Up on https://github.com/open-webui/open-webui/issues/13834 to remove inline markdown images (base64, urls, ...) before sending the messages to the task models. This allows title/tag generation even when inline images are present.
### Changed
- Added another regex string for replacement before task execution
- Put content cleaning in separate method for less complexity in middleware method
---
### Additional Information
Tested the method with the following function
```python
import pytest
def test_filter_message_content_for_tasks():
# Test case 1: Basic string content
message_list = [
{"role": "user", "content": "Hello, what's the task?"},
{"role": "assistant", "content": "The task is to create a Python script."}
]
filtered = filter_message_content_for_tasks(message_list)
assert filtered == message_list # Content should remain unchanged
# Test case 2: Content with details tags
message_list = [
{"role": "user", "content": "Please help me with this.<details>Extra info</details>"},
{"role": "assistant", "content": "<details type=\"reasoning\">Reasoning: I think this is the best approach.</details>My answer is 42."}
]
filtered = filter_message_content_for_tasks(message_list)
assert filtered[0]["content"] == "Please help me with this."
assert filtered[1]["content"] == "My answer is 42."
# Test case 3: Content with images
message_list = [
{"role": "user", "content": "Here's my diagram:  What do you think?"},
{"role": "assistant", "content": " This looks good."}
]
filtered = filter_message_content_for_tasks(message_list)
assert filtered[0]["content"] == "Here's my diagram: What do you think?", filtered[0]["content"]
assert filtered[1]["content"] == "This looks good.", filtered[1]["content"]
# Test case 4: Content as list with text items
message_list = [
{"role": "user", "content": [{"type": "text", "text": "Here's my question"}]},
{"role": "assistant", "content": [{"type": "text", "text": "Here's my answer"}]}
]
filtered = filter_message_content_for_tasks(message_list)
assert filtered[0]["content"] == "Here's my question"
assert filtered[1]["content"] == "Here's my answer"
# Test case 5: Mixed content
message_list = [
{"role": "user", "content": "Query with <details>hidden details</details> and "},
{"role": "assistant", "content": [{"type": "text", "text": "<details>Reasoning</details>Answer"}]}
]
filtered = filter_message_content_for_tasks(message_list)
assert filtered[0]["content"] == "Query with and"
assert filtered[1]["content"] == "Answer"
# Test case 6: Content with base64 encoded images
message_list = [
{"role": "user", "content": "Here's my screenshot: "},
{"role": "assistant", "content": "I see your \n and it looks good."}
]
filtered = filter_message_content_for_tasks(message_list)
assert filtered[0]["content"] == "Here's my screenshot:", filtered[0]["content"]
assert filtered[1]["content"] == "I see your \n and it looks good.", filtered[1]["content"]
print("Running tests...")
test_filter_message_content_for_tasks()
print("All tests passed!")
```
### Screenshots or Videos
- [Attach any relevant screenshots or videos demonstrating the changes]
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/14036
Author: @almajo
Created: 5/19/2025
Status: ❌ Closed
Base:
dev← Head:task/ignore_base64_images_tasks📝 Commits (1)
83c50d6Refac and remove inline images📊 Changes
2 files changed (+0 additions, -0 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+2 -24)📝
backend/open_webui/utils/task.py(+44 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Follow-Up on https://github.com/open-webui/open-webui/issues/13834 to remove inline markdown images (base64, urls, ...) before sending the messages to the task models. This allows title/tag generation even when inline images are present.
Changed
Additional Information
Tested the method with the following function
Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.