2024-03-05 14:45:22 +08:00
|
|
|
from flask import Flask
|
|
|
|
|
2024-10-22 11:01:32 +08:00
|
|
|
from configs import dify_config
|
|
|
|
|
2024-03-05 14:45:22 +08:00
|
|
|
|
|
|
|
def init_app(app: Flask):
|
2024-10-22 11:01:32 +08:00
|
|
|
if dify_config.API_COMPRESSION_ENABLED:
|
2024-03-05 14:45:22 +08:00
|
|
|
from flask_compress import Compress
|
|
|
|
|
2024-08-15 12:54:05 +08:00
|
|
|
app.config["COMPRESS_MIMETYPES"] = [
|
|
|
|
"application/json",
|
|
|
|
"image/svg+xml",
|
|
|
|
"text/html",
|
2024-03-26 10:11:43 +08:00
|
|
|
]
|
|
|
|
|
2024-03-05 14:45:22 +08:00
|
|
|
compress = Compress()
|
|
|
|
compress.init_app(app)
|