Fix the bug where, when file upload is enabled, messages cannot be sent in the chat window after transitioning from the old workflow features structure to the new one.

This commit is contained in:
Likename Haojie 2024-10-26 01:08:28 +08:00 committed by GitHub
parent a17f169e01
commit 8942f528bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,19 +158,7 @@ class Workflow(db.Model):
return self._features return self._features
features = json.loads(self._features) features = json.loads(self._features)
if features.get("file_upload", {}).get("image", {}).get("enabled", False): self._features = json.dumps(features)
image_enabled = True
image_number_limits = int(features["file_upload"]["image"].get("number_limits", 1))
image_transfer_methods = features["file_upload"]["image"].get(
"transfer_methods", ["remote_url", "local_file"]
)
features["file_upload"]["enabled"] = image_enabled
features["file_upload"]["number_limits"] = image_number_limits
features["file_upload"]["allowed_upload_methods"] = image_transfer_methods
features["file_upload"]["allowed_file_types"] = ["image"]
features["file_upload"]["allowed_extensions"] = []
del features["file_upload"]["image"]
self._features = json.dumps(features)
return self._features return self._features
@features.setter @features.setter