Commit graph

16 commits

Author SHA1 Message Date
Vadym Samoilenko
bc3c5e0756 fix: replace unsupported safetyFilterLevel with personGeneration for Veo 3.1
safetyFilterLevel is not supported by veo-3.1-generate-preview.
Use personGeneration=allow_all instead, which is the correct Veo API
parameter for relaxed safety mode. Verified via live API test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 18:57:58 +01:00
Vadym Samoilenko
0df2924c65 feat: add relaxed safety filter toggle to video generation (Veo)
Mirrors the image gen safety toggle — BLOCK_FEWEST on all Veo safety
categories when enabled, default filters otherwise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 16:16:46 +01:00
Vadym Samoilenko
fa7c67af6a refactor: move video prompt optimization to backend
Client-side Gemini calls were hitting the frontend API key's rate limits
and exposing the key in the browser. The optimizer now POSTs to
video_api.php (action=optimize_prompt) which calls Gemini server-side
using the backend key.

Rate-limited responses (429) silently fall back to the simple prompt
generator without showing an error.

Removes the @google/generative-ai import from VideoGenTab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:32:30 +01:00
Vadym Samoilenko
68690b819a fix: durationSeconds must be integer not string in Veo API
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:24:47 +01:00
Vadym Samoilenko
dbe5ef3f11 fix: revert Veo I2V image format to bytesBase64Encoded
The Veo predictLongRunning endpoint is a predict-style API (not
generateContent) and expects image data as:
  { "bytesBase64Encoded": "...", "mimeType": "image/jpeg" }

The previous session switched it to inlineData (generateContent format),
causing the API to reject it with:
  "inlineData isn't supported by this model"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:23:32 +01:00
Vadym Samoilenko
53c4e9f8a3 fix: GD safety check + zlib-dev for robust Alpine build
- video_api.php: check function_exists('imagecreatefromstring') before calling GD
  — undefined function causes PHP fatal error even with @ suppressor, kills php-fpm
- Dockerfile: add zlib-dev (required for libpng on some Alpine versions)
- Dockerfile: verify GD loaded after install (build log confirmation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:09:54 +01:00
Vadym Samoilenko
e43432e08c fix: correct Kling and Veo API parameter formats
Kling:
- camera_control.type: use preset name directly (down_back etc.), not 'predefined'
- camera_control.config: all 6 integer fields required even for preset types
- duration: cast to integer (API rejects strings)
- I2V images: use image_url/image_tail_url with data URI prefix (not plain base64 in image/image_tail)

Veo:
- image/lastFrame: use inlineData format (Gemini API), not bytesBase64Encoded (Vertex AI)
- durationSeconds: send as string "4"/"6"/"8", not integer

Docker:
- Add uploads.ini: post_max_size=100M, upload_max_filesize=100M, memory_limit=512M
  (ini_set cannot override these at runtime in php-fpm)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 17:59:56 +01:00
Simeon.Schecter
95e6946807 feat: Kling integration, prompt optimizer rework, and stability fixes
Kling video generation:
- Full T2V, I2V, extend, and lip sync workflows via Kling API
- V3, V2.6, V2.5 Turbo, V2.1 Master, V1.6 model support
- Resolution selector (720p std / 1080p pro) with model constraints
- Native audio toggle with dialogue input for Kling
- Video ID tracking for extend and lip sync chains
- Camera control presets (pan, tilt, arc)

Prompt optimizer rework:
- Intent-preserving refinement (camera, action, mood are sacred)
- Mode-aware: T2V adds subject/environment detail, I2V describes only motion
- Reference images analyzed for content, not re-described
- Platform-specific quality anchors woven into positive prompt
- Negative prompts removed from optimizer (positive-only approach)
- 15-60 word target for concise, effective prompts

Backend fixes:
- Gemini responseModalities: ['TEXT', 'IMAGE'] for Flash model compatibility
- Veo first-frame resize to exact target dimensions (prevents letterboxing)
- Session directory re-creation in saveImage (auto-cleanup race condition)
- Kling API error logging with HTTP codes and payload details
- Lip sync endpoint updated to /v1/videos/lip-sync with video_id

Frontend stability:
- Tab persistence via CSS hidden (generation survives tab switches)
- Project switch protection (confirm dialog when generation in progress)
- Retina thumbnails (480px/q0.8) for library grid — prevents OOM crashes
- Thumbnail backfill migration for existing project items
- Project items refresh on tab visibility and after save
- 1:1 aspect ratio container for Kling videos
- Expanded video view matches library modal behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 21:51:03 -04:00
Simeon.Schecter
b9f35de5ef Add Kling AI video generation engine alongside Veo 3.1
Integrates Kling AI as a second video engine in the Video Gen tab with
three cinema-relevant workflows: Generate (T2V/I2V with camera control),
Extend (video extension up to 3 min), and Lip Sync (image + audio).

Backend: New kling_api.php with pure PHP JWT auth, all workflows, async
status polling, and CDN video download. Env files updated with Kling
credential placeholders.

Frontend: Engine selector toggle, workflow-specific settings panels,
Kling polling, engine badges in ProjectsTab, rerun support.

Also includes image model toggle changes (Gemini Pro/Flash).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:22:39 -04:00
Manish Tanwar
988429a759 Merge origin/main: add custom presets, identity protection, video negative prompts, UX improvements
Resolved conflict in AppContent.jsx: combined MSAL fix (unconditional hooks) with
new features (Local Developer display name, conditional logout button).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-02-25 17:43:38 +05:30
Manish Tanwar
3596826cc4 Fix MSAL auth (redirect mode, initialize), increase PHP timeouts, update CLAUDE.md
- main.jsx: always initialize MSAL with initialize() before rendering (MSAL v3 requirement)
- main.jsx: always wrap with MsalProvider regardless of SSO toggle
- AppContent.jsx: only show login gate when isSSOEnabled() is true
- LoginPage.jsx: switch loginPopup → loginRedirect for incognito compatibility
- authConfig.js: add navigateToLoginRequestUrl: false
- api.php: set_time_limit(120) to prevent Imagen 3 timeout
- video_api.php: set_time_limit(300) to prevent Veo polling timeout
- CLAUDE.md: fix IndexedDB schema, add AppContent/MSAL pattern, Vite proxy routes, missing packages

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-02-25 17:42:20 +05:30
Simeon.Schecter
836e6f9c06 Add custom presets, identity protection, video negative prompts, and UX improvements
Features:
- Custom user presets: Create, edit, delete, export/import lighting presets
  stored in IndexedDB (useCustomPresets.js hook, DB schema v3→v4)
- Identity protection: LLM-mediated name-to-style translation prevents
  generating recognizable real people while preserving style references.
  Active divergence breaks likeness convergence. Defense-in-depth across
  both prompt paths + generateImage() fallback
- Video negative prompts: AI auto-generates suggested negative prompts
  during Veo 3.1 prompt optimization. Collapsible editable textarea
  teaches creatives what to exclude. Sent as negativePrompt parameter
- Generate Video from Library: Image preview modal now has a gold
  "Generate Video" button that loads the image as a first frame reference
- Expanded preview overlays: Maximize button on generated images and
  videos opens a large centered overlay (90vw, not fullscreen)
- Move items between projects: ArrowRightLeft button in Library list
  and preview modal
- Preset display in Library: Shows which preset was used per generation

Backend improvements:
- video_api.php: negativePrompt passthrough to Veo 3.1 parameters,
  lastFrame interpolation works with fast model (8s required)
- api.php: Exponential backoff retry (3 attempts), increased memory/
  POST limits for 4K images, user-friendly 500 error messages
- enhance_prompt.php: User lighting intent now respected over preset
  defaults (critical fix for night/sunset scene descriptions)
- session_manager.php: Fix images subdirectory creation race condition

Infrastructure:
- SSO made conditional via VITE_SSO_ENABLED env variable — hooks only
  called when SSO is active, local dev bypasses auth cleanly
- .gitignore updated for root-level generated_videos/, uploads/,
  config.php, backend/php.ini, Prompt_Studio/
- Wire up dead getNegativeConstraints() code in both prompt paths

No env files or secrets included. Production deploys via deploy.sh
using .env.production templates (SSO_ENABLED configurable per env).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:58:23 -05:00
Manish Tanwar
3602cfd73b Update-video format api for reference images 2026-01-28 01:37:17 +05:30
Manish Tanwar
0017cc323d Update-thumbnail 2026-01-28 00:10:09 +05:30
Manish Tanwar
e1067b551e update 2026-01-27 18:36:53 +05:30
Manish Tanwar
165a10694a Restructuring of files and Local Tested 2026-01-13 14:52:37 +05:30
Renamed from video_api.php (Browse further)