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
c1d706dc
Commit
c1d706dc
authored
Jul 07, 2024
by
Timothy J. Baek
Browse files
fix: db issues
parent
a7fb560e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
backend/apps/webui/models/auths.py
backend/apps/webui/models/auths.py
+0
-2
backend/apps/webui/models/chats.py
backend/apps/webui/models/chats.py
+3
-2
backend/apps/webui/models/users.py
backend/apps/webui/models/users.py
+1
-0
No files found.
backend/apps/webui/models/auths.py
View file @
c1d706dc
...
...
@@ -169,7 +169,6 @@ class AuthsTable:
def
update_user_password_by_id
(
self
,
id
:
str
,
new_password
:
str
)
->
bool
:
try
:
with
get_db
()
as
db
:
result
=
(
db
.
query
(
Auth
).
filter_by
(
id
=
id
).
update
({
"password"
:
new_password
})
)
...
...
@@ -181,7 +180,6 @@ class AuthsTable:
def
update_email_by_id
(
self
,
id
:
str
,
email
:
str
)
->
bool
:
try
:
with
get_db
()
as
db
:
result
=
db
.
query
(
Auth
).
filter_by
(
id
=
id
).
update
({
"email"
:
email
})
db
.
commit
()
return
True
if
result
==
1
else
False
...
...
backend/apps/webui/models/chats.py
View file @
c1d706dc
...
...
@@ -141,13 +141,14 @@ class ChatTable:
db
.
add
(
shared_result
)
db
.
commit
()
db
.
refresh
(
shared_result
)
# Update the original chat with the share_id
result
=
(
db
.
query
(
Chat
)
.
filter_by
(
id
=
chat_id
)
.
update
({
"share_id"
:
shared_chat
.
id
})
)
db
.
commit
()
return
shared_chat
if
(
shared_result
and
result
)
else
None
def
update_shared_chat_by_chat_id
(
self
,
chat_id
:
str
)
->
Optional
[
ChatModel
]:
...
...
@@ -206,8 +207,8 @@ class ChatTable:
def
archive_all_chats_by_user_id
(
self
,
user_id
:
str
)
->
bool
:
try
:
with
get_db
()
as
db
:
db
.
query
(
Chat
).
filter_by
(
user_id
=
user_id
).
update
({
"archived"
:
True
})
db
.
commit
()
return
True
except
:
return
False
...
...
backend/apps/webui/models/users.py
View file @
c1d706dc
...
...
@@ -212,6 +212,7 @@ class UsersTable:
try
:
with
get_db
()
as
db
:
db
.
query
(
User
).
filter_by
(
id
=
id
).
update
({
"oauth_sub"
:
oauth_sub
})
db
.
commit
()
user
=
db
.
query
(
User
).
filter_by
(
id
=
id
).
first
()
return
UserModel
.
model_validate
(
user
)
...
...
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