I have read and followed all the instructions provided in the README.md.
I am on the latest version of both Open WebUI and Ollama.
I have included the browser console logs. (N/A)
I have included the Docker container logs. (N/A)
I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
Expected Behavior:
Chat does not freeze when using "direct" API connection.
Actual Behavior:
Chat freezes on first prompt after login when using "direct" API connection. Refreshing the page gets rid of this issue.
Description
The chat-events socket.io event handler is not assigned on login. See this line.
The mentioned line is not run on login because layout'sonMount method is ran before the user logs in.
When this method is run localStorage.token is still undefined and so this condition is not satisfied, so $socket?.on('chat-events', chatEventHandler) is never executed.
When the user refreshes the page while being logged in, localStorage.token is truthy so the condition is satisfied, $socket?.on('chat-events', chatEventHandler) is executed and the chat no longer hangs.
Reproduction Details
Steps to Reproduce:
Run Open WebUI.
Add a "direct" API connection for your user (Settings -> Connections).
Log out.
Log back in.
Start a chat with any prompt.
The chat hangs.
Logs and Screenshots
Originally created by @krystiancha on GitHub (Feb 27, 2025).
# Bug Report
## Installation Method
Git clone from main, docker build, docker run.
## Environment
- **Open WebUI Version:** main
- **Ollama (if applicable):** N/A
- **Operating System:** Linux
- **Browser (if applicable):** Firefox 135.0, Chromium 132.0.6834.83
**Confirmation:**
- [x] I have read and followed all the instructions provided in the README.md.
- [x] I am on the latest version of both Open WebUI and Ollama.
- [ ] I have included the browser console logs. (N/A)
- [ ] I have included the Docker container logs. (N/A)
- [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
## Expected Behavior:
Chat does not freeze when using "direct" API connection.
## Actual Behavior:
Chat freezes on first prompt after login when using "direct" API connection. Refreshing the page gets rid of this issue.
## Description
The `chat-events` socket.io event handler is not assigned on login. See [this](https://github.com/open-webui/open-webui/blob/e4d6fc65ca554aae93d1ba73d5b72be9c71dd8a6/src/routes/%2Blayout.svelte#L497) line.
The mentioned line is not run on login because `layout's` `onMount` method is ran before the user logs in.
When this method is run `localStorage.token` is still undefined and so [this](https://github.com/open-webui/open-webui/blob/e4d6fc65ca554aae93d1ba73d5b72be9c71dd8a6/src/routes/%2Blayout.svelte#L486) condition is not satisfied, so `$socket?.on('chat-events', chatEventHandler)` is never executed.
When the user refreshes the page while being logged in, `localStorage.token` is truthy so the condition is satisfied, `$socket?.on('chat-events', chatEventHandler)` is executed and the chat no longer hangs.
## Reproduction Details
**Steps to Reproduce:**
1. Run Open WebUI.
2. Add a "direct" API connection for your user (Settings -> Connections).
3. Log out.
7. Log back in.
8. Start a chat with any prompt.
9. The chat hangs.
## Logs and Screenshots

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 @krystiancha on GitHub (Feb 27, 2025).
Bug Report
Installation Method
Git clone from main, docker build, docker run.
Environment
Open WebUI Version: main
Ollama (if applicable): N/A
Operating System: Linux
Browser (if applicable): Firefox 135.0, Chromium 132.0.6834.83
Confirmation:
Expected Behavior:
Chat does not freeze when using "direct" API connection.
Actual Behavior:
Chat freezes on first prompt after login when using "direct" API connection. Refreshing the page gets rid of this issue.
Description
The
chat-eventssocket.io event handler is not assigned on login. See this line.The mentioned line is not run on login because
layout'sonMountmethod is ran before the user logs in.When this method is run
localStorage.tokenis still undefined and so this condition is not satisfied, so$socket?.on('chat-events', chatEventHandler)is never executed.When the user refreshes the page while being logged in,
localStorage.tokenis truthy so the condition is satisfied,$socket?.on('chat-events', chatEventHandler)is executed and the chat no longer hangs.Reproduction Details
Steps to Reproduce:
Logs and Screenshots
@tjbck commented on GitHub (Mar 4, 2025):
Status: Open.
#10997