diff --git a/src/commands.rs b/src/commands.rs deleted file mode 100644 index 79eb091..0000000 --- a/src/commands.rs +++ /dev/null @@ -1,19 +0,0 @@ -use color_eyre::Result; -use std::path::{Path, PathBuf}; - -#[derive(Clone, Debug)] -pub struct Root { - path: PathBuf, -} - -impl Root { - pub fn new(path: impl AsRef) -> Self { - Root { - path: path.as_ref().to_owned(), - } - } - - pub fn run_command(_cmd_string: impl AsRef) -> Result<()> { - todo!(); - } -} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..9387ccb --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,12 @@ +// Robotnik libraries + +pub mod chat; +pub mod event; +pub mod event_manager; +pub mod ipc; +pub mod qna; +pub mod setup; + +pub use event::Event; +pub use event_manager::EventManager; +pub use qna::LLMHandle; diff --git a/src/main.rs b/src/main.rs index dd8e281..6e48412 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,13 +4,7 @@ use std::{os::unix::fs, sync::Arc}; use tracing::{Level, info}; use tracing_subscriber::FmtSubscriber; -use crate::event_manager::EventManager; - -mod chat; -mod event; -mod event_manager; -mod qna; -mod setup; +use robotnik::{chat, Event, EventManager, qna, setup}; const DEFAULT_INSTRUCT: &str = "You are a shady, yet helpful IRC bot. You try to give responses that can @@ -67,7 +61,7 @@ async fn main() -> Result<()> { let ev_manager = Arc::new(EventManager::new()?); let ev_manager_clone = Arc::clone(&ev_manager); ev_manager_clone - .broadcast(&event::Event::new("Starting...")) + .broadcast(&Event::new("Starting...")) .await?; let mut c = chat::new(&config, &handle).await?; diff --git a/src/setup.rs b/src/setup.rs index 63a4374..7fb4205 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -8,65 +8,65 @@ use tracing::{info, instrument}; // TODO: use [clap(long, short, help_heading = Some(section))] #[derive(Clone, Debug, Parser)] #[command(about, version)] -pub(crate) struct Args { +pub struct Args { #[arg(short, long)] /// API Key for the LLM in use. - pub(crate) api_key: Option, + pub api_key: Option, #[arg(short, long, default_value = "https://api.openai.com")] /// Base URL for the LLM API to use. - pub(crate) base_url: Option, + pub base_url: Option, /// Directory to use for chroot (recommended). #[arg(long)] - pub(crate) chroot_dir: Option, + pub chroot_dir: Option, /// Root directory for file based command structure. #[arg(long)] - pub(crate) command_dir: Option, + pub command_dir: Option, #[arg(long)] /// Instructions to the model on how to behave. - pub(crate) instruct: Option, + pub instruct: Option, #[arg(long)] - pub(crate) model: Option, + pub model: Option, #[arg(long)] /// List of IRC channels to join. - pub(crate) channels: Option>, + pub channels: Option>, #[arg(short, long)] /// Custom configuration file location if need be. - pub(crate) config_file: Option, + pub config_file: Option, #[arg(short, long, default_value = "irc.libera.chat")] /// IRC server. - pub(crate) server: Option, + pub server: Option, #[arg(short, long, default_value = "6697")] /// Port of the IRC server. - pub(crate) port: Option, + pub port: Option, #[arg(long)] /// IRC Nickname. - pub(crate) nickname: Option, + pub nickname: Option, #[arg(long)] /// IRC Nick Password - pub(crate) nick_password: Option, + pub nick_password: Option, #[arg(long)] /// IRC Username - pub(crate) username: Option, + pub username: Option, #[arg(long)] /// Whether or not to use TLS when connecting to the IRC server. - pub(crate) use_tls: Option, + pub use_tls: Option, } -pub(crate) struct Setup { - pub(crate) config: Config, +pub struct Setup { + pub config: Config, } #[instrument]