* Fix OpenRouter support by using laravel/ai default provider config. PR #216 patched Lab::OpenRouter into every agent match, but laravel/ai already resolves config('ai.default') — including openrouter — when agents omit provider(). Those matches also forced unknown providers to Gemini and BrandAnalyzerRunner checked a non-existent services.openrouter key. Remove the duplicated provider() overrides, gate availability on ai.providers.*.key, and document OPENROUTER_API_KEY. Co-authored-by: Paulo Castellano <hello@paulocastellano.com> * chore(deps): bump laravel/ai to v0.10.3 for native OpenRouter support v0.5.1's OpenRouter driver only covered text/embeddings via the legacy Prism gateway. v0.10.3 ships a native OpenRouter gateway with image, audio (TTS/STT), and web search support, and drops prism-php/prism as a dependency. ai-sdk-development skill docs refreshed via boost:update to match the installed version. * fix: honor AI_IMAGE_PROVIDER instead of hardcoding OpenAI's gpt-image-2 AiImageClient always passed model: 'gpt-image-2' to Image::of()->generate(), so AI_IMAGE_PROVIDER silently did nothing for any provider other than OpenAI — gemini/xai/openrouter would fail against an OpenAI-only model id and quietly fall back to a stock photo. Usage recording was hardcoded to provider 'openai' too, so credits were billed against the wrong model whenever a different provider actually ran. Drop the hardcoded model so generation falls through to the SDK's own config('ai.default_for_images') + per-provider default model, and read the actual provider/model back off the response's meta for usage recording and source_meta instead of assuming OpenAI. * refactor: extract AiImageClient into single-purpose steps, fix uncaught exception generate() built the prompt, called the SDK, and unpacked the response all in one block, with bytes extraction happening after the try/catch — so a response with an empty images collection threw an uncaught RuntimeException from ImageResponse::firstImage() instead of returning null as documented. Split into cleanKeywords(), buildPrompt(), resolveBrandContext(), and toResult(), and moved response unpacking inside the try block so any malformed response is treated as a failure like everything else. Added a regression test with an empty-images fake response. * fix: drop hardcoded default_text_model, resolve model per provider default_text_model was the only per-modality model override in ai.php — image, audio, transcription, embeddings, and reranking all just pick a provider and let it use its own default model. Text had a config-pinned model on top, forced into every agent's model() and into every usage log's model field regardless of which provider actually ran. Switching AI_TEXT_PROVIDER (e.g. to openrouter) kept sending OpenAI's model id to whichever provider ended up handling the request. Removed model() from all six agents so laravel/ai resolves the model from the active provider's own default (OpenAI's default is already 'gpt-5.4', so no behavior change there). Usage-recording call sites now read the actual provider/model back off the response's meta instead of assuming config('ai.default')/default_text_model. StreamPostContent needed the then() callback since broadcast()'s StreamableAgentResponse doesn't expose meta directly. * refactor: drop AiConfiguration wrapper, use data_get() for array reads AiConfiguration was a one-line static helper used by only two call sites, with no laravel/ai equivalent to lean on (confirmed AiManager and the Provider base class expose no isConfigured()/hasKey() check — the package's model is try-then-catch, not pre-flight checks). Inlined the filled(config(...)) check directly into HandleInertiaRequests and BrandAnalyzerRunner instead of keeping a class around one line of logic. Also swapped direct array-key reads for data_get() per project convention across every file touched by the recent AI provider/model fixes (agents' budget arrays, RunGenerateNode/StreamPostCreation's humanizer merge, RegeneratePostMediaImage's baseContext/copy/rendered access). Write/assignment sites (`$x['key'] = ...`) are left as-is — data_get() only reads. * feat: enhance AI configuration with new providers and options Added strict types declaration and updated Azure OpenAI API version. Introduced new 'bedrock' provider configuration with AWS credentials and role assumptions. Enhanced existing providers with additional options, including image deployment for Azure and OpenAI, and updated URLs for Gemini and Ollama. Added support for an 'openai-compatible' driver to broaden integration capabilities. * fix: remove trailing newline in AI configuration file * feat: add support for OpenRouter and ElevenLabs API keys in configuration Updated the production Docker Compose file and example environment file to include commented-out entries for OPENROUTER_API_KEY and ELEVENLABS_API_KEY. This enhances the configuration options for AI providers, allowing for easier integration of additional services. * feat: allow per-provider model overrides for every AI modality Adds a `models` array to each provider block, wired to env vars, so self-hosted operators can pin a specific text/image/audio/transcription/ embeddings/reranking model instead of relying on the package's built-in default for that provider. Only added for the modalities each provider actually implements (verified against laravel/ai's Provider classes). Azure is left untouched — it resolves models via deployment names (AZURE_OPENAI_DEPLOYMENT etc.), not raw model strings, which was already wired before this change. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
180 lines
4.5 KiB
Text
180 lines
4.5 KiB
Text
APP_NAME="TryPost"
|
|
APP_ENV=local
|
|
APP_KEY=
|
|
APP_DEBUG=true
|
|
APP_URL=http://localhost:8000
|
|
|
|
# Public base URL inbound webhooks (e.g. Telegram) are registered on.
|
|
# Defaults to APP_URL; set a tunnel URL (e.g. ngrok) for local development.
|
|
WEBHOOK_URL=
|
|
|
|
# Self-hosted mode (skips payment requirements)
|
|
SELF_HOSTED=true
|
|
|
|
TELESCOPE_ENABLED=false
|
|
|
|
APP_LOCALE=en
|
|
APP_FALLBACK_LOCALE=en
|
|
APP_FAKER_LOCALE=en_US
|
|
|
|
APP_MAINTENANCE_DRIVER=file
|
|
|
|
BCRYPT_ROUNDS=12
|
|
|
|
LOG_CHANNEL=stack
|
|
LOG_STACK=single
|
|
LOG_DEPRECATIONS_CHANNEL=null
|
|
LOG_LEVEL=debug
|
|
|
|
# Database — service name "pgsql" inside the Compose network.
|
|
DB_CONNECTION=pgsql
|
|
DB_HOST=pgsql
|
|
DB_PORT=5432
|
|
DB_DATABASE=trypost
|
|
DB_USERNAME=postgres
|
|
DB_PASSWORD=password
|
|
|
|
# Session
|
|
SESSION_DRIVER=database
|
|
SESSION_LIFETIME=1440
|
|
SESSION_ENCRYPT=false
|
|
SESSION_PATH=/
|
|
SESSION_DOMAIN=null
|
|
|
|
# Broadcasting, Queue, Cache — all Redis-backed in Docker.
|
|
BROADCAST_CONNECTION=reverb
|
|
QUEUE_CONNECTION=redis
|
|
CACHE_STORE=redis
|
|
|
|
# File Storage — local-disk by default; switch to s3/r2 for production.
|
|
FILESYSTEM_DISK=local
|
|
|
|
# Redis — service name "redis" inside the Compose network.
|
|
REDIS_HOST=redis
|
|
REDIS_PASSWORD=null
|
|
REDIS_PORT=6379
|
|
|
|
# Mail — service name "mailpit" inside the Compose network. UI at :8025.
|
|
MAIL_MAILER=smtp
|
|
MAIL_HOST=mailpit
|
|
MAIL_PORT=1025
|
|
MAIL_USERNAME=null
|
|
MAIL_PASSWORD=null
|
|
MAIL_ENCRYPTION=null
|
|
MAIL_FROM_ADDRESS="hello@example.com"
|
|
MAIL_FROM_NAME="${APP_NAME}"
|
|
|
|
# Reverb (WebSockets) — host=localhost is browser-perspective via host port-forward.
|
|
REVERB_APP_ID=1001
|
|
REVERB_APP_KEY=trypost-reverb-key
|
|
REVERB_APP_SECRET=trypost-reverb-secret
|
|
REVERB_HOST=localhost
|
|
REVERB_PORT=8080
|
|
REVERB_SCHEME=http
|
|
|
|
# AWS S3 (set FILESYSTEM_DISK=s3)
|
|
AWS_ACCESS_KEY_ID=
|
|
AWS_SECRET_ACCESS_KEY=
|
|
AWS_DEFAULT_REGION=us-east-1
|
|
AWS_BUCKET=
|
|
AWS_URL=
|
|
|
|
# Cloudflare R2 (set FILESYSTEM_DISK=r2)
|
|
R2_ACCESS_KEY_ID=
|
|
R2_SECRET_ACCESS_KEY=
|
|
R2_ENDPOINT=
|
|
R2_REGION=auto
|
|
R2_BUCKET=
|
|
R2_URL=
|
|
|
|
# ============================================
|
|
# Social Platform Credentials (optional in dev)
|
|
# ============================================
|
|
LINKEDIN_CLIENT_ID=
|
|
LINKEDIN_CLIENT_SECRET=
|
|
LINKEDIN_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin/callback"
|
|
# LINKEDIN_SCOPES="openid,profile,email,w_member_social"
|
|
LINKEDIN_PAGE_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin-page/callback"
|
|
# LINKEDIN_PAGE_SCOPES="openid,profile,email,w_organization_social,r_organization_social,rw_organization_admin,w_member_social"
|
|
|
|
X_CLIENT_ID=
|
|
X_CLIENT_SECRET=
|
|
X_CLIENT_REDIRECT="${APP_URL}/accounts/x/callback"
|
|
|
|
TIKTOK_CLIENT_ID=
|
|
TIKTOK_CLIENT_SECRET=
|
|
TIKTOK_CLIENT_REDIRECT="${APP_URL}/accounts/tiktok/callback"
|
|
|
|
FACEBOOK_CLIENT_ID=
|
|
FACEBOOK_CLIENT_SECRET=
|
|
FACEBOOK_CLIENT_REDIRECT="${APP_URL}/accounts/facebook/callback"
|
|
|
|
INSTAGRAM_CLIENT_ID=
|
|
INSTAGRAM_CLIENT_SECRET=
|
|
INSTAGRAM_CLIENT_REDIRECT="${APP_URL}/accounts/instagram/callback"
|
|
|
|
THREADS_CLIENT_ID=
|
|
THREADS_CLIENT_SECRET=
|
|
THREADS_CLIENT_REDIRECT="${APP_URL}/accounts/threads/callback"
|
|
|
|
GOOGLE_AUTH_ENABLED=false
|
|
GOOGLE_CLIENT_ID=
|
|
GOOGLE_CLIENT_SECRET=
|
|
GOOGLE_CLIENT_REDIRECT="${APP_URL}/accounts/youtube/callback"
|
|
GOOGLE_AUTH_CALLBACK="${APP_URL}/auth/google/callback"
|
|
|
|
GITHUB_AUTH_ENABLED=false
|
|
GITHUB_CLIENT_ID=
|
|
GITHUB_CLIENT_SECRET=
|
|
GITHUB_AUTH_CALLBACK="${APP_URL}/auth/github/callback"
|
|
|
|
PINTEREST_CLIENT_ID=
|
|
PINTEREST_CLIENT_SECRET=
|
|
PINTEREST_CLIENT_REDIRECT="${APP_URL}/accounts/pinterest/callback"
|
|
|
|
# Telegram (single shared bot — create one via https://t.me/BotFather)
|
|
# After setting these, run: php artisan telegram:set-webhook
|
|
TELEGRAM_BOT_TOKEN=
|
|
TELEGRAM_BOT_USERNAME=
|
|
TELEGRAM_WEBHOOK_SECRET=
|
|
|
|
# AI Services
|
|
OPENAI_API_KEY=
|
|
ANTHROPIC_API_KEY=
|
|
GEMINI_API_KEY=
|
|
OPENROUTER_API_KEY=
|
|
ELEVENLABS_API_KEY=
|
|
|
|
# AI Provider Selection
|
|
# text: openai | anthropic | gemini | openrouter | xai | groq | mistral | deepseek | ...
|
|
# image: openai | gemini | xai | openrouter
|
|
# audio: openai | elevenlabs
|
|
# OpenRouter is a first-class laravel/ai provider (AI_TEXT_PROVIDER=openrouter + OPENROUTER_API_KEY).
|
|
AI_TEXT_PROVIDER=openai
|
|
AI_IMAGE_PROVIDER=openai
|
|
AI_AUDIO_PROVIDER=elevenlabs
|
|
|
|
# Telemetry — disabled by default in Docker dev.
|
|
NIGHTWATCH_ENABLED=false
|
|
NIGHTWATCH_TOKEN=
|
|
|
|
# Media Services
|
|
UNSPLASH_ACCESS_KEY=
|
|
UNSPLASH_SECRET_KEY=
|
|
GIPHY_API_KEY=
|
|
|
|
# Analytics (optional)
|
|
GTM_ID=
|
|
POSTHOG_ENABLED=false
|
|
POSTHOG_API_KEY=
|
|
POSTHOG_HOST=https://us.i.posthog.com
|
|
|
|
# Vite
|
|
VITE_APP_NAME="${APP_NAME}"
|
|
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
|
|
VITE_REVERB_HOST="${REVERB_HOST}"
|
|
VITE_REVERB_PORT="${REVERB_PORT}"
|
|
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
|
|
VITE_POSTHOG_ENABLED="${POSTHOG_ENABLED}"
|
|
VITE_POSTHOG_API_KEY="${POSTHOG_API_KEY}"
|
|
VITE_POSTHOG_HOST="${POSTHOG_HOST}"
|