Skip to content

feat(quiver): add QuiverAI integration for SVG generation and vectorization#3728

Merged
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/add-quiver-integration
Mar 24, 2026
Merged

feat(quiver): add QuiverAI integration for SVG generation and vectorization#3728
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/add-quiver-integration

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add Quiver integration with 3 tools: Text to SVG, Image to SVG, List Models
  • Internal API routes for file handling (references, image uploads) using standard file pipeline
  • Block with operation dropdown, file upload subBlocks, and advanced mode params

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 24, 2026 1:02am

Request Review

@cursor
Copy link

cursor bot commented Mar 24, 2026

PR Summary

Medium Risk
Introduces new API routes that accept user-provided files/URLs and proxy requests to an external service, which can impact security, reliability, and payload handling if validation/limits are off.

Overview
Adds a new QuiverAI integration end-to-end: a QuiverBlock with operation selection (text-to-SVG, image-to-SVG, list models), API-key auth, and file/reference inputs that normalize into tool params.

Implements new internal API routes for quiver_text_to_svg and quiver_image_to_svg that validate inputs with zod, resolve uploaded files via the existing storage pipeline, call Quiver’s external API, and return generated SVGs as base64-encoded file/files outputs with usage metadata.

Registers the new Quiver tools in the tool and block registries, adds a QuiverIcon plus icon mappings, and publishes new docs content (tools/quiver.mdx) and metadata updates so the integration appears in the docs and landing integrations list.

Written by Cursor Bugbot for commit da17505. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 24, 2026

Greptile Summary

This PR adds a full QuiverAI integration with three operations — Text to SVG, Image to SVG, and List Models — following the established block/tool/route pattern used throughout the codebase. The two generative tools proxy through internal Next.js API routes (handling file download and base64 conversion server-side), while list_models calls the Quiver API directly, which is appropriate since no file handling is required.

Key changes:

  • New tool configs (text_to_svg, image_to_svg, list_models) under apps/sim/tools/quiver/ with correct user-only visibility on apiKey params
  • Internal proxy routes at /api/tools/quiver/text-to-svg and /api/tools/quiver/image-to-svg for server-side file handling
  • Block definition with operation dropdown, conditional file-upload subBlocks, and advanced mode params
  • Icon, registry, icon-mapping, and docs additions all consistent with existing patterns

One issue to address: The params transformer in quiver.ts uses JavaScript truthiness to gate numeric params (temperature, top_p, etc.). This works in the typical UI path where values are strings, but will silently drop a value of 0 if a numeric zero is passed in programmatically (e.g. from a connected block or LLM). The route handlers already use != null for these checks — the block params should align with that pattern.

Confidence Score: 4/5

  • Safe to merge after addressing the numeric-zero silent-drop bug in the block params transformer.
  • The integration is well-structured and follows all existing patterns. API key visibility is correctly set to user-only, file handling is properly server-side proxied, and the route handlers are solid. The one concrete issue — truthiness guards on numeric params that would silently drop a value of 0 — is a targeted, low-risk fix that doesn't affect the primary happy path from the UI.
  • apps/sim/blocks/blocks/quiver.ts — the params transformer's truthiness checks for numeric values

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/quiver.ts Block config for the Quiver integration. Defines operation dropdown, file upload subBlocks, advanced params, and tool routing. A truthiness-based guard for numeric params (temperature, top_p, etc.) will silently drop a value of 0 if the param is ever supplied as a JS number rather than a string.
apps/sim/app/api/tools/quiver/text-to-svg/route.ts Internal proxy route for text-to-SVG generation. Handles reference file processing (URL or base64), slices at 4 references, and proxies to the Quiver API. Invalid reference files are silently skipped; code is otherwise correct.
apps/sim/app/api/tools/quiver/image-to-svg/route.ts Internal proxy route for image-to-SVG vectorization. Correctly handles file input as an object or JSON string, downloads from storage, converts to base64, and calls the Quiver vectorization API.
apps/sim/tools/quiver/list_models.ts Tool config for listing Quiver models. Calls the external API directly (no file handling needed), maps snake_case API fields to camelCase, and handles non-JSON error bodies gracefully.
apps/sim/tools/quiver/text_to_svg.ts Tool config for text-to-SVG. Proxies through the internal API route to handle file uploads server-side. API key marked user-only, outputs schema well-defined.
apps/sim/tools/quiver/image_to_svg.ts Tool config for image-to-SVG vectorization. Proxies through internal API route. API key and model are user-only visibility as expected.
apps/sim/tools/quiver/types.ts TypeScript types for Quiver tool params and responses. Well-structured, uses unknown for flexible file inputs.
apps/sim/tools/quiver/index.ts Barrel export file for all Quiver tools. Uses @/ path aliases consistently (previously raised alias inconsistency was fixed).

Sequence Diagram

sequenceDiagram
    participant UI as Quiver Block (UI)
    participant TR as Tool Runner
    participant TTS as /api/tools/quiver/text-to-svg
    participant ITS as /api/tools/quiver/image-to-svg
    participant Store as File Storage
    participant QAI as api.quiver.ai

    Note over UI,QAI: Text to SVG flow
    UI->>TR: quiver_text_to_svg(prompt, model, refs?)
    TR->>TTS: POST {apiKey, prompt, model, references?}
    TTS->>Store: downloadFileFromStorage(ref)
    Store-->>TTS: Buffer
    TTS->>QAI: POST /v1/svgs/generations {model, prompt, references[base64]}
    QAI-->>TTS: {data:[{svg}], id, usage}
    TTS-->>TR: {success, output:{file, files, svgContent, id, usage}}
    TR-->>UI: outputs

    Note over UI,QAI: Image to SVG flow
    UI->>TR: quiver_image_to_svg(model, image)
    TR->>ITS: POST {apiKey, model, image}
    ITS->>Store: downloadFileFromStorage(image)
    Store-->>ITS: Buffer
    ITS->>QAI: POST /v1/svgs/vectorizations {model, image:{base64}}
    QAI-->>ITS: {data:[{svg}], id, usage}
    ITS-->>TR: {success, output:{file, svgContent, id, usage}}
    TR-->>UI: outputs

    Note over UI,QAI: List Models flow
    UI->>TR: quiver_list_models(apiKey)
    TR->>QAI: GET /v1/models (Authorization: Bearer apiKey)
    QAI-->>TR: {data:[{id, name, ...}]}
    TR-->>UI: {success, output:{models}}
Loading

Reviews (3): Last reviewed commit: "fix(quiver): add files array to image-to..." | Re-trigger Greptile

@waleedlatif1
Copy link
Collaborator Author

All three issues addressed in 9ab80e3:

  1. n > 1 data loss: Route now returns all generated SVGs in a files array. file still returns the first for backward compat.
  2. list_models error handling: response.ok is now checked before response.json(), with a try/catch for non-JSON error bodies.
  3. Import consistency: Updated ./types to @/tools/quiver/types.

@greptile @cursor review

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 8f793d9 into staging Mar 24, 2026
11 of 12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/add-quiver-integration branch March 24, 2026 01:08
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.

1 participant