Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

refactor(ai-create): clarify prompt-rule naming and label the counter

Paulo Castellanoe7f93f4aef80
diff --git a/app/Http/Requests/App/Ai/StartPostCreationRequest.php b/app/Http/Requests/App/Ai/StartPostCreationRequest.php
index 34ffb1bcd..2b72365e1 100644
--- a/app/Http/Requests/App/Ai/StartPostCreationRequest.php
+++ b/app/Http/Requests/App/Ai/StartPostCreationRequest.php
@@ -34,7 +34,7 @@ class StartPostCreationRequest extends FormRequest
],
'social_account_id' => ['nullable', 'uuid'],
'image_count' => ['nullable', 'integer', 'min:0', 'max:10'],
- 'prompt' => AiPromptRules::promptRule(),
+ 'prompt' => AiPromptRules::wizardPromptRule(),
'date' => ['nullable', 'date_format:Y-m-d'],
'template' => ['sometimes', 'string', Rule::enum(ContentStyle::class)],
];
diff --git a/app/Support/AiPromptRules.php b/app/Support/AiPromptRules.php
index 9803cb902..c8b8ba6d6 100644
--- a/app/Support/AiPromptRules.php
+++ b/app/Support/AiPromptRules.php
@@ -23,11 +23,13 @@ class AiPromptRules
public const PROMPT_MAX_LENGTH = 2000;
/**
- * Validation rules for the create wizard's generation prompt.
+ * Validation rules for the create wizard's generation prompt. The editor's
+ * content generation reuses only PROMPT_MAX_LENGTH — it has no minimum,
+ * since it has no character counter to mirror one.
*
* @return array<int, string>
*/
- public static function promptRule(): array
+ public static function wizardPromptRule(): array
{
return ['required', 'string', 'min:'.self::PROMPT_MIN_LENGTH, 'max:'.self::PROMPT_MAX_LENGTH];
}
diff --git a/resources/js/components/posts/create/AiPostWizard.vue b/resources/js/components/posts/create/AiPostWizard.vue
index 4e304921a..49b277d58 100644
--- a/resources/js/components/posts/create/AiPostWizard.vue
+++ b/resources/js/components/posts/create/AiPostWizard.vue
@@ -364,6 +364,8 @@ const startGeneration = async () => {
class="min-h-[140px] resize-none"
/>
<p
+ data-testid="ai-prompt-counter"
+ aria-live="polite"
class="text-right text-xs tabular-nums"
:class="promptLength > PROMPT_MAX ? 'font-semibold text-destructive' : 'text-muted-foreground'"
>