fix(ai-templates): skip humanizer for tweet_card style regardless of carousel mode

The humanize() guard was keyed on format string 'tweet_card', but for tweet_card
carousel the format becomes 'carousel'. Changed the guard to key on the style key
($this->template === 'tweet_card') so humanization is skipped for all tweet_card
variants — single and carousel alike.
This commit is contained in:
Paulo Castellano 2026-06-17 19:01:10 -03:00
parent 58ac2714d0
commit 8317b83d6b

View file

@ -89,7 +89,7 @@ public function handle(): void
$structured = $response->structured ?? [];
$humanizeFormat = $isCarousel ? 'carousel' : $agentFormat;
$structured = $this->humanize($workspace, $structured, $humanizeFormat);
$structured = $this->humanize($workspace, $structured, $humanizeFormat, $this->template);
$generated = $style->assemble($structured, $context);
$post = $this->createPostFromGenerated($workspace, $generated, $socialAccount);
@ -116,9 +116,9 @@ public function handle(): void
* @param array<string, mixed> $structured
* @return array<string, mixed>
*/
private function humanize(Workspace $workspace, array $structured, string $format): array
private function humanize(Workspace $workspace, array $structured, string $format, string $styleKey = 'image_card'): array
{
if ($format === 'tweet_card') {
if ($styleKey === 'tweet_card') {
return $structured;
}