Commit graph

9 commits

Author SHA1 Message Date
Vadym Samoilenko
22a5ce83af feat: admin users can rotate Kling credentials in real-time via UI
- Add runtime_config.php: credential store backed by runtime_config.json
  (gitignored). Falls back to .env values so existing envs need no migration.
- Add admin_api.php: status / test_kling / update_kling endpoints gated
  behind ADMIN_EMAILS allowlist. Accepts Bearer idToken when SSO enabled;
  uses mock dev@localhost when SSO disabled.
- config.php: replace KLING_ACCESS_KEY/SECRET_KEY defines with ADMIN_EMAILS
- kling_api.php: read credentials via getKlingCredentials() on every request
  so rotations take effect immediately without a server restart
- All .env templates: add ADMIN_EMAILS= (dev@localhost populated in .env.local)
- AdminSettings.jsx: modal with masked status, Test Connection, Save Credentials
- AppContent.jsx: admin status check on mount; Settings gear shown to admins
- Fix production URL in .env.production/.env.example (optical-prod.oliver.solutions)
- .gitignore: exclude backend/runtime_config.json

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 16:45:27 +01:00
Vadym Samoilenko
a2358ba01c fix: correct Kling API params per official docs
- camera_control: only kling-v1 and kling-v1-5 support it (not v3)
- For preset types (down_back etc.), config must be absent — only
  'simple' type uses config fields
- camera_control and image_tail are mutually exclusive in I2V
- cfg_scale not supported by kling-v2.x models — now skipped
- duration sent as string to match API examples
- v3/v3-omni removed from camera control UI list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:38:31 +01:00
Vadym Samoilenko
746cd42f6c fix: restrict camera control to supported models; update model list
Camera/motion control is only supported by kling-v1, kling-v1-5,
kling-v3, kling-v3-omni. Backend silently drops the camera_control
field for all other models. Frontend hides the camera control UI
and auto-clears the selection when switching to an unsupported model.

New models added: kling-v3-omni, kling-video-o1, kling-v1 (cam ctrl),
kling-v2-master. Duration validation loosened for v3/v3-omni (3-15s).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:35:34 +01:00
Vadym Samoilenko
5a17565731 fix: Kling I2V uses image/image_tail fields with clean base64
Kling image2video endpoint expects:
  image: "<base64>" (no data URI prefix)
  image_tail: "<base64>" (optional, for interpolation)

Not image_url/image_tail_url with data URIs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:27:58 +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
Vadym Samoilenko
3f10b53f9c fix: add GD extension, fix Kling video URLs and undefined variable
- Dockerfile: install GD (libpng + libjpeg) for Veo I2V image resizing
- Dockerfile: create generated_videos/ dir with write permissions
- kling_api.php: fix video URL /generated_videos/ → /lux-studio/api/generated_videos/ (nginx couldn't find files at old path)
- kling_api.php: fix undefined \$path → \$endpoint in error log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 17:27:12 +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
35d19e3a25 Add Kling 3.0 models (V3 and V3 Omni) to video generation
- Add kling-v3 and kling-v3-omni to model selector and backend validation
- Set V3 as the new default model (was V2.6)
- V3 Omni includes built-in audio generation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 21:30:00 -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