mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
feat(agent): enhance validation for agent creation by checking required and invalid fields
This commit is contained in:
@@ -1264,11 +1264,16 @@ class CreateAgent(Resource):
|
||||
"prompt_id",
|
||||
"agent_type",
|
||||
]
|
||||
validate_fields = ["name", "description", "prompt_id", "agent_type"]
|
||||
else:
|
||||
required_fields = ["name"]
|
||||
missing_fields = validate_required_fields(data, required_fields)
|
||||
validate_fields = []
|
||||
missing_fields = check_required_fields(data, required_fields)
|
||||
invalid_fields = validate_required_fields(data, validate_fields)
|
||||
if missing_fields:
|
||||
return missing_fields
|
||||
if invalid_fields:
|
||||
return invalid_fields
|
||||
|
||||
image_url, error = handle_image_upload(request, "", user, storage)
|
||||
if error:
|
||||
|
||||
Reference in New Issue
Block a user