[PR #2453] [MERGED] [fix] for issue #2447 (OpenAI-like API fails when a redundant, empty assistant message is sent over) #7798

Closed
opened 2025-11-11 17:36:15 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/2453
Author: @AlyMobarak
Created: 5/21/2024
Status: Merged
Merged: 5/21/2024
Merged by: @tjbck

Base: devHead: main


📝 Commits (10+)

  • be5534c Merge pull request #2376 from open-webui/dev
  • 66c2024 Merge pull request #2395 from open-webui/dev
  • 7068ea9 Merge pull request #2397 from open-webui/dev
  • 2ce6535 Merge pull request #2401 from open-webui/dev
  • 175293f Merge pull request #2422 from open-webui/dev
  • aea81fc Merge pull request #2427 from open-webui/dev
  • 3355577 Merge pull request #2436 from open-webui/dev
  • 8116b04 Filter message and don't send over any message that has empty contents to OpenAI's API.
  • a07b89d Updated filter to filter null message objects as well.
  • b87cf0d Filters messages before going through to the OpenAI API to not include any empty messages.

📊 Changes

2 files changed (+32 additions, -31 deletions)

View changed files

📝 src/routes/(app)/+page.svelte (+16 -16)
📝 src/routes/(app)/c/[id]/+page.svelte (+16 -15)

📄 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:

  • [] Target branch: Please verify that the pull request targets the dev branch.
  • [] Description:
  • [] Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • [NO NEED] Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • [NO NEED] Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • [NO NEED] Testing: Have you written and run sufficient tests for validating 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?
  • [] Label: fix

Changelog Entry

Description

I've noticed an issue with the UI described at issue https://github.com/open-webui/open-webui/issues/2447. After fiddling around for some time, I've come up with a really simple solution that doesn't require any major code refactoring or even a change in testing methods. I simply added a rule to filter messages before getting sent to OpenAI API and remove empty ones. I have no idea if the actual OpenAI API accepts this or not as I'm broke enough to not be able to buy the API and test on it, but it should work fine based on my ChatGPT free usage network monitoring.

I've tested it on my LM Studio OpenAI like server and it works like a charm now.. I'll be using my local image for the docker container (which was built successfully btw) until this change is hopefully upstream.

Added

  • N/A

Changed

  • N/A

Deprecated

  • N/A

Removed

  • N/A

Fixed

  • Filtered messages before getting sent to an OpenAI API or similar based on whether they have actual contents or not. This should not have any effects on what was previously working, but would make OpenAI APIs like LM Studio's work.

Security

  • N/A

Breaking Changes

  • N/A

Additional Information

Screenshots or Videos

BEFORE:
Before Bug Fix, OpenWebUI Interface

AFTER:
Screenshot 2024-05-21 at 1 47 20 PM


🔄 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/2453 **Author:** [@AlyMobarak](https://github.com/AlyMobarak) **Created:** 5/21/2024 **Status:** ✅ Merged **Merged:** 5/21/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (10+) - [`be5534c`](https://github.com/open-webui/open-webui/commit/be5534c655f6cb3cc54c079de3f19d671e7a172b) Merge pull request #2376 from open-webui/dev - [`66c2024`](https://github.com/open-webui/open-webui/commit/66c2024d76729acb1787bdf2b066fc91fc1ed124) Merge pull request #2395 from open-webui/dev - [`7068ea9`](https://github.com/open-webui/open-webui/commit/7068ea9279e88c90a204d9de0a720bcc88506922) Merge pull request #2397 from open-webui/dev - [`2ce6535`](https://github.com/open-webui/open-webui/commit/2ce6535a2d276b74005c8056741bdb5b3e663940) Merge pull request #2401 from open-webui/dev - [`175293f`](https://github.com/open-webui/open-webui/commit/175293fb633cd6697039d751315aae0098519fbf) Merge pull request #2422 from open-webui/dev - [`aea81fc`](https://github.com/open-webui/open-webui/commit/aea81fc9884a74992d42a31fd83ea3e448fe137a) Merge pull request #2427 from open-webui/dev - [`3355577`](https://github.com/open-webui/open-webui/commit/3355577bac260d5f4ffb0d84a78bacd7be236c20) Merge pull request #2436 from open-webui/dev - [`8116b04`](https://github.com/open-webui/open-webui/commit/8116b04338716b97f8496a8213022e26c21b8f07) Filter message and don't send over any message that has empty contents to OpenAI's API. - [`a07b89d`](https://github.com/open-webui/open-webui/commit/a07b89da6fd5fa15735919b9ddd92914268e2961) Updated filter to filter null message objects as well. - [`b87cf0d`](https://github.com/open-webui/open-webui/commit/b87cf0db7de28f7ae8b39090e504ee389d670c80) Filters messages before going through to the OpenAI API to not include any empty messages. ### 📊 Changes **2 files changed** (+32 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/routes/(app)/+page.svelte` (+16 -16) 📝 `src/routes/(app)/c/[id]/+page.svelte` (+16 -15) </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:** - [✅] **Target branch:** Please verify that the pull request targets the `dev` branch. - [✅] **Description:** - [✅] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [NO NEED] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [NO NEED] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [NO NEED] **Testing:** Have you written and run sufficient tests for validating 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? - [✅] **Label:** fix # Changelog Entry ### Description I've noticed an issue with the UI described at issue https://github.com/open-webui/open-webui/issues/2447. After fiddling around for some time, I've come up with a really simple solution that doesn't require any major code refactoring or even a change in testing methods. I simply added a rule to filter messages before getting sent to OpenAI API and remove empty ones. I have no idea if the actual OpenAI API accepts this or not as I'm broke enough to not be able to buy the API and test on it, but it should work fine based on my ChatGPT free usage network monitoring. I've tested it on my LM Studio OpenAI like server and it works like a charm now.. I'll be using my local image for the docker container (which was built successfully btw) until this change is hopefully upstream. ### Added - N/A ### Changed - N/A ### Deprecated - N/A ### Removed - N/A ### Fixed - Filtered messages before getting sent to an OpenAI API or similar based on whether they have actual contents or not. This should not have any effects on what was previously working, but would make OpenAI APIs like LM Studio's work. ### Security - N/A ### Breaking Changes - N/A --- ### Additional Information - Issue #2447 ### Screenshots or Videos BEFORE: ![Before Bug Fix, OpenWebUI Interface](https://github.com/open-webui/open-webui/assets/147055589/baf12452-8cba-4d2e-91f8-5dbaab263981) AFTER: ![Screenshot 2024-05-21 at 1 47 20 PM](https://github.com/open-webui/open-webui/assets/147055589/98f1f8ef-d3aa-4c84-9311-6beeae5240c3) --- <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 2025-11-11 17:36:15 -06: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#7798