fix: ChatBubble crash and DeepSeek API compatibility
- Fix ChatBubble to handle non-string content with String() wrapper - Fix API route to use generateText for non-streaming requests - Add @ai-sdk/openai-compatible for non-OpenAI providers (DeepSeek, etc.) - Use Chat Completions API instead of Responses API for compatible providers - Update ChatBubble tests and fix component exports to kebab-case - Remove stale PascalCase ChatBubble.tsx file
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# Create Diagram - Validation Checklist
|
||||
|
||||
## Element Structure
|
||||
|
||||
- [ ] All components with labels have matching `groupIds`
|
||||
- [ ] All text elements have `containerId` pointing to parent component
|
||||
- [ ] Text width calculated properly (no cutoff)
|
||||
- [ ] Text alignment appropriate for diagram type
|
||||
|
||||
## Layout and Alignment
|
||||
|
||||
- [ ] All elements snapped to 20px grid
|
||||
- [ ] Component spacing consistent (40px/60px)
|
||||
- [ ] Hierarchical alignment maintained
|
||||
- [ ] No overlapping elements
|
||||
|
||||
## Connections
|
||||
|
||||
- [ ] All arrows have `startBinding` and `endBinding`
|
||||
- [ ] `boundElements` array updated on connected components
|
||||
- [ ] Arrow routing avoids overlaps
|
||||
- [ ] Relationship types clearly indicated
|
||||
|
||||
## Notation and Standards
|
||||
|
||||
- [ ] Follows specified notation standard (UML/ERD/etc)
|
||||
- [ ] Symbols used correctly
|
||||
- [ ] Cardinality/multiplicity shown where needed
|
||||
- [ ] Labels and annotations clear
|
||||
|
||||
## Theme and Styling
|
||||
|
||||
- [ ] Theme colors applied consistently
|
||||
- [ ] Component types visually distinguishable
|
||||
- [ ] Text is readable
|
||||
- [ ] Professional appearance
|
||||
|
||||
## Output Quality
|
||||
|
||||
- [ ] Element count under 80
|
||||
- [ ] No elements with `isDeleted: true`
|
||||
- [ ] JSON is valid
|
||||
- [ ] File saved to correct location
|
||||
@@ -0,0 +1,141 @@
|
||||
# Create Diagram - Workflow Instructions
|
||||
|
||||
```xml
|
||||
<critical>The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml</critical>
|
||||
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
|
||||
<critical>This workflow creates system architecture diagrams, ERDs, UML diagrams, or general technical diagrams in Excalidraw format.</critical>
|
||||
|
||||
<workflow>
|
||||
|
||||
<step n="0" goal="Contextual Analysis">
|
||||
<action>Review user's request and extract: diagram type, components/entities, relationships, notation preferences</action>
|
||||
<check if="ALL requirements clear"><action>Skip to Step 5</action></check>
|
||||
<check if="SOME requirements clear"><action>Only ask about missing info in Steps 1-2</action></check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Identify Diagram Type" elicit="true">
|
||||
<action>Ask: "What type of technical diagram do you need?"</action>
|
||||
<action>Present options:
|
||||
1. System Architecture
|
||||
2. Entity-Relationship Diagram (ERD)
|
||||
3. UML Class Diagram
|
||||
4. UML Sequence Diagram
|
||||
5. UML Use Case Diagram
|
||||
6. Network Diagram
|
||||
7. Other
|
||||
</action>
|
||||
<action>WAIT for selection</action>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Gather Requirements" elicit="true">
|
||||
<action>Ask: "Describe the components/entities and their relationships"</action>
|
||||
<action>Ask: "What notation standard? (Standard/Simplified/Strict UML-ERD)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Summarize what will be included and confirm with user</action>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Check for Existing Theme" elicit="true">
|
||||
<action>Check if theme.json exists at output location</action>
|
||||
<check if="exists"><action>Ask to use it, load if yes, else proceed to Step 4</action></check>
|
||||
<check if="not exists"><action>Proceed to Step 4</action></check>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Create Theme" elicit="true">
|
||||
<action>Ask: "Choose a color scheme for your diagram:"</action>
|
||||
<action>Present numbered options:
|
||||
1. Professional
|
||||
- Component: #e3f2fd (light blue)
|
||||
- Database: #e8f5e9 (light green)
|
||||
- Service: #fff3e0 (light orange)
|
||||
- Border: #1976d2 (blue)
|
||||
|
||||
2. Colorful
|
||||
- Component: #e1bee7 (light purple)
|
||||
- Database: #c5e1a5 (light lime)
|
||||
- Service: #ffccbc (light coral)
|
||||
- Border: #7b1fa2 (purple)
|
||||
|
||||
3. Minimal
|
||||
- Component: #f5f5f5 (light gray)
|
||||
- Database: #eeeeee (gray)
|
||||
- Service: #e0e0e0 (medium gray)
|
||||
- Border: #616161 (dark gray)
|
||||
|
||||
4. Custom - Define your own colors
|
||||
</action>
|
||||
<action>WAIT for selection</action>
|
||||
<action>Create theme.json based on selection</action>
|
||||
<action>Show preview and confirm</action>
|
||||
</step>
|
||||
|
||||
<step n="5" goal="Plan Diagram Structure">
|
||||
<action>List all components/entities</action>
|
||||
<action>Map all relationships</action>
|
||||
<action>Show planned layout</action>
|
||||
<action>Ask: "Structure looks correct? (yes/no)"</action>
|
||||
<check if="no"><action>Adjust and repeat</action></check>
|
||||
</step>
|
||||
|
||||
<step n="6" goal="Load Resources">
|
||||
<action>Load {{templates}} and extract `diagram` section</action>
|
||||
<action>Load {{library}}</action>
|
||||
<action>Load theme.json and merge with template</action>
|
||||
<action>Load {{helpers}} for guidelines</action>
|
||||
</step>
|
||||
|
||||
<step n="7" goal="Build Diagram Elements">
|
||||
<critical>Follow {{helpers}} for proper element creation</critical>
|
||||
|
||||
<substep>For Each Component:
|
||||
- Generate unique IDs (component-id, text-id, group-id)
|
||||
- Create shape with groupIds
|
||||
- Calculate text width
|
||||
- Create text with containerId and matching groupIds
|
||||
- Add boundElements
|
||||
</substep>
|
||||
|
||||
<substep>For Each Connection:
|
||||
- Determine arrow type (straight/elbow)
|
||||
- Create with startBinding and endBinding
|
||||
- Update boundElements on both components
|
||||
</substep>
|
||||
|
||||
<substep>Build Order by Type:
|
||||
- Architecture: Services → Databases → Connections → Labels
|
||||
- ERD: Entities → Attributes → Relationships → Cardinality
|
||||
- UML Class: Classes → Attributes → Methods → Relationships
|
||||
- UML Sequence: Actors → Lifelines → Messages → Returns
|
||||
- UML Use Case: Actors → Use Cases → Relationships
|
||||
</substep>
|
||||
|
||||
<substep>Alignment:
|
||||
- Snap to 20px grid
|
||||
- Space: 40px between components, 60px between sections
|
||||
</substep>
|
||||
</step>
|
||||
|
||||
<step n="8" goal="Optimize and Save">
|
||||
<action>Strip unused elements and elements with isDeleted: true</action>
|
||||
<action>Save to {{default_output_file}}</action>
|
||||
</step>
|
||||
|
||||
<step n="9" goal="Validate JSON Syntax">
|
||||
<critical>NEVER delete the file if validation fails - always fix syntax errors</critical>
|
||||
<action>Run: node -e "JSON.parse(require('fs').readFileSync('{{default_output_file}}', 'utf8')); console.log('✓ Valid JSON')"</action>
|
||||
<check if="validation fails (exit code 1)">
|
||||
<action>Read the error message carefully - it shows the syntax error and position</action>
|
||||
<action>Open the file and navigate to the error location</action>
|
||||
<action>Fix the syntax error (add missing comma, bracket, or quote as indicated)</action>
|
||||
<action>Save the file</action>
|
||||
<action>Re-run validation with the same command</action>
|
||||
<action>Repeat until validation passes</action>
|
||||
</check>
|
||||
<action>Once validation passes, confirm: "Diagram created at {{default_output_file}}. Open to view?"</action>
|
||||
</step>
|
||||
|
||||
<step n="10" goal="Validate Content">
|
||||
<invoke-task>Validate against {{validation}} using {_bmad}/core/tasks/validate-workflow.xml</invoke-task>
|
||||
</step>
|
||||
|
||||
</workflow>
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
name: create-excalidraw-diagram
|
||||
description: "Create system architecture diagrams, ERDs, UML diagrams, or general technical diagrams in Excalidraw format"
|
||||
author: "BMad"
|
||||
|
||||
# Config values
|
||||
config_source: "{project-root}/_bmad/bmm/config.yaml"
|
||||
output_folder: "{config_source}:output_folder"
|
||||
|
||||
# Workflow components
|
||||
installed_path: "{project-root}/_bmad/bmm/workflows/excalidraw-diagrams/create-diagram"
|
||||
shared_path: "{project-root}/_bmad/bmm/workflows/excalidraw-diagrams/_shared"
|
||||
instructions: "{installed_path}/instructions.md"
|
||||
validation: "{installed_path}/checklist.md"
|
||||
|
||||
# Core Excalidraw resources (universal knowledge)
|
||||
helpers: "{project-root}/_bmad/core/resources/excalidraw/excalidraw-helpers.md"
|
||||
json_validation: "{project-root}/_bmad/core/resources/excalidraw/validate-json-instructions.md"
|
||||
|
||||
# Domain-specific resources (technical diagrams)
|
||||
templates: "{shared_path}/excalidraw-templates.yaml"
|
||||
library: "{shared_path}/excalidraw-library.json"
|
||||
|
||||
# Output file (respects user's configured output_folder)
|
||||
default_output_file: "{output_folder}/excalidraw-diagrams/diagram-{timestamp}.excalidraw"
|
||||
|
||||
standalone: true
|
||||
Reference in New Issue
Block a user