velo icon indicating copy to clipboard operation
velo copied to clipboard

ChatGPT integration 🤖

Open Dimchikkk opened this issue 2 years ago • 0 comments

Steps to be taken to integrate ChatGPT to velo (in the simplest way for milestone 1 of this feature):

  • [ ] create simple velo DSL:
create_note <NOTE_HUMAN_READABLE_ID> <NOTE_TYPE> <TEXT> <NOTE_STYLE>
connect_note <NOTE_HUMAN_READABLE_ID_1> <NOTE_HUMAN_READABLE_ID_2> <ARROW_STYLE>

NOTE_HUMAN_READABLE_ID | "A"
NOTE_TYPE | rect, circle, paperlike
TEXT | "hello \n world"
NOTE_STYLE | { bg_color: "red", size: (100, 100) }
ARROW_STYLE | { arrow_type: "two head", color: "blue" }
  • [ ] use parser combinator library (e.g. https://crates.io/crates/nom) to parse velo DSL and translate it to VisualGraph calls (see https://docs.rs/layout-rs/0.1.1/layout/index.html#graph-builder-example-create-a-new-graph)

  • [ ] implement render backend: https://docs.rs/layout-rs/0.1.1/layout/core/format/trait.RenderBackend.html

pub trait RenderBackend {
    fn draw_rect(
        &mut self,
        xy: Point,
        size: Point,
        look: &StyleAttr,
        clip: Option<ClipHandle>
    );
    fn draw_line(&mut self, start: Point, stop: Point, look: &StyleAttr);
    fn draw_circle(&mut self, xy: Point, size: Point, look: &StyleAttr);
    fn draw_text(&mut self, xy: Point, text: &str, look: &StyleAttr);
    fn draw_arrow(
        &mut self,
        path: &[(Point, Point)],
        dashed: bool,
        head: (bool, bool),
        look: &StyleAttr,
        text: &str
    );
    fn create_clip(
        &mut self,
        xy: Point,
        size: Point,
        rounded_px: usize
    ) -> ClipHandle;
}

pub struct StyleAttr {
    pub line_color: Color,
    pub line_width: usize,
    pub fill_color: Option<Color>,
    pub rounded: usize,
    pub font_size: usize,
}
  • [ ] add "magic" button that explains selected note or breaks down tasks on subtask if note text starts from "TODO". It should insert explanations/sub-tasks as leaves of the note, ChatGPT should use velo DSL for that

Dimchikkk avatar Jun 30 '23 15:06 Dimchikkk