ValidateWorkflowIntent checks if the provided workflow intent is valid. It ensures the intent has meaningful content with at least 20 characters and is not just whitespace.
(s string)
| 33 | // It ensures the intent has meaningful content with at least 20 characters |
| 34 | // and is not just whitespace. |
| 35 | func ValidateWorkflowIntent(s string) error { |
| 36 | validatorsLog.Printf("Validating workflow intent: length=%d", len(s)) |
| 37 | trimmed := strings.TrimSpace(s) |
| 38 | if trimmed == "" { |
| 39 | validatorsLog.Print("Workflow intent validation failed: empty content") |
| 40 | return errors.New("workflow instructions cannot be empty") |
| 41 | } |
| 42 | if len(trimmed) < 20 { |
| 43 | validatorsLog.Printf("Workflow intent validation failed: too short (%d chars)", len(trimmed)) |
| 44 | return errors.New("please provide at least 20 characters of instructions") |
| 45 | } |
| 46 | validatorsLog.Printf("Workflow intent validated successfully: %d chars", len(trimmed)) |
| 47 | return nil |
| 48 | } |