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
a0d932b9
Commit
a0d932b9
authored
Apr 02, 2024
by
Timothy J. Baek
Browse files
fix: cascade shared chat delete
parent
10cad605
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
backend/apps/web/models/chats.py
backend/apps/web/models/chats.py
+6
-1
No files found.
backend/apps/web/models/chats.py
View file @
a0d932b9
...
@@ -230,10 +230,13 @@ class ChatTable:
...
@@ -230,10 +230,13 @@ class ChatTable:
def
delete_chats_by_user_id
(
self
,
user_id
:
str
)
->
bool
:
def
delete_chats_by_user_id
(
self
,
user_id
:
str
)
->
bool
:
try
:
try
:
self
.
delete_shared_chats_by_user_id
(
user_id
)
query
=
Chat
.
delete
().
where
(
Chat
.
user_id
==
user_id
)
query
=
Chat
.
delete
().
where
(
Chat
.
user_id
==
user_id
)
query
.
execute
()
# Remove the rows, return number of rows removed.
query
.
execute
()
# Remove the rows, return number of rows removed.
return
True
and
self
.
delete_shared_chats_by_user_id
(
user_id
)
return
True
except
:
except
:
return
False
return
False
...
@@ -244,6 +247,8 @@ class ChatTable:
...
@@ -244,6 +247,8 @@ class ChatTable:
for
chat
in
Chat
.
select
().
where
(
Chat
.
user_id
==
user_id
)
for
chat
in
Chat
.
select
().
where
(
Chat
.
user_id
==
user_id
)
]
]
print
(
shared_chat_ids
)
query
=
Chat
.
delete
().
where
(
Chat
.
user_id
<<
shared_chat_ids
)
query
=
Chat
.
delete
().
where
(
Chat
.
user_id
<<
shared_chat_ids
)
query
.
execute
()
# Remove the rows, return number of rows removed.
query
.
execute
()
# Remove the rows, return number of rows removed.
...
...
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