Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
70a8f6e7
Unverified
Commit
70a8f6e7
authored
Aug 07, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Aug 07, 2024
Browse files
Merge pull request #4431 from Nowheresly/fix4158_reconnect
feat: #4158 allow reconnection when websocket is closed
parents
ad9a7cb1
2fb4d335
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
src/lib/apis/index.ts
src/lib/apis/index.ts
+1
-0
src/routes/+layout.svelte
src/routes/+layout.svelte
+19
-0
No files found.
src/lib/apis/index.ts
View file @
70a8f6e7
...
...
@@ -69,6 +69,7 @@ type ChatCompletedForm = {
model
:
string
;
messages
:
string
[];
chat_id
:
string
;
session_id
:
string
;
};
export
const
chatCompleted
=
async
(
token
:
string
,
body
:
ChatCompletedForm
)
=>
{
...
...
src/routes/+layout.svelte
View file @
70a8f6e7
...
...
@@ -111,6 +111,10 @@
if ($config) {
const _socket = io(`${WEBUI_BASE_URL}` || undefined, {
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
randomizationFactor: 0.5
path: '/ws/socket.io',
auth: { token: localStorage.token }
});
...
...
@@ -119,6 +123,21 @@
console.log('connected');
});
_socket.on("reconnect_attempt", (attempt) => {
console.log('reconnect_attempt', attempt);
});
_socket.on("reconnect_failed", () => {
console.log('reconnect_failed');
});
_socket.on("disconnect", (reason, details) => {
console.log(`Socket ${socket.id} disconnected due to ${reason}`);
if (details) {
console.log('Additional details:', details);
}
});
await socket.set(_socket);
_socket.on('user-count', (data) => {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment