Replace free-text brand_tone/brand_voice_notes with a single structured brand_voice_traits JSON column backed by the BrandVoiceTrait enum, exposed as choice-chip pills in the brand settings UI and autofillable from a site. Brand voice and visuals become per-automation toggles on the Generate node. Unify the image controls into one 0-10 picker (0 = text-only, 1 = single, 2+ = carousel) and feed the generator the most restrictive selected network so copy fits every platform. Pass that same platform context through the humanizer pass — extracted into a shared ResolvesPlatformCopyBudget trait — so the rewrite can no longer drift past the character cap the generator respected, in both the automation and manual creation flows. Persist the trigger node's schedule editor fields on save (they were silently dropped by validated() for lacking validation rules).
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Ai\Agents\PostContentHumanizer;
|
|
use App\Enums\PostPlatform\ContentType;
|
|
use App\Models\Workspace;
|
|
|
|
test('instructions inject the platform character cap so the rewrite cannot drift over it', function () {
|
|
$workspace = Workspace::factory()->make(['content_language' => 'en']);
|
|
|
|
$agent = new PostContentHumanizer(
|
|
workspace: $workspace,
|
|
platformContext: ContentType::XPost->value,
|
|
);
|
|
|
|
$instructions = $agent->instructions();
|
|
|
|
// X caps at 280 chars — the humanizer must be told, mirroring the generator.
|
|
expect($instructions)->toContain('280');
|
|
expect($instructions)->toContain('Hard cap');
|
|
});
|
|
|
|
test('instructions omit the length section when no platform context is given', function () {
|
|
$workspace = Workspace::factory()->make(['content_language' => 'en']);
|
|
|
|
$agent = new PostContentHumanizer(workspace: $workspace);
|
|
|
|
expect($agent->instructions())->not->toContain('Hard cap');
|
|
});
|
|
|
|
test('instructions still render the AI-tell removal rules', function () {
|
|
$workspace = Workspace::factory()->make(['content_language' => 'en']);
|
|
|
|
$agent = new PostContentHumanizer(workspace: $workspace);
|
|
|
|
expect($agent->instructions())->toContain('AI-tells');
|
|
});
|