mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #2447] [Bug] OpenWebUI fails to communicate with OpenAI-like local server when in chat #51552
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AlyMobarak on GitHub (May 21, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/2447
Hey there! I love your tool so much already.. just had a tiny little problem that I'll work on fixing (but I don't know if I'll be able to). P.S. I can't find the template anywhere so I hope I've provided enough information.
Simply speaking, whenever the WebUI tries to get completion from the local OpenAI API server (hosted through LM Studio fyi), it sends over an empty assistant message. I get the following error on the UI,

And on my local server, I get this:

Expected Behavior: only the user message is sent over to the API, and then when the completion is generated, it gets added to the history.
Actual behavior: the API receives an empty assistant message and can't generate a completion from there.
I confirm that I am on the latest version of OpenWebUI and LM Studio that follows the same exact API format as OpenAI.
After digging a bit into your code, I understand why you are creating this message and adding it to the history before the completion. I think it is to send over the ID of that message and update the message when the completion is done.
My initial thinking is that we could somehow prevent it from being sent over to the API with the simple check (though its still in messages to ensure it gets updated). I'll try to work on it and update you. Thank you for your helpful tool!!
References:
3355577bac/src/routes/(app)/c/%5Bid%5D/%2Bpage.svelte#L272-L286Changes could be maybe done to solve this issue
3355577bac/src/routes/(app)/c/%5Bid%5D/%2Bpage.svelte#L609-L621@AlyMobarak commented on GitHub (May 21, 2024):
Found a fix. I just literally added .filter((messages) => message.content != "") after filter((messages) => message) and it worked.
Working on a good PR rn.
@justinh-rahb commented on GitHub (May 21, 2024):
As usual with any new release, we often do some fixes afterwards that push direct to
mainand build new Docker images. If you haven't already done so as of 3hrs ago please try re-pulling again.@AlyMobarak commented on GitHub (May 21, 2024):
I have just downloaded OpenWebUI like 1 hr prior to addressing this issue. It works now using my PR.. should I do anything else?
@AlyMobarak commented on GitHub (May 21, 2024):
#2453 PR
@tjbck commented on GitHub (May 21, 2024):
PR Merged! Thanks!
@AlyMobarak commented on GitHub (May 21, 2024):
Thank you!