Skip to content

Conversation

@ijonele
Copy link
Collaborator

@ijonele ijonele commented Aug 8, 2025

Integrated the Venic Plugin with Filebase/IPFS (this is a POC)

  • Locally, the Plugin returns a Base64-encoded JSON object with 3 URLs: A Filebase gateway, an IPFS public gateway, a Pinata public gateway
  • For image generation, there are no size limitations. Images are uploaded through a free Filebase account.
  • This implementation has been tested locally, but not with Hyperlane. The PluginGmpHandler hasn’t been updated yet.
  • The Filebase API key is stored by Prophets.
  • Images are uploaded using the mime/multipart package and Filebase’s RPC API.

@ijonele ijonele requested a review from a team as a code owner August 8, 2025 10:36
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

Hey @ijonele and thank you for opening this pull request! 👋🏼

It looks like you forgot to add a changelog entry for your changes. Make sure to add a changelog entry in the 'CHANGELOG.md' file.

@vercel
Copy link

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
warden-help-center ⬜️ Ignored (Inspect) Visit Preview Aug 11, 2025 0:24am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

📝 Walkthrough

Walkthrough

Refactors the VeniceImg plugin to use separate Venice and storage API keys, upload generated image bytes to Filebase IPFS, and return IPFS gateway URLs. Updates configuration, plugin constructor/execution, and app registration accordingly; minor docs formatting change.

Changes

Cohort / File(s) Change Summary
VeniceImg Plugin Core Logic
prophet/plugins/veniceimg/veniceimg.go
Split Venice vs storage API keys; added storageClient and uploadToFilebase method; constructor now accepts veniceKey, storageKey; Execute uploads returned image bytes to Filebase and returns IPFS gateway URLs; removed local image processing.
VeniceImg Plugin Configuration
prophet/plugins/veniceimg/config/config.go
Replaced ApiKey with VeniceKey and StorageKey in Config; updated DefaultConfig and TOML/mapstructure tags; default template adds venice-key and storage-key (storage key documented for Filebase).
Plugin Registration in App
warden/app/app.go
Updated plugin registration to pass two config values (venice-key, storage-key) to veniceimg.New matching the new constructor signature.
Documentation
docs/developer-docs/docs/build-an-agent/.../demo-create-an-order.md
Formatting changes in "Optional adjustments" list (reflowed numeric labels and bullets); no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Plugin
    participant VeniceAPI
    participant FilebaseAPI
    participant IPFSGateway

    User->>Plugin: Request image generation
    Plugin->>VeniceAPI: Generate image (auth: VeniceKey)
    VeniceAPI-->>Plugin: Return image bytes (WebP)
    Plugin->>FilebaseAPI: Upload bytes (auth: StorageKey)
    FilebaseAPI-->>Plugin: Return CID
    Plugin->>IPFSGateway: Build gateway URLs from CID
    Plugin-->>User: Return JSON with IPFS URLs
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Venice image gen #1551: Introduced the original VeniceImg plugin with a single ApiKey; this PR directly extends/refactors that plugin to split keys and add Filebase upload flow.

Suggested reviewers

  • Pitasi

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 665c223 and edd047a.

📒 Files selected for processing (1)
  • docs/developer-docs/docs/build-an-agent/build-an-onchain-ai-agent/demo-create-an-order.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/developer-docs/docs/build-an-agent/build-an-onchain-ai-agent/demo-create-an-order.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: lint
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch venice-ipfs

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🔭 Outside diff range comments (2)
prophet/plugins/veniceimg/veniceimg.go (2)

52-55: Guard against empty image list to avoid index panic

res.Images[0] will panic when the API returns zero images.

Apply this diff:

-	imgBytes, err := base64.StdEncoding.DecodeString(res.Images[0])
+	if len(res.Images) == 0 {
+		return nil, fmt.Errorf("venice returned no images")
+	}
+	imgBytes, err := base64.StdEncoding.DecodeString(res.Images[0])

108-147: Improve error details from Venice generate API

Include response body on non-200 to aid debugging and handle non-200-but-JSON error payloads. Also, some APIs use 201; if Venice strictly uses 200, this is fine—otherwise consider allowing 201.

Apply this diff:

-	if httpRes.StatusCode != http.StatusOK {
-		return generateResponse{}, fmt.Errorf("http status code: %s", httpRes.Status)
-	}
+	if httpRes.StatusCode != http.StatusOK {
+		b, _ := io.ReadAll(io.LimitReader(httpRes.Body, 2048))
+		return generateResponse{}, fmt.Errorf("venice generate failed: %s: %s", httpRes.Status, string(bytes.TrimSpace(b)))
+	}

Additional imports needed (outside this hunk):

import "bytes"

Note: bytes is already imported; io is imported too, so no new imports may be necessary beyond what exists.

🧹 Nitpick comments (2)
prophet/plugins/veniceimg/config/config.go (1)

28-31: Strengthen template guidance around secrets

Add a brief note that these are sensitive credentials and should be supplied via environment/secure secrets manager, not committed in plaintext.

Suggested comment tweak:

-# API Key used when making VeniceImg API requests
+# API Key used when making VeniceImg API requests (treat as secret; prefer env/secret manager)
 venice-key = "{{ .Veniceimg.VeniceKey }}"

-# API Key used when saving the image to Filebase
+# API Key used when saving the image to Filebase (treat as secret; prefer env/secret manager)
 storage-key = "{{ .Veniceimg.StorageKey }}"
prophet/plugins/veniceimg/veniceimg.go (1)

62-69: Consider returning the CID alongside gateway URLs

Returning the raw CID helps downstream consumers who want to use custom gateways or IPFS-native tooling.

Apply this diff:

-	urls := map[string]string{
+	urls := map[string]string{
+		"cid":      cid,
 		"filebase": "https://ipfs.filebase.io/ipfs/" + cid,
 		"ipfs":     "https://ipfs.io/ipfs/" + cid,
 		"pinata":   "https://gateway.pinata.cloud/ipfs/" + cid,
 	}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f43e19 and 8a98b17.

📒 Files selected for processing (3)
  • prophet/plugins/veniceimg/config/config.go (2 hunks)
  • prophet/plugins/veniceimg/veniceimg.go (4 hunks)
  • warden/app/app.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: lint
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
prophet/plugins/veniceimg/config/config.go (1)

4-6: Config key split looks good; tags consistent with template and app opts

The move to separate venice-key and storage-key is correct; mapstructure/TOML tags align with app.go usage.

@ijonele ijonele requested a review from Pitasi August 8, 2025 11:37
@github-actions github-actions bot removed the docs label Aug 11, 2025
@Pitasi Pitasi changed the title inegrated the veniceimg plugin with filebase veniceimg: store generated images in IPFS Sep 9, 2025
@Pitasi
Copy link
Contributor

Pitasi commented Sep 9, 2025

I'm keeping this on hold until we resume the protocol development work.

@Pitasi Pitasi marked this pull request as draft October 17, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants