Skip to content

Conversation

@DayuanJiang
Copy link
Owner

Summary

  • Add client-side cache check in onFormSubmit to bypass API calls for example prompts
  • Use findCachedResponse to match input against cached examples when messages.length === 0
  • Directly set messages with cached tool response when example matches
  • Hide regenerate button for cached example responses (toolCallId starts with cached-)

Why

Previously, clicking an example button and pressing send would:

  1. Make an API call to the server
  2. Server-side cache check would fail if diagram XML wasn't empty
  3. AI would generate a text plan instead of using cached XML

Now, the cache check happens entirely on the client side, bypassing the API completely for matching examples.

- Add client-side cache check in onFormSubmit to bypass API calls for example prompts
- Use findCachedResponse to match input against cached examples
- Directly set messages with cached tool response when example matches
- Hide regenerate button for cached example responses (toolCallId starts with 'cached-')
- Prevents unnecessary API calls when using example buttons
@vercel
Copy link

vercel bot commented Dec 7, 2025

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

Project Deployment Preview Comments Updated (UTC)
next-ai-draw-io Ready Ready Preview Comment Dec 7, 2025 10:36am

@DayuanJiang DayuanJiang merged commit 86420a4 into main Dec 7, 2025
4 checks passed
@DayuanJiang DayuanJiang deleted the fix/client-side-example-cache branch December 7, 2025 10:36
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.

2 participants