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
aa880226
Commit
aa880226
authored
Jul 02, 2024
by
Timothy J. Baek
Browse files
fix: functions
parent
44a9b86e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
backend/apps/webui/models/functions.py
backend/apps/webui/models/functions.py
+8
-7
No files found.
backend/apps/webui/models/functions.py
View file @
aa880226
...
...
@@ -107,7 +107,7 @@ class FunctionsTable:
Session
.
commit
()
Session
.
refresh
(
result
)
if
result
:
return
FunctionModel
(
**
result
.
model_dump
()
)
return
FunctionModel
(
**
result
.
__dict__
)
else
:
return
None
except
Exception
as
e
:
...
...
@@ -117,19 +117,20 @@ class FunctionsTable:
def
get_function_by_id
(
self
,
id
:
str
)
->
Optional
[
FunctionModel
]:
try
:
function
=
Session
.
get
(
Function
,
id
)
return
FunctionModel
(
**
function
)
return
FunctionModel
(
**
function
.
__dict__
)
except
:
return
None
def
get_functions
(
self
,
active_only
=
False
)
->
List
[
FunctionModel
]:
if
active_only
:
return
[
FunctionModel
(
**
function
)
FunctionModel
(
**
function
.
__dict__
)
for
function
in
Session
.
query
(
Function
).
filter_by
(
is_active
=
True
).
all
()
]
else
:
return
[
FunctionModel
(
**
function
)
for
function
in
Session
.
query
(
Function
).
all
()
FunctionModel
(
**
function
.
__dict__
)
for
function
in
Session
.
query
(
Function
).
all
()
]
def
get_functions_by_type
(
...
...
@@ -137,20 +138,20 @@ class FunctionsTable:
)
->
List
[
FunctionModel
]:
if
active_only
:
return
[
FunctionModel
(
**
function
)
FunctionModel
(
**
function
.
__dict__
)
for
function
in
Session
.
query
(
Function
)
.
filter_by
(
type
=
type
,
is_active
=
True
)
.
all
()
]
else
:
return
[
FunctionModel
(
**
function
)
FunctionModel
(
**
function
.
__dict__
)
for
function
in
Session
.
query
(
Function
).
filter_by
(
type
=
type
).
all
()
]
def
get_global_filter_functions
(
self
)
->
List
[
FunctionModel
]:
return
[
FunctionModel
(
**
function
)
FunctionModel
(
**
function
.
__dict__
)
for
function
in
Session
.
query
(
Function
)
.
filter_by
(
type
=
"filter"
,
is_active
=
True
,
is_global
=
True
)
.
all
()
...
...
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