Skip to content

veo - #1792

Merged
seefs001 merged 4 commits into
mainfrom
alpha
Sep 13, 2025
Merged

veo#1792
seefs001 merged 4 commits into
mainfrom
alpha

Conversation

@seefs001

@seefs001 seefs001 commented Sep 13, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Added Vertex AI integration for video generation with long‑running task submission and fetching.
    • Supports Google Cloud project header and service account token acquisition (with optional proxy).
  • Bug Fixes
    • Prevents storing sensitive/base64 video content and data-URL leakage in task data.
    • Safer handling of /v1/video/generations: POST parses body; GET fetches by ID without parsing.
    • More robust region resolution with a “global” fallback.
    • Improves task fetch resilience with a default empty-body response.
    • Various stability improvements during task submission/fetch flows.

@coderabbitai

coderabbitai Bot commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces Vertex AI video task integration and related plumbing: new task adaptor, token acquisition, adaptor registration, and Vertex-aware fetch path. Adjusts middleware for POST/GET video handling, adds response redaction for video tasks, and minor safety/header tweaks. Several files only receive trailing newline formatting fixes.

Changes

Cohort / File(s) Summary of changes
Formatting fixes
common/database.go, controller/setup.go, main.go
Added/corrected trailing newlines; no semantic changes.
Middleware video routing
middleware/distributor.go
In getModelRequest, unmarshal body and set VideoSubmit only for POST; GET now sets VideoFetchByID without unmarshalling.
Video task redaction & status handling
controller/task_video.go
Store redacted video response data; avoid setting FailReason from large data URLs; add redact and truncate helpers.
Vertex AI task adaptor (new)
relay/channel/task/vertex/adaptor.go
New TaskAdaptor: validate requests, build URLs/headers/body, submit/fetch operations, parse results, encode/decode task IDs, handle regions/projects, and map statuses/outputs.
Vertex channel tweaks
relay/channel/vertex/adaptor.go, relay/channel/vertex/relay-vertex.go
Add x-goog-user-project header when ProjectID present; GetModelRegion now safely falls back to "global" if default missing.
Service account token acquisition
relay/channel/vertex/service_account.go
Add public AcquireAccessToken and proxy-aware JWT bearer token exchange helper.
Adaptor wiring & task fetch path
relay/relay_adaptor.go, relay/relay_task.go
Register Vertex AI API and task adaptors; enhance video fetch-by-ID to call Vertex adaptor, update task state, and build Vertex-style response; add defaults for empty fetch body; init guards.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client
    participant API as API (/v1/video/generations)
    participant Relay as Relay Layer
    participant VTA as Vertex TaskAdaptor
    participant GCP as Vertex AI (Operations)
    participant DB

    rect rgba(227,242,253,0.6)
    note over Client,API: Submit video generation (POST)
    Client->>API: POST prompt/model
    API->>Relay: Build TaskRelayInfo (VideoSubmit)
    Relay->>VTA: Validate + Build URL/Headers/Body
    VTA->>GCP: predictLongRunning (auth via service account)
    GCP-->>VTA: Operation { name, done:false }
    VTA-->>Relay: taskID (encoded op name), taskData
    Relay->>DB: Persist task (data redacted in controller)
    Relay-->>API: { task_id }
    API-->>Client: 202 Accepted with task_id
    end

    rect rgba(232,245,233,0.6)
    note over Client,API: Fetch by ID (GET)
    Client->>API: GET ?task_id=...
    API->>Relay: Build TaskRelayInfo (VideoFetchByID)
    Relay->>VTA: FetchTask with op name
    VTA->>GCP: operations.get
    GCP-->>VTA: Operation { done:bool, result/error }
    VTA-->>Relay: ParseTaskResult (status, url/mimeType, error)
    Relay->>DB: Update task status/progress/fail_reason
    Relay-->>API: Mapped response { status, url, format, error? }
    API-->>Client: 200 OK
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • creamlike1024
  • xyfacai

Poem

I thump my paw—new paths we try,
Vertex winds beneath the sky.
Tokens signed, IDs in flight,
Fetch and file by moonlit night.
Redact the secrets, keep them tight—
Hop, hop, ship it right! 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch alpha

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 406a3e4 and 6628fd9.

📒 Files selected for processing (11)
  • common/database.go (1 hunks)
  • controller/setup.go (1 hunks)
  • controller/task_video.go (3 hunks)
  • main.go (1 hunks)
  • middleware/distributor.go (1 hunks)
  • relay/channel/task/vertex/adaptor.go (1 hunks)
  • relay/channel/vertex/adaptor.go (1 hunks)
  • relay/channel/vertex/relay-vertex.go (1 hunks)
  • relay/channel/vertex/service_account.go (2 hunks)
  • relay/relay_adaptor.go (3 hunks)
  • relay/relay_task.go (4 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seefs001
seefs001 merged commit 96215c9 into main Sep 13, 2025
0 of 2 checks passed
This was referenced Sep 13, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jan 14, 2026
This was referenced Mar 28, 2026
Closed
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants