trypost/database/factories/AiUsageLogFactory.php
Paulo Castellano b2bf5c2059 feat: complete AI assistant with custom services and brand config
Baseline snapshot of custom AI implementation before Laravel AI SDK migration.

Includes:
- Custom services: GeminiTextGenerationService, TextGenerationService (OpenAI), ImageGenerationService, AudioGenerationService, VideoGenerationService
- IntentDetector for content moderation via keyword matching
- AI enums: Intent, Orientation, UsageType
- Blade prompt templates: system.blade.php, image.blade.php, video.blade.php
- AiMessage with content_html accessor (markdown rendering)
- AiUsageLog for monthly quota tracking per account
- PostAssistantController with regex-based [GENERATE_*] parsing
- WritingAssistantTab with markdown rendering, add-to-post, attachments
- Workspace brand fields (name, description, tone, voice_notes) in system prompt
- Session state block injected into prompts (thread counts, quota remaining)
- AttachmentCollector pattern will replace the regex approach in Phase 2
- Post comments with replies, emoji reactions, real-time via Echo
- Assets page with Unsplash + Giphy integrations
2026-04-16 09:25:08 -03:00

49 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\Ai\UsageType;
use App\Models\Account;
use App\Models\AiUsageLog;
use App\Models\Workspace;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<AiUsageLog> */
class AiUsageLogFactory extends Factory
{
public function definition(): array
{
return [
'account_id' => Account::factory(),
'workspace_id' => Workspace::factory(),
'type' => fake()->randomElement(UsageType::cases()),
'provider' => fake()->randomElement(['gemini', 'veo', 'elevenlabs']),
];
}
public function image(): static
{
return $this->state(fn () => [
'type' => UsageType::Image,
'provider' => 'gemini',
]);
}
public function video(): static
{
return $this->state(fn () => [
'type' => UsageType::Video,
'provider' => 'veo',
]);
}
public function audio(): static
{
return $this->state(fn () => [
'type' => UsageType::Audio,
'provider' => 'elevenlabs',
]);
}
}