Skip to content

Conversation

@AdirAmsalem
Copy link

@AdirAmsalem AdirAmsalem commented Dec 28, 2025

🎯 Changes

Followed Community Adapters Guide to add Decart's community adapter.

  • Add comprehensive documentation for the Decart community adapter (@decartai/tanstack-ai-adapter)
  • Include the adapter in the docs sidebar navigation

Image Generation

  • decartImage() / createDecartImage() adapters
  • Support for lucy-pro-t2i model
import { generateImage } from "@tanstack/ai";
import { decartImage } from "@decartai/tanstack-ai-adapter";

await generateImage({
  adapter: decartImage("lucy-pro-t2i"),
  prompt: "A serene mountain landscape at sunset",
});

Video Generation

  • decartVideo() / createDecartVideo() adapters
  • Support for lucy-pro-t2v model
  • Async job/polling architecture for video generation workflows
import { generateVideo } from "@tanstack/ai";
import { decartVideo } from "@decartai/tanstack-ai-adapter";

await generateVideo({
  adapter: decartVideo("lucy-pro-t2v"),
  prompt: "A cat playing with a ball of yarn",
});

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

Documentation

  • Added comprehensive documentation for Decart adapter integration, covering installation, configuration options, usage examples for image and video generation with various parameters, polling semantics for job status tracking, and complete API reference.
  • Updated documentation navigation to include the new Decart adapter guide in Community Adapters section.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 28, 2025

📝 Walkthrough

Walkthrough

This PR introduces comprehensive documentation for the Decart adapter integration, detailing installation, usage patterns, configuration options, image and video generation workflows, and API reference. The new documentation page is registered in the site configuration.

Changes

Cohort / File(s) Summary
Documentation
docs/community-adapters/decart.md
New adapter guide covering Decart integration with installation, basic/advanced usage, configuration options, image/video generation flows, environment variables, complete API reference, code samples, polling semantics, and end-to-end examples.
Site Configuration
docs/config.json
Added new navigation entry for Decart adapter documentation under Community Adapters section.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • jherr
  • tannerlinsley
  • LadyBluenotes

Poem

🐰 A new adapter finds its place,
In docs, with grace and style!
Decart joins the friendly space,
Bringing magic, mile by mile. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding documentation for the Decart community adapter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description follows the required template with all major sections completed: changes clearly documented with code examples, checklist items addressed, and release impact properly indicated.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@AdirAmsalem AdirAmsalem marked this pull request as ready for review December 28, 2025 14:30
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: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a866721 and 68917a4.

📒 Files selected for processing (2)
  • docs/community-adapters/decart.md
  • docs/config.json
🧰 Additional context used
🪛 LanguageTool
docs/community-adapters/decart.md

[grammar] ~209-~209: Ensure spelling is correct
Context: ...age(model, apiKey, config?)` Creates a Decart image adapter with an explicit API key....

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (10)
docs/community-adapters/decart.md (9)

1-13: LGTM! Clear introduction and installation instructions.

The front matter, introduction, and installation instructions are well-structured and provide a clear entry point for users.


15-39: LGTM! Well-organized usage examples.

The dual examples effectively demonstrate both environment-variable-based and explicit API key patterns, making it easy for users to choose the approach that fits their use case.


41-51: LGTM! Configuration pattern is clear.

The example correctly demonstrates the configuration pattern with Omit<DecartImageConfig, "apiKey">, clearly showing that the API key is passed separately from other configuration options.


53-88: LGTM! Image generation documentation is comprehensive.

The examples and options table clearly document the available parameters. The resolution being limited to "720p" for image generation appears to be an API constraint of the lucy-pro-t2i model.


93-123: LGTM! Clear video generation workflow.

The step-by-step breakdown of creating a video job and polling for status is well-documented and easy to follow.


160-178: LGTM! Video model options are well-documented.

The video model options table clearly shows the available parameters, including multiple resolution options ("720p" and "480p") compared to image generation.


180-192: LGTM! Clear guidance on API key setup.

The environment variable configuration and step-by-step instructions for obtaining an API key are helpful and well-organized.


194-240: LGTM! Comprehensive API reference.

The API reference clearly documents all four adapter functions with their parameters and return values. The documentation is consistent with the usage examples throughout the document.

Note: The static analysis tool flagged "Decart" as a potential spelling error on line 209, but this is a false positive—"Decart" is the product name.


242-248: LGTM! Helpful next steps and resources.

The links provide users with clear paths to continue learning, including both Decart-specific resources and broader TanStack documentation.

docs/config.json (1)

156-159: LGTM! Navigation entry correctly configured.

The Decart documentation is properly registered in the sidebar navigation with the correct label and path that matches the new documentation file.

Comment on lines +125 to +158
### Complete Example with Polling

```typescript
import { generateVideo, getVideoJobStatus } from "@tanstack/ai";
import { decartVideo } from "@decartai/tanstack-ai-adapter";

async function createVideo(prompt: string) {
const adapter = decartVideo("lucy-pro-t2v");

// Create the job
const { jobId } = await generateVideo({ adapter, prompt });
console.log("Job created:", jobId);

// Poll for completion
let status = "pending";
while (status !== "completed" && status !== "failed") {
await new Promise((resolve) => setTimeout(resolve, 5000));

const result = await getVideoJobStatus({ adapter, jobId });
status = result.status;
console.log(`Status: ${status}`);

if (result.status === "failed") {
throw new Error("Video generation failed");
}

if (result.status === "completed" && result.url) {
return result.url;
}
}
}

const videoUrl = await createVideo("A drone shot over a tropical beach");
```
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 28, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Handle the edge case where video completes without a URL.

The polling loop has a logic gap: if result.status === "completed" but result.url is falsy (line 151), the function won't return. On the next iteration, the while condition (line 140) will be false since status === "completed", causing the loop to exit without a return statement. The function will then return undefined.

🔎 Proposed fix to handle missing URL
     if (result.status === "failed") {
       throw new Error("Video generation failed");
     }

     if (result.status === "completed" && result.url) {
       return result.url;
     }
+
+    if (result.status === "completed") {
+      throw new Error("Video generation completed without a URL");
+    }
   }
 }
🤖 Prompt for AI Agents
In docs/community-adapters/decart.md around lines 125 to 158, the createVideo
polling loop can exit when status === "completed" but result.url is falsy,
leading to an implicit undefined return; fix by ensuring the function either
waits until a completed result includes a URL or throws a clear error: either
(A) change the loop condition to continue until status === "failed" or (status
=== "completed" && result.url) so it only exits when a URL is present or failure
occurs, or (B) leave the loop as-is but add an explicit check after the loop
that if status === "completed" and no url was returned, throw a descriptive
Error (e.g., "Video completed but no URL returned") to avoid returning
undefined.

Copy link
Author

Choose a reason for hiding this comment

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

Not sure it's needed? I'd prefer to keep the example focused, but happy to add it if you think it's useful.

Copy link
Contributor

Choose a reason for hiding this comment

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

@AdirAmsalem You're right—for documentation, keeping the example focused on the happy path is more valuable. The edge case handling would add noise to what's meant to be a clear, educational example. I'm good with leaving it as-is. 👍

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