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
8fe2a7bb
Commit
8fe2a7bb
authored
Jul 03, 2024
by
Timothy J. Baek
Browse files
fix
parent
37a5d2c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
backend/apps/webui/internal/db.py
backend/apps/webui/internal/db.py
+7
-1
backend/apps/webui/models/tools.py
backend/apps/webui/models/tools.py
+2
-1
No files found.
backend/apps/webui/internal/db.py
View file @
8fe2a7bb
...
@@ -62,10 +62,16 @@ Base = declarative_base()
...
@@ -62,10 +62,16 @@ Base = declarative_base()
Session
=
scoped_session
(
SessionLocal
)
Session
=
scoped_session
(
SessionLocal
)
from
contextlib
import
contextmanager
# Dependency
# Dependency
def
get_
db
():
def
get_
session
():
db
=
SessionLocal
()
db
=
SessionLocal
()
try
:
try
:
yield
db
yield
db
finally
:
finally
:
db
.
close
()
db
.
close
()
get_db
=
contextmanager
(
get_session
)
backend/apps/webui/models/tools.py
View file @
8fe2a7bb
...
@@ -119,6 +119,7 @@ class ToolsTable:
...
@@ -119,6 +119,7 @@ class ToolsTable:
return
None
return
None
def
get_tools
(
self
)
->
List
[
ToolModel
]:
def
get_tools
(
self
)
->
List
[
ToolModel
]:
with
get_db
()
as
db
:
return
[
ToolModel
.
model_validate
(
tool
)
for
tool
in
db
.
query
(
Tool
).
all
()]
return
[
ToolModel
.
model_validate
(
tool
)
for
tool
in
db
.
query
(
Tool
).
all
()]
def
get_tool_valves_by_id
(
self
,
id
:
str
)
->
Optional
[
dict
]:
def
get_tool_valves_by_id
(
self
,
id
:
str
)
->
Optional
[
dict
]:
...
...
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