mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-01 16:08:30 +00:00
Setting up aichatbot-sidecar desktop program
This commit is contained in:
1 parent
02d7495e54
commit
7ba765b89c
17 files changed
+1775
-53
No files matched your search
Generated
+1
@@ -6,6 +6,7 @@
|
||||
<w>cashapp</w>
|
||||
<w>cheermote</w>
|
||||
<w>crockford</w>
|
||||
<w>culted</w>
|
||||
<w>downvote</w>
|
||||
<w>fakeyou</w>
|
||||
<w>ffprobe</w>
|
||||
|
||||
Generated
+1593
-52
File diff suppressed because it is too large.
Load diff
@@ -33,6 +33,9 @@ members = [
|
||||
"crates/lib/url_config",
|
||||
"crates/lib/user_input_common",
|
||||
|
||||
# Programs: Desktop apps
|
||||
"crates/programs/aichatbot-sidecar",
|
||||
|
||||
# Services: API servers, jobs, workers, etc.
|
||||
"crates/service/job/analytics_job",
|
||||
"crates/service/job/download_job",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
[package]
|
||||
name = "aichatbot-sidecar"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
version = "0.0.1"
|
||||
authors = [
|
||||
"Brandon Thomas <bt@brand.io>",
|
||||
"Brandon Thomas <echelon@gmail.com>",
|
||||
]
|
||||
|
||||
[[bin]]
|
||||
name = "aichatbot-sidecar"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
|
||||
# Internal
|
||||
errors = { path = "../../lib/errors" }
|
||||
|
||||
# External
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
easyenv = "0.0.6"
|
||||
log = "0.4.14"
|
||||
|
||||
# Async Runtime
|
||||
tokio = { version = "1.6.0", features = ["macros"] }
|
||||
|
||||
# Gui
|
||||
eframe = "0.20.1"
|
||||
egui = "0.20.1"
|
||||
|
||||
# Web
|
||||
actix-cors = "0.6.0-beta.3"
|
||||
actix-files= "0.6.0-beta.8"
|
||||
actix-http = "3.0.0-beta.11"
|
||||
actix-multipart = "0.4.0-beta.7"
|
||||
actix-rt = "2.4.0"
|
||||
actix-service = "2.0.1"
|
||||
actix-utils = "3.0.0"
|
||||
actix-web = "4.0.0-beta.10"
|
||||
actix-web-actors = "4.0.0-beta.7"
|
||||
@@ -0,0 +1,20 @@
|
||||
aichatbot-sidecar
|
||||
=================
|
||||
|
||||
Sidecar companion to AiChatBot.
|
||||
|
||||
### Installation on Linux
|
||||
|
||||
The egui/eframe libraries require the installation of a metric ton of dependencies, so have at it:
|
||||
|
||||
```
|
||||
sudo apt-get install \
|
||||
cmake \
|
||||
libfontconfig1-dev \
|
||||
libspeechd-dev \
|
||||
libssl-dev \
|
||||
libxcb-render0-dev \
|
||||
libxcb-shape0-dev \
|
||||
libxcb-xfixes0-dev \
|
||||
libxkbcommon-dev
|
||||
```
|
||||
@@ -0,0 +1,34 @@
|
||||
use eframe::egui;
|
||||
|
||||
pub struct AppGui {
|
||||
filename: String,
|
||||
default_directory: String,
|
||||
}
|
||||
|
||||
impl Default for AppGui {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
filename: "".to_string(),
|
||||
default_directory: "".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl eframe::App for AppGui {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("AiChatBot Sidecar");
|
||||
ui.horizontal(|ui| {
|
||||
let name_label = ui.label("Filename: ");
|
||||
ui.text_edit_singleline(&mut self.filename)
|
||||
.labelled_by(name_label.id);
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
let name_label = ui.label("Default directory: ");
|
||||
ui.text_edit_singleline(&mut self.default_directory)
|
||||
.labelled_by(name_label.id);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
use crate::gui::gui::AppGui;
|
||||
use eframe::egui;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
pub fn launch_gui() -> AnyhowResult<()> {
|
||||
// Log to stdout (if you run with `RUST_LOG=debug`).
|
||||
//tracing_subscriber::fmt::init();
|
||||
|
||||
let options = eframe::NativeOptions {
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = eframe::run_native(
|
||||
"AiChatBot Sidecar",
|
||||
options,
|
||||
Box::new(|_cc| Box::new(AppGui::default())),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod gui;
|
||||
pub mod launch_gui;
|
||||
Whitespace-only changes.
@@ -0,0 +1,44 @@
|
||||
// NB: The following windows directive is cargo-culted from:
|
||||
// https://github.com/emilk/egui/blob/master/examples/hello_world/src/main.rs
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
|
||||
pub mod gui;
|
||||
pub mod jobs;
|
||||
pub mod main_loop;
|
||||
pub mod state;
|
||||
pub mod web_server;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use crate::main_loop::main_loop;
|
||||
use errors::AnyhowResult;
|
||||
use log::info;
|
||||
use crate::gui::launch_gui::launch_gui;
|
||||
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() -> AnyhowResult<()> {
|
||||
easyenv::init_all_with_default_logging(Some("info"));
|
||||
|
||||
//let matches = App::new("aichatbot-sidecar")
|
||||
// .arg(Arg::with_name("file")
|
||||
// .short("f")
|
||||
// .long("file")
|
||||
// .value_name("FILE")
|
||||
// .help("Packet file to read")
|
||||
// .takes_value(true))
|
||||
// .arg(Arg::with_name("host")
|
||||
// .short("h")
|
||||
// .long("host")
|
||||
// .value_name("HOST")
|
||||
// .help("Host and port to send traffic to")
|
||||
// .takes_value(true))
|
||||
// .get_matches();
|
||||
|
||||
info!("starting main loop...");
|
||||
|
||||
let _r = launch_gui()?;
|
||||
|
||||
let _r = main_loop().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
use errors::AnyhowResult;
|
||||
use log::info;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
pub async fn main_loop() -> AnyhowResult<()> {
|
||||
loop {
|
||||
info!("iter");
|
||||
thread::sleep(Duration::from_millis(5000));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,2 @@
|
||||
pub mod server_state;
|
||||
pub mod job_state;
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
pub mod get_next_audio_file_handler;
|
||||
@@ -114,7 +114,6 @@ rust-s3 = { version = "0.32.3" }
|
||||
subprocess = "0.2.6"
|
||||
tempdir = "0.3.7"
|
||||
|
||||
#actix = "0.12.0"
|
||||
actix-cors = "0.6.0-beta.3"
|
||||
actix-files= "0.6.0-beta.8"
|
||||
actix-http = "3.0.0-beta.11"
|
||||
|
||||
Reference in new issue
Block a user