Files
muninn/app/Providers/AppServiceProvider.php
m105andClaude Sonnet 5 6a51fda61e Add thumbnail, metadata, and YouTube publishing handlers (#40, #41, #42)
ThumbnailGenerationHandler (#40): generates thumbnail candidates via
StabilityAI, one per style (default: two contrasting styles) — all
stored as assets on the same step, so the existing approval UI's
"show every asset on this step side by side" behavior is the A/B
comparison the task calls for, no extra UI needed.

MetadataGenerationHandler (#41): SEO title/description/tags/hashtags
from the project's script via OpenAI in JSON mode, same pattern as
StoryboardHandler.

YoutubePublishHandler (#42): real OAuth2 + YouTube Data API v3
resumable upload (token refresh -> init session -> PUT video bytes),
supporting scheduling via publishAt (forces privacyStatus=private per
YouTube's own constraint). Reuses the AiProvider table for credentials
(provider='youtube', api_key=refresh_token, config=client_id/secret)
rather than a new table — added 'youtube' to AiProvider::PROVIDERS.
Does not cover analytics retrieval: that's an ongoing query against a
published video, not a one-shot publish action, so it doesn't fit the
per-video step model at all.

All 8 WorkflowStep::TYPES now have real handlers, so the "unhandled
type" test fixtures (which used real-but-not-yet-implemented types)
would go stale every time a new module lands — switched them to
fabricated type strings so they stay meaningful regardless of what
gets built next.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-06 21:26:56 +03:00

65 lines
2.4 KiB
PHP

<?php
namespace App\Providers;
use App\Support\AiProviders\AiProviderManager;
use App\Support\AiProviders\ElevenLabsDriver;
use App\Support\AiProviders\OpenAiDriver;
use App\Support\AiProviders\StabilityAiDriver;
use App\Support\Publishing\LinkedInPublisher;
use App\Support\Publishing\PublisherManager;
use App\Support\Publishing\RedditPublisher;
use App\Support\Publishing\TwitterPublisher;
use App\Support\Publishing\WordPressPublisher;
use App\Support\VideoWorkflow\StepHandlers\MetadataGenerationHandler;
use App\Support\VideoWorkflow\StepHandlers\ScriptGenerationHandler;
use App\Support\VideoWorkflow\StepHandlers\StepHandlerManager;
use App\Support\VideoWorkflow\StepHandlers\StoryboardHandler;
use App\Support\VideoWorkflow\StepHandlers\ThumbnailGenerationHandler;
use App\Support\VideoWorkflow\StepHandlers\TtsVoiceoverHandler;
use App\Support\VideoWorkflow\StepHandlers\VideoEditingHandler;
use App\Support\VideoWorkflow\StepHandlers\VideoGenerationHandler;
use App\Support\VideoWorkflow\StepHandlers\YoutubePublishHandler;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
$this->app->singleton(PublisherManager::class, fn ($app) => new PublisherManager([
$app->make(WordPressPublisher::class),
$app->make(RedditPublisher::class),
$app->make(TwitterPublisher::class),
$app->make(LinkedInPublisher::class),
]));
$this->app->singleton(AiProviderManager::class, fn ($app) => new AiProviderManager([
'openai' => $app->make(OpenAiDriver::class),
'stability_ai' => $app->make(StabilityAiDriver::class),
'elevenlabs' => $app->make(ElevenLabsDriver::class),
]));
$this->app->singleton(StepHandlerManager::class, fn ($app) => new StepHandlerManager([
$app->make(ScriptGenerationHandler::class),
$app->make(TtsVoiceoverHandler::class),
$app->make(StoryboardHandler::class),
$app->make(VideoGenerationHandler::class),
$app->make(VideoEditingHandler::class),
$app->make(ThumbnailGenerationHandler::class),
$app->make(MetadataGenerationHandler::class),
$app->make(YoutubePublishHandler::class),
]));
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}