fix(api): allow AGENT mode in workflow features validation

Add AppMode.AGENT to validate_features_structure() match case
alongside ADVANCED_CHAT, fixing 'Invalid app mode: agent' error
when creating Agent apps (which auto-generate a workflow draft).

Discovered during E2E testing of the full create -> draft -> publish flow.

Made-with: Cursor
This commit is contained in:
Yansong Zhang 2026-04-08 13:19:59 +08:00
parent 8f3a3ea03e
commit 1835a1dc5d

View File

@ -1418,7 +1418,7 @@ class WorkflowService:
def validate_features_structure(self, app_model: App, features: dict):
match app_model.mode:
case AppMode.ADVANCED_CHAT:
case AppMode.ADVANCED_CHAT | AppMode.AGENT:
return AdvancedChatAppConfigManager.config_validate(
tenant_id=app_model.tenant_id, config=features, only_structure_validate=True
)