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
4d239570
"test/nni_test/vscode:/vscode.git/clone" did not exist on "649eabc0406b0d0bd9abe0987afdb191e1ae57ef"
Commit
4d239570
authored
Jul 02, 2024
by
Timothy J. Baek
Browse files
revert: model_validate
parent
aa880226
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
backend/apps/webui/models/functions.py
backend/apps/webui/models/functions.py
+7
-7
No files found.
backend/apps/webui/models/functions.py
View file @
4d239570
...
...
@@ -107,7 +107,7 @@ class FunctionsTable:
Session
.
commit
()
Session
.
refresh
(
result
)
if
result
:
return
FunctionModel
(
**
result
.
__dict__
)
return
FunctionModel
.
model_validate
(
result
)
else
:
return
None
except
Exception
as
e
:
...
...
@@ -117,19 +117,19 @@ class FunctionsTable:
def
get_function_by_id
(
self
,
id
:
str
)
->
Optional
[
FunctionModel
]:
try
:
function
=
Session
.
get
(
Function
,
id
)
return
FunctionModel
(
**
function
.
__dict__
)
return
FunctionModel
.
model_validate
(
function
)
except
:
return
None
def
get_functions
(
self
,
active_only
=
False
)
->
List
[
FunctionModel
]:
if
active_only
:
return
[
FunctionModel
(
**
function
.
__dict__
)
FunctionModel
.
model_validate
(
function
)
for
function
in
Session
.
query
(
Function
).
filter_by
(
is_active
=
True
).
all
()
]
else
:
return
[
FunctionModel
(
**
function
.
__dict__
)
FunctionModel
.
model_validate
(
function
)
for
function
in
Session
.
query
(
Function
).
all
()
]
...
...
@@ -138,20 +138,20 @@ class FunctionsTable:
)
->
List
[
FunctionModel
]:
if
active_only
:
return
[
FunctionModel
(
**
function
.
__dict__
)
FunctionModel
.
model_validate
(
function
)
for
function
in
Session
.
query
(
Function
)
.
filter_by
(
type
=
type
,
is_active
=
True
)
.
all
()
]
else
:
return
[
FunctionModel
(
**
function
.
__dict__
)
FunctionModel
.
model_validate
(
function
)
for
function
in
Session
.
query
(
Function
).
filter_by
(
type
=
type
).
all
()
]
def
get_global_filter_functions
(
self
)
->
List
[
FunctionModel
]:
return
[
FunctionModel
(
**
function
.
__dict__
)
FunctionModel
.
model_validate
(
function
)
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