27 lines
787 B
PHP
27 lines
787 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Ai\Agents\ContentWriterAgent;
|
|
use App\Ai\Agents\CreativeDirectorAgent;
|
|
use App\Data\SocialMediaPostResponseDto;
|
|
|
|
class SocialMediaService
|
|
{
|
|
public function __construct(
|
|
private readonly ContentWriterAgent $contentWriterAgent,
|
|
private readonly CreativeDirectorAgent $creativeDirectorAgent,
|
|
) {}
|
|
|
|
public function generatePostWithImage(string $prompt): SocialMediaPostResponseDto
|
|
{
|
|
$socialMediaResponse = $this->contentWriterAgent->prompt($prompt);
|
|
$postText = $socialMediaResponse->text;
|
|
|
|
$imagePromptResponse = $this->creativeDirectorAgent->prompt($postText);
|
|
$imagePrompt = $imagePromptResponse->text;
|
|
|
|
return new SocialMediaPostResponseDto($postText, $imagePrompt);
|
|
}
|
|
}
|