Dimchikkk / velo

App for brainstorming & sharing ideas 🦀 Learning Project
Apache License 2.0
320 stars 27 forks source link

ChatGPT integration 🤖 #183

Open Dimchikkk opened 1 year ago

Dimchikkk commented 1 year ago

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

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" }
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,
}