mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
fix: user channels issue
This commit is contained in:
parent
6fe737bf8f
commit
5c2df97f04
2 changed files with 38 additions and 19 deletions
|
|
@ -182,12 +182,18 @@
|
|||
|
||||
const initChannels = async () => {
|
||||
// default (none), group, dm type
|
||||
await channels.set(
|
||||
(await getChannels(localStorage.token)).sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
const res = await getChannels(localStorage.token).catch((error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await channels.set(
|
||||
res.sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const initChatList = async () => {
|
||||
|
|
|
|||
|
|
@ -487,12 +487,19 @@
|
|||
|
||||
// handle channel created event
|
||||
if (event.data?.type === 'channel:created') {
|
||||
await channels.set(
|
||||
(await getChannels(localStorage.token)).sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
const res = await getChannels(localStorage.token).catch(async (error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await channels.set(
|
||||
res.sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -531,13 +538,19 @@
|
|||
})
|
||||
);
|
||||
} else {
|
||||
await channels.set(
|
||||
(await getChannels(localStorage.token)).sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) -
|
||||
['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
const res = await getChannels(localStorage.token).catch(async (error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await channels.set(
|
||||
res.sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) -
|
||||
['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue