-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
dbd2b09
commit faf5f50
Showing
3 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
from configs import dify_config | ||
from dify_app import DifyApp | ||
|
||
def is_enabled() -> bool: | ||
return dify_config.API_COMPRESSION_ENABLED | ||
|
||
def init_app(app: DifyApp): | ||
if dify_config.API_COMPRESSION_ENABLED: | ||
from flask_compress import Compress | ||
from flask_compress import Compress | ||
|
||
app.config["COMPRESS_MIMETYPES"] = [ | ||
"application/json", | ||
"image/svg+xml", | ||
"text/html", | ||
] | ||
app.config["COMPRESS_MIMETYPES"] = [ | ||
"application/json", | ||
"image/svg+xml", | ||
"text/html", | ||
] | ||
|
||
compress = Compress() | ||
compress.init_app(app) | ||
compress = Compress() | ||
compress.init_app(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters