Skip to content

feat: integrate Gemini AI smart flowchart generator#33

Open
Babin123456 wants to merge 1 commit into
itzzavdhesh:mainfrom
Babin123456:feat/gemini-ai-flow-generator
Open

feat: integrate Gemini AI smart flowchart generator#33
Babin123456 wants to merge 1 commit into
itzzavdhesh:mainfrom
Babin123456:feat/gemini-ai-flow-generator

Conversation

@Babin123456

@Babin123456 Babin123456 commented Jun 27, 2026

Copy link
Copy Markdown

Related Issue

Closes #22

Summary

This PR implements the Google Gemini AI smart flowchart generator inside the Left Sidebar panel.

Changes Made

  • Passed setBlocks down to LeftSidebar via onSetBlocks.
  • Imported GoogleGenAI and configured it using gemini-2.5-flash with system instructions requesting a structured Block[] JSON output.
  • Created local state variables for prompts, API key, API key input toggling, and loaders.
  • Embedded "AI Flowcraft Generator" UI form into the Left Sidebar.
  • Added client-side localStorage fallback cache for API key storage.

Testing

  • Tested locally by entering prompts such as "Customer support pipeline with database check and agent handoff".
  • Verified valid JSON parsing and successful flowchart canvas layout calculation.

Screenshots

N/A

Impact

Enables the core AI feature of the application, improving user productivity.

Checklist

  • Code follows project standards
  • Tested locally
  • No unrelated changes included
  • Responsive design verified
  • Accessibility considered

Summary by cubic

Integrates a Gemini-powered flowchart generator into the Left Sidebar so users can create flowcharts from a text prompt. Wires generated Block[] directly into the canvas for a faster start.

  • New Features

    • Adds “AI Flowcraft Generator” form in the Left Sidebar.
    • Uses @google/genai with gemini-2.5-flash to return a structured Block[] JSON.
    • Introduces onSetBlocks prop to push generated blocks to the canvas.
    • Local key handling: reads from env, optional UI input, and localStorage cache.
    • Loading state and basic error handling for invalid JSON.
  • Migration

    • Provide a Gemini API key via env (VITE_GEMINI_API_KEY) or set it in the sidebar form.
    • No other changes required.

Written for commit eb8f8fa. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the itzzavdhesh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

✅ Thanks! This PR is linked to #22 and will close it automatically when merged.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Babin123456, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 7 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: de65206c-4a35-4d33-807f-c92e1e0e5e8b

📥 Commits

Reviewing files that changed from the base of the PR and between 22009dd and eb8f8fa.

📒 Files selected for processing (2)
  • src/App.tsx
  • src/components/LeftSidebar.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added ELUSOC enhancement New feature or request VETERAN labels Jun 27, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/App.tsx">

<violation number="1" location="src/App.tsx:242">
P2: Passing raw `setBlocks` to `LeftSidebar` can leave stale `selectedBlockId`/`activeParentId` after AI-generated block replacement</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/App.tsx
onDeleteBlock={handleDeleteBlock}
activeParentId={activeParentId}
onCancelActiveParent={() => setActiveParentId(null)}
onSetBlocks={setBlocks}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Passing raw setBlocks to LeftSidebar can leave stale selectedBlockId/activeParentId after AI-generated block replacement

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/App.tsx, line 242:

<comment>Passing raw `setBlocks` to `LeftSidebar` can leave stale `selectedBlockId`/`activeParentId` after AI-generated block replacement</comment>

<file context>
@@ -239,6 +239,7 @@ export default function App() {
         onDeleteBlock={handleDeleteBlock}
         activeParentId={activeParentId}
         onCancelActiveParent={() => setActiveParentId(null)}
+        onSetBlocks={setBlocks}
       />
 
</file context>

@github-actions

Copy link
Copy Markdown

This pull request has been inactive for 14 days. Push a commit or comment if you're still working on it, otherwise it'll be closed in 7 days.

@github-actions github-actions Bot added the stale label Jul 12, 2026
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.

[FEATURE] [ELUSoC_2026] Integrate Gemini AI to Auto-Generate Flowcharts

1 participant