Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ EXPERIENCE_CHAT_HISTORY_TURNS=4
EXPERIENCE_CHAT_CONTACT_FORM_MAX_TOKENS=1000
EXPERIENCE_CHAT_SMART_FILTER_MAX_TOKENS=200
EXPERIENCE_CHAT_SMART_FILTER_DESCRIPTION_LENGTH=600

# Weekly AI blog draft (app:generate-blog-post, runs Monday 08:00)
BLOG_GENERATION_RESEARCH_MODEL=gpt-4o-search-preview
BLOG_GENERATION_WRITING_MODEL=gpt-4o
BLOG_GENERATION_IMAGE_MODEL=dall-e-3
BLOG_GENERATION_RESEARCH_MAX_TOKENS=3500
BLOG_GENERATION_WRITING_MAX_TOKENS=4000
BLOG_GENERATION_WRITING_TEMPERATURE=0.65
BLOG_GENERATION_WRITING_TOP_P=0.9
BLOG_GENERATION_LANGUAGE=Dutch
BLOG_GENERATION_LOCALE=nl
40 changes: 40 additions & 0 deletions app/Console/Commands/GenerateBlogPost.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Console\Commands;

use App\Services\BlogGenerationService;
use Illuminate\Console\Command;
use Throwable;

class GenerateBlogPost extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:generate-blog-post';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Generate a draft blog post via OpenAI and save it as visible=false for review';

public function handle(BlogGenerationService $service): int
{
try {
$blog = $service->generate();
} catch (Throwable $e) {
$this->error('Blog generation failed: ' . $e->getMessage());

return self::FAILURE;
}

$this->info("Draft blog post created: \"{$blog->title}\" (id: {$blog->id}, slug: {$blog->slug}).");
$this->info('Review and publish it from the Filament admin.');

return self::SUCCESS;
}
}
Loading