Commit Graph
39 Commits
Author SHA1 Message Date
Dayuan Jiang 5b31216917 feat: cache example prompt responses to save tokens (#34)
- Add lib/cached-responses.ts with pre-generated XML for 4 example prompts
- Modify chat API route to check cache before calling AI
- Cache returns instant response (~0.26s) vs AI generation (~20-25s)
- Add "(cached for instant response)" text to example panel
- Cache only activates for first message with empty diagram
2025-12-01 14:07:50 +09:00
Dayuan Jiang c7d0260328 feat: add Bedrock prompt caching for system and conversation messages (#32)
* feat: add Bedrock prompt caching for system and conversation messages

- Add cache point to system message (2558+ tokens cached)
- Add cache point to last assistant message in conversation history
- This caches the entire conversation prefix for subsequent requests
- Reduces latency and costs for multi-turn conversations

* refactor: remove duplicated system prompt
2025-12-01 10:43:33 +09:00
Dayuan Jiang d2d4dd01cc fix: filter out messages with empty content arrays for Bedrock API (#31)
* fix: filter out messages with empty content arrays for Bedrock API

The convertToModelMessages function from AI SDK can produce messages with
empty content arrays when assistant messages have only tool call parts or
when tool results aren't properly converted. Bedrock API rejects these with
400 errors. This fix filters out invalid messages before sending to the API.

* fix: add diagnostic logging for empty message content

Added logging to capture the original UI message structure when empty content
is detected after conversion. This helps debug the root cause while the
filter provides a safety net for Bedrock API compatibility.
2025-12-01 01:15:43 +09:00
Dayuan Jiang b4679f6598 fix: increase maxDuration to 300s for Fluid Compute (#30) 2025-12-01 00:46:40 +09:00
Dayuan Jiang 0d0d553e23 fix: correct anthropic beta header config for fine-grained tool streaming (#27)
* fix: correct anthropic beta header config for fine-grained tool streaming

- Use bedrock.anthropicBeta for Bedrock provider (not additionalModelRequestFields)
- Use top-level headers for direct Anthropic API
- Update @ai-sdk/amazon-bedrock to 3.0.62
- Add headers support to ModelConfig interface

* fix: update @ai-sdk/amazon-bedrock to 3.0.62 for tool streaming support
2025-11-30 16:34:42 +09:00
dayuan.jiang 7a6a7eaf7c docs: Update examples with new prompts and demo images
- Add Examples section to README with 2-column grid layout
- Include demo images for GCP, AWS, Azure, animated connectors, and cat
- Update example panel buttons with clearer labels
- Add animated connector example button
- Add instruction for animated connectors in chat route
2025-11-17 15:12:16 +09:00
dayuan.jiang 4a3abc2e39 add multiple provider 2025-11-15 13:36:42 +09:00
dayuan.jiang 7b08c7332a feat: add automatic fallback from edit_diagram to display_diagram with 3-retry policy
- Updated system prompt to allow up to 3 retry attempts with adjusted search patterns
- Simplified error response to provide current diagram XML and reference retry policy
- AI model self-manages retries based on system instructions
2025-11-13 22:51:03 +09:00
dayuan.jiang 61aa0937d6 feat: add tool input streaminig 2025-11-10 19:45:59 +09:00
dayuan.jiang 6940a5156d refactor: improve diagram handling and error messaging in chat components 2025-11-10 11:27:25 +09:00
dayuan.jiang bd1c113bec minor: fix prompt 2025-11-10 09:12:30 +09:00
dayuan.jiang 4efbe78d5a fix: enhance permissions in settings and update .gitignore for local config 2025-11-10 00:00:02 +09:00
dayuan.jiang d8d0a800fe fix: update dependencies and add settings for npm permissions 2025-11-09 23:24:15 +09:00
dayuan.jiang de2a6938b1 feat: improve XML handling and edit_diagram tool
- Add formatXML function to format single-line XML with proper indentation
- Format chartXml after fetching to ensure consistency
- Update replaceXMLParts to handle single-line XML with substring fallback
- Improve edit_diagram tool guidance with SEARCH/REPLACE best practices
- Add concrete examples to help AI use minimal, targeted edits
2025-08-31 20:52:04 +09:00
dayuan.jiang b110f1cb63 change model back to gpt5 2025-08-31 12:59:29 +09:00
dayuan.jiang 44ec398f30 upgrade to ai-sdk 5 2025-08-31 12:54:14 +09:00
dayuan.jiang 1da5976235 update model to gpt-5 2025-08-19 01:17:17 +00:00
dayuan.jiang e36aedf2fd change the model back to gpt4.1 2025-07-31 22:01:24 +00:00
dayuan.jiang 7ffd48c215 change model 2025-07-31 08:14:43 +00:00
dayuan.jiang 6c641dbcf9 Feat: Add XML guide to prompt, update model and deps
- Integrate `xml_guide.md` into the system prompt to improve diagram generation by providing detailed XML formatting rules.
- Change the default AI model for chat completions to `openai("gpt-4.1")`.
- Update AI SDK packages (`@ai-sdk/amazon-bedrock`, `@ai-sdk/google`, `ai`) and other dependencies.
- Add `bun.lock` to the repository.
2025-05-22 00:44:24 +00:00
dayuan.jiang 78f2c4f60c fix: Integrate smoothStream and enhance chat message display with args handling 2025-04-04 02:10:24 +00:00
dayuan.jiang aeca1adf89 fix: Add maxDuration constant for chat API route 2025-04-04 01:48:15 +00:00
dayuan.jiang a44918385a fix: Enable tool call streaming in chat API route 2025-04-04 01:41:42 +00:00
dayuan.jiang 2d042af02b fix: Disable tool call streaming in chat API route 2025-04-04 01:28:50 +00:00
dayuan.jiang 8f3c11e0e8 fix: Enhance chat message display with chart handling and import new SDKs 2025-04-04 01:26:16 +00:00
dayuan.jiang 645980fbb6 change model to claud 3.5 2025-04-03 15:10:53 +00:00
dayuan.jiang 64bb9dd900 refactor: simplify enhancedMessages construction in chat route 2025-03-26 10:58:48 +00:00
dayuan.jiang bd6946a13c minor: fix the prompt 2025-03-25 10:56:08 +00:00
dayuan.jiang 5d152c66d5 fix: flash problem 2025-03-25 08:56:24 +00:00
dayuan.jiang d2a630929b refactor: chat-example-panel.tsx 2025-03-25 02:24:12 +00:00
dayuan.jiang 19dacfad30 fix: Corrected a bug where the current XML file was not attached to the user message. 2025-03-24 02:38:27 +00:00
dayuan.jiang 50dc4eda6d feat: enhance ChatPanel and ChatInput to support image file uploads and display 2025-03-23 11:03:25 +00:00
dayuan.jiang cfe3445a4f feat: enhance ChatPanel with tool call streaming and update diagram handling 2025-03-22 15:00:40 +00:00
dayuan.jiang fc4383dfb5 feat: update tool names and descriptions for diagram handling, add clear messages functionality in ChatInput 2025-03-22 14:28:55 +00:00
dayuan.jiang bb753c4140 feat: update system message to reflect diagram terminology and integrate OpenAI model 2025-03-19 12:02:07 +00:00
dayuan.jiang 7caaa358e4 feat: enhance chat functionality with XML guide integration and improved tool descriptions 2025-03-19 11:03:37 +00:00
dayuan.jiang 51ce74400d feat: add system message for flowchart assistance and improve message handling in chat API 2025-03-19 08:40:08 +00:00
dayuan.jiang 585c3bac1f feat: enhance chat functionality with flowchart tools integration and improved UI interactions 2025-03-19 08:16:44 +00:00
dayuan.jiang e26ef731e9 initialize project with Next.js, Tailwind CSS, and essential configurations 2025-03-19 06:04:06 +00:00