diff --git a/src/lib/components/admin/Settings/Users.svelte b/src/lib/components/admin/Settings/Users.svelte index b23705c8a..e806ea757 100644 --- a/src/lib/components/admin/Settings/Users.svelte +++ b/src/lib/components/admin/Settings/Users.svelte @@ -24,9 +24,17 @@ } }; + let chatDeletion = true; + let chatEdit = true; + let chatTemporary = true; + onMount(async () => { permissions = await getUserPermissions(localStorage.token); + chatDeletion = permissions?.chat?.deletion ?? true; + chatEdit = permissions?.chat?.editing ?? true; + chatTemporary = permissions?.chat?.temporary ?? true; + const res = await getModelFilterConfig(localStorage.token); if (res) { whitelistEnabled = res.enabled; @@ -43,7 +51,13 @@ // console.log('submit'); await setDefaultModels(localStorage.token, defaultModelId); - await updateUserPermissions(localStorage.token, permissions); + await updateUserPermissions(localStorage.token, { + chat: { + deletion: chatDeletion, + editing: chatEdit, + temporary: chatTemporary + } + }); await updateModelFilterConfig(localStorage.token, whitelistEnabled, whitelistModels); saveHandler(); @@ -54,127 +68,22 @@