auto_gpt_local/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pub mod configuration;

use configuration::config;

#[tauri::command]
fn set_working_dir(name: &str) {
    dbg!(name);
    let _ = config::change_working_dir(name);
}

#[tauri::command]
fn get_configuration() -> String {
    let settings = config::get_configuration().expect("Failed to read configuration file");
    format!("{}", settings.directory.working_dir)
}

#[tauri::command]
fn get_system_prompt() -> String {
    config::get_system_prompt().expect("Failed to read system prompt")
}

pub fn start_tauri() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![
            set_working_dir,
            get_configuration,
            get_system_prompt
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}