Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
defc3365
Commit
defc3365
authored
Jun 21, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: uuid json dumps bug by set sqlalchemy version
parent
b3186283
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
13 deletions
+1
-13
app.py
api/app.py
+0
-10
keyword_table_index.py
api/core/index/keyword_table_index/keyword_table_index.py
+0
-3
requirements.txt
api/requirements.txt
+1
-0
No files found.
api/app.py
View file @
defc3365
# -*- coding:utf-8 -*-
import
os
import
uuid
from
datetime
import
datetime
if
not
os
.
environ
.
get
(
"DEBUG"
)
or
os
.
environ
.
get
(
"DEBUG"
)
.
lower
()
!=
'true'
:
...
...
@@ -184,15 +183,6 @@ if app.config['TESTING']:
print
(
"App is running in TESTING mode"
)
def
uuid_encoder
(
self
,
obj
):
if
isinstance
(
obj
,
uuid
.
UUID
):
return
str
(
obj
)
raise
TypeError
(
f
"Object of type '{type(obj)}' is not JSON serializable"
)
json
.
JSONEncoder
.
default
=
uuid_encoder
@
app
.
after_request
def
after_request
(
response
):
"""Add Version headers to the response."""
...
...
api/core/index/keyword_table_index/keyword_table_index.py
View file @
defc3365
import
json
import
uuid
from
collections
import
defaultdict
from
typing
import
Any
,
List
,
Optional
,
Dict
...
...
@@ -236,6 +235,4 @@ class SetEncoder(json.JSONEncoder):
def
default
(
self
,
obj
):
if
isinstance
(
obj
,
set
):
return
list
(
obj
)
elif
isinstance
(
obj
,
uuid
.
UUID
):
return
str
(
obj
)
return
super
()
.
default
(
obj
)
api/requirements.txt
View file @
defc3365
...
...
@@ -2,6 +2,7 @@ coverage~=7.2.4
beautifulsoup4==4.12.2
flask~=2.3.2
Flask-SQLAlchemy~=3.0.3
SQLAlchemy~=1.4.28
flask-login==0.6.2
flask-migrate~=4.0.4
flask-restful==0.3.9
...
...
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