diff options
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 6 | ||||
| -rw-r--r-- | README.md | 69 | ||||
| -rw-r--r-- | src/cli.rs | 38 |
4 files changed, 78 insertions, 37 deletions
@@ -28,7 +28,7 @@ dependencies = [ [[package]] name = "aichat" -version = "0.9.0-rc2" +version = "0.9.0-rc4" dependencies = [ "ansi_colours", "anyhow", @@ -1,14 +1,14 @@ [package] name = "aichat" -version = "0.9.0-rc2" +version = "0.9.0-rc4" edition = "2021" authors = ["sigoden <sigoden@gmail.com>"] -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" @@ -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 <MODEL> Choose a LLM model + -r, --role <ROLE> Choose a role + -s, --session [<SESSION>] Create or reuse a session + -H, --no-highlight Disable syntax highlighting + -S, --no-stream No stream output + -w, --wrap <WRAP> Specify the text-wrapping mode (no*, auto, <max-width>) + --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. @@ -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<String>, - /// List all available roles - #[clap(long)] - pub list_roles: bool, /// Choose a role #[clap(short, long)] pub role: Option<String>, - /// 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<Option<String>>, - /// Specify the text-wrapping mode (no*, auto, <max-width>) - #[clap(short = 'w', long)] - pub wrap: Option<String>, - /// 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, <max-width>) + #[clap(short = 'w', long)] + pub wrap: Option<String>, + /// 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<String>, } |
