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
8f939cf5
"git@developer.sourcefind.cn:modelzoo/resnet50_tensorflow.git" did not exist on "a179b7fee100cc954170100b6e7d4e9080551833"
Commit
8f939cf5
authored
Jun 24, 2024
by
Jonathan Rohde
Browse files
feat(sqlalchemy): some fixes
parent
a9b14879
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
backend/apps/webui/models/users.py
backend/apps/webui/models/users.py
+1
-0
backend/main.py
backend/main.py
+2
-3
backend/utils/utils.py
backend/utils/utils.py
+3
-3
No files found.
backend/apps/webui/models/users.py
View file @
8f939cf5
...
@@ -185,6 +185,7 @@ class UsersTable:
...
@@ -185,6 +185,7 @@ class UsersTable:
Session
.
query
(
User
).
filter_by
(
id
=
id
).
update
(
Session
.
query
(
User
).
filter_by
(
id
=
id
).
update
(
{
"last_active_at"
:
int
(
time
.
time
())}
{
"last_active_at"
:
int
(
time
.
time
())}
)
)
Session
.
commit
()
user
=
Session
.
query
(
User
).
filter_by
(
id
=
id
).
first
()
user
=
Session
.
query
(
User
).
filter_by
(
id
=
id
).
first
()
return
UserModel
.
model_validate
(
user
)
return
UserModel
.
model_validate
(
user
)
...
...
backend/main.py
View file @
8f939cf5
...
@@ -794,11 +794,10 @@ app.add_middleware(
...
@@ -794,11 +794,10 @@ app.add_middleware(
)
)
@
app
.
middleware
(
"http"
)
@
app
.
middleware
(
"http"
)
async
def
remove
_session_after_request
(
request
:
Request
,
call_next
):
async
def
commit
_session_after_request
(
request
:
Request
,
call_next
):
response
=
await
call_next
(
request
)
response
=
await
call_next
(
request
)
log
.
debug
(
"
Removing
session after request"
)
log
.
debug
(
"
Commit
session after request"
)
Session
.
commit
()
Session
.
commit
()
Session
.
remove
()
return
response
return
response
...
...
backend/utils/utils.py
View file @
8f939cf5
...
@@ -113,8 +113,8 @@ def get_current_user(
...
@@ -113,8 +113,8 @@ def get_current_user(
)
)
def
get_current_user_by_api_key
(
db
:
Session
,
api_key
:
str
):
def
get_current_user_by_api_key
(
api_key
:
str
):
user
=
Users
.
get_user_by_api_key
(
db
,
api_key
)
user
=
Users
.
get_user_by_api_key
(
api_key
)
if
user
is
None
:
if
user
is
None
:
raise
HTTPException
(
raise
HTTPException
(
...
@@ -122,7 +122,7 @@ def get_current_user_by_api_key(db: Session, api_key: str):
...
@@ -122,7 +122,7 @@ def get_current_user_by_api_key(db: Session, api_key: str):
detail
=
ERROR_MESSAGES
.
INVALID_TOKEN
,
detail
=
ERROR_MESSAGES
.
INVALID_TOKEN
,
)
)
else
:
else
:
Users
.
update_user_last_active_by_id
(
db
,
user
.
id
)
Users
.
update_user_last_active_by_id
(
user
.
id
)
return
user
return
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