From 22031639382b4afebae2560f12c6e66ec44a2898 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 30 Oct 2023 17:09:53 +0800 Subject: chore: update readme and cli help --- Cargo.lock | 2 +- Cargo.toml | 6 +++--- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++------------- src/cli.rs | 38 +++++++++++++++++----------------- 4 files changed, 78 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4bddc8..38630e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,7 +28,7 @@ dependencies = [ [[package]] name = "aichat" -version = "0.9.0-rc2" +version = "0.9.0-rc4" dependencies = [ "ansi_colours", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 7380eff..6a2246b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "aichat" -version = "0.9.0-rc2" +version = "0.9.0-rc4" edition = "2021" authors = ["sigoden "] -description = "A powerful chatgpt/localai cli." +description = "Use ChatGPT, LocalAI and other LLMs in the terminal." license = "MIT OR Apache-2.0" homepage = "https://github.com/sigoden/aichat" repository = "https://github.com/sigoden/aichat" categories = ["command-line-utilities"] -keywords = ["chatgpt", "ai", "gpt", "repl"] +keywords = ["chatgpt", "localai", "gpt", "repl"] [dependencies] anyhow = "1.0.69" diff --git a/README.md b/README.md index 7999f09..19209e9 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,16 @@ Download it from [GitHub Releases](https://github.com/sigoden/aichat/releases), ## Features -- Supports multiple AIs, including openai and localai. +- Supports multiple LLMs, including OpenAI and LocalAI. - Support chat and command modes -- Use [roles](#roles) +- Use [Roles](#roles) - Powerful [Chat REPL](#chat-repl) - Context-aware conversation/session - Syntax highlighting markdown and 200 other languages - Stream output with hand-typing effect -- Support multiple models -- Support proxy connection +- Support proxy - Dark/light theme -- Save chat messages +- Save chat messages/sessions ## Config @@ -252,15 +251,6 @@ temp).exit session 〉 ``` -```sh -aichat --list-sessions # List sessions. -aichat -s # Start REPL with a new temp session -aichat -s temp # Use temp session -aichat -s temp --info # Show session details -aichat -r shell -s # Create a session with a role -aichat -m openai:gpt-4-32k -s # Create a session with a model -aichat -s sh unzip a file # Run session in command mode -``` ### `.set` - modify the configuration temporarily @@ -271,6 +261,57 @@ aichat -s sh unzip a file # Run session in command mode 〉.set save false ``` +## Command Line + +``` +Usage: aichat [OPTIONS] [TEXT]... + +Arguments: + [TEXT]... Input text + +Options: + -m, --model Choose a LLM model + -r, --role Choose a role + -s, --session [] Create or reuse a session + -H, --no-highlight Disable syntax highlighting + -S, --no-stream No stream output + -w, --wrap Specify the text-wrapping mode (no*, auto, ) + --light-theme Use light theme + --dry-run Run in dry run mode + --info Print related information + --list-models List all available models + --list-roles List all available roles + --list-sessions List all available sessions + -h, --help Print help + -V, --version Print version +``` + +Examples: + +```sh +aichat -s # Start REPL with a new temp session +aichat -s temp # Use temp session +aichat -r shell -s # Create a session with a role +aichat -m openai:gpt-4-32k -s # Create a session with a model +aichat -s sh unzip a file # Run session in command mode + +aichat --list-models # List all available models +aichat --list-roles # List all available roles +aichat --list-sessions # List all available models + +aichat --info # system-wide information +aichat -s temp --info # Show session details +aichat -r shell --info # Show role info + + +aichat -r shell unzip a file # Use role in command mode +aichat -s shell unzip a file # Use session in command mode + +cat config.json | aichat convert to yaml # Read stdin +cat config.json | aichat -r convert:yaml # Read stdin with a role +cat config.json | aichat -s i18n # Read stdin with a session +``` + ## License Copyright (c) 2023 aichat-developers. diff --git a/src/cli.rs b/src/cli.rs index ca4b4c2..0814110 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -3,42 +3,42 @@ use clap::Parser; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Cli { - /// List all available models - #[clap(long)] - pub list_models: bool, /// Choose a LLM model #[clap(short, long)] pub model: Option, - /// List all available roles - #[clap(long)] - pub list_roles: bool, /// Choose a role #[clap(short, long)] pub role: Option, - /// List all available sessions - #[clap(long)] - pub list_sessions: bool, - /// Initiate or reuse a session + /// Create or reuse a session #[clap(short = 's', long)] pub session: Option>, - /// Specify the text-wrapping mode (no*, auto, ) - #[clap(short = 'w', long)] - pub wrap: Option, - /// Print related information - #[clap(long)] - pub info: bool, - /// Use light theme - #[clap(long)] - pub light_theme: bool, /// Disable syntax highlighting #[clap(short = 'H', long)] pub no_highlight: bool, /// No stream output #[clap(short = 'S', long)] pub no_stream: bool, + /// Specify the text-wrapping mode (no*, auto, ) + #[clap(short = 'w', long)] + pub wrap: Option, + /// Use light theme + #[clap(long)] + pub light_theme: bool, /// Run in dry run mode #[clap(long)] pub dry_run: bool, + /// Print related information + #[clap(long)] + pub info: bool, + /// List all available models + #[clap(long)] + pub list_models: bool, + /// List all available roles + #[clap(long)] + pub list_roles: bool, + /// List all available sessions + #[clap(long)] + pub list_sessions: bool, /// Input text text: Vec, } -- cgit v1.2.3