Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions graphics-editor/src/textInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,24 @@ export async function handleTextCommand(command) {
{
role: 'system',
content: `You are a graphics editor command interpreter. Convert natural language commands into structured JSON actions.
The canvas dimensions are: width=${canvas.width}px, height=${canvas.height}px.

Available actions and their parameters:
- addText: {text, x, y, color, fontSize, fontFamily}
- x and y should be within canvas bounds (0 to ${canvas.width} for x, 0 to ${canvas.height} for y)
- if x/y not specified, center the element (x=${canvas.width/2}, y=${canvas.height/2})
- addShape: {type: "rectangle"|"circle", x, y, width, height, color}
- x and y should be within canvas bounds (0 to ${canvas.width} for x, 0 to ${canvas.height} for y)
- width and height should fit within remaining canvas space
- addImage: {url, x, y, width, height}
- x and y should be within canvas bounds (0 to ${canvas.width} for x, 0 to ${canvas.height} for y)
- width and height should fit within remaining canvas space
- select: {id}
- move: {x, y}
- x and y should be within canvas bounds (0 to ${canvas.width} for x, 0 to ${canvas.height} for y)
- resize: {width, height}
- width should not exceed ${canvas.width}px
- height should not exceed ${canvas.height}px
- changeStyle: {color?, fontSize?, fontFamily?}
- layer: {action: "forward"|"backward"}
- export: {}
Expand Down