From 5ccbf51f6e0c2ba2ec2ef065bc25b487cb8d831c Mon Sep 17 00:00:00 2001 From: Oliver Koch Date: Sun, 1 Sep 2024 18:08:56 +0200 Subject: [PATCH 1/3] Update versions and new default for configs --- Cargo.lock | 2 +- Cargo.toml | 18 +++++++++--------- src/config/mod.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26e2a25..7ce1eb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -692,7 +692,7 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "mangpt" -version = "0.1.0" +version = "0.2.0" dependencies = [ "async-openai", "clap", diff --git a/Cargo.toml b/Cargo.toml index eed1f3a..9e9e3a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mangpt" -version = "0.1.0" +version = "0.2.0" description = "CLI program to ask ChatGPT how to use other CLI programs" authors = ["Oliver Koch "] repository = "https://github.com/oltoko/mangpt" @@ -12,11 +12,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -async-openai = "0.17.1" -clap = { version = "4.4.12", features = ["derive"] } -dirs = "5.0.1" -futures = "0.3.30" -rpassword = "7.3.1" -serde = { version = "1.0.193", features = ["derive"] } -serde_yaml = "0.9.29" -tokio = { version = "1.35.1", features = ["full"] } +async-openai = "0.17" +clap = { version = "4.4", features = ["derive"] } +dirs = "5.0" +futures = "0.3" +rpassword = "7.3" +serde = { version = "1.0", features = ["derive"] } +serde_yaml = "0.9" +tokio = { version = "1.35", features = ["full"] } diff --git a/src/config/mod.rs b/src/config/mod.rs index 11c3830..497b191 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -10,8 +10,8 @@ pub struct ManGPTConfig { } const FILE_NAME: &str = "mangpt-config.yml"; -const DEFAULT_MODEL: &str = "gpt-4"; -const DEFAULT_MAX_TOKENS: u16 = 512u16; +const DEFAULT_MODEL: &str = "gpt-4o-mini"; +const DEFAULT_MAX_TOKENS: u16 = 1024u16; pub fn load() -> Result> { let config_dir = dirs::config_local_dir().ok_or("Can't find config directory")?; From 13f4b517de6757d494ee3dbfd15d9b2f38e33cf1 Mon Sep 17 00:00:00 2001 From: Oliver Koch Date: Sun, 1 Sep 2024 18:12:31 +0200 Subject: [PATCH 2/3] add hint where to create an API Key --- src/config/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/mod.rs b/src/config/mod.rs index 497b191..15c3095 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -30,6 +30,7 @@ pub fn load() -> Result> { fn create_config_file( config_file_path: &std::path::PathBuf, ) -> Result<(), Box> { + println!("You can create an OpenAI API-Key in your account https://platform.openai.com/api-keys"); let api_key = rpassword::prompt_password("Please Enter your OpenAI API-Key: ")?; let config = ManGPTConfig { From 25e23bc2d9dcc5194383c43ce33f2909883b29c1 Mon Sep 17 00:00:00 2001 From: Oliver Koch Date: Sun, 1 Sep 2024 18:13:56 +0200 Subject: [PATCH 3/3] fix formatting --- src/config/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 15c3095..71555e6 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -30,7 +30,9 @@ pub fn load() -> Result> { fn create_config_file( config_file_path: &std::path::PathBuf, ) -> Result<(), Box> { - println!("You can create an OpenAI API-Key in your account https://platform.openai.com/api-keys"); + println!( + "You can create an OpenAI API-Key in your account https://platform.openai.com/api-keys" + ); let api_key = rpassword::prompt_password("Please Enter your OpenAI API-Key: ")?; let config = ManGPTConfig {