Skip to content

Comments

fix: NOTES: Fix broken message submission to completions endpoin#19079

Closed
Classic298 wants to merge 2 commits intoopen-webui:devfrom
Classic298:dev
Closed

fix: NOTES: Fix broken message submission to completions endpoin#19079
Classic298 wants to merge 2 commits intoopen-webui:devfrom
Classic298:dev

Conversation

@Classic298
Copy link
Collaborator

Before submitting, make sure you've checked the following:

  • Target branch: Verify that the pull request targets the dev branch. Not targeting the dev branch will lead to immediate closure of the PR.
  • Description: Provide a concise description of the changes made in this pull request down below.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: If necessary, update relevant documentation Open WebUI Docs like environment variables, the tutorials, or other documentation sources.
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description.
  • Agentic AI Code: Confirm this Pull Request is not written by any AI Agent or has at least gone through additional human review AND manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
  • 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?
  • Title Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction

Changelog Entry

Description

This PR fixes a bug in the Notes Chat feature that caused 400 Bad Request errors when sending messages to AI models. The issue was caused by internal UI state fields being incorrectly included in API requests.

Root Cause:* The Notes Chat feature was creating placeholder assistant messages with internal UI state fields (done: false) for streaming response management. These messages were being sent directly to the API without sanitization, violating the OpenAI message format specification.

Solution: Implemented a message cleaning pipeline that:

  1. Filters out empty assistant messages used as UI placeholders
  2. Maps messages to only include standard OpenAI fields (role, content, and optionally name)
  3. Removes all internal state management fields before API transmission

Changed

  • Refactored message preparation to filter out empty assistant messages and internal UI fields before API calls
  • Messages are now cleaned to only include OpenAI-compliant fields (role, content, name)

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.

Note

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

@Classic298
Copy link
Collaborator Author

fixed in dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant