Originally created by @AlyMobarak on GitHub (May 21, 2024).
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!!
Originally created by @AlyMobarak on GitHub (May 21, 2024).
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:
https://github.com/open-webui/open-webui/blob/3355577bac260d5f4ffb0d84a78bacd7be236c20/src/routes/(app)/c/%5Bid%5D/%2Bpage.svelte#L272-L286
Changes could be maybe done to solve this issue
https://github.com/open-webui/open-webui/blob/3355577bac260d5f4ffb0d84a78bacd7be236c20/src/routes/(app)/c/%5Bid%5D/%2Bpage.svelte#L609-L621
Found a fix. I just literally added .filter((messages) => message.content != "") after filter((messages) => message) and it worked.
Working on a good PR rn.
@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.
As usual with any new release, we often do some fixes afterwards that push direct to main and build new Docker images. If you haven't already done so as of 3hrs ago please try re-pulling again.
@justinh-rahb commented on GitHub (May 21, 2024):
As usual with any new release, we often do some fixes afterwards that push direct to `main` and build new Docker images. If you haven't already done so as of 3hrs ago please try re-pulling again.
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):
I have just downloaded OpenWebUI like 1 hr prior to addressing this issue. It works now using my PR.. should I do anything else?
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.
Originally created by @AlyMobarak on GitHub (May 21, 2024).
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:
https://github.com/open-webui/open-webui/blob/3355577bac260d5f4ffb0d84a78bacd7be236c20/src/routes/(app)/c/%5Bid%5D/%2Bpage.svelte#L272-L286
Changes could be maybe done to solve this issue
https://github.com/open-webui/open-webui/blob/3355577bac260d5f4ffb0d84a78bacd7be236c20/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!