diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-05-06 18:04:53 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-05-06 18:04:53 -0500 |
commit | 569c9a18a34793f46ed0d11e92b4f9c1848aa6ba (patch) | |
tree | 7dfa44f2d067903369d55de7c0fa7de92a871cdd | |
parent | 1604a734dd7498775de7b64ccde971b1e364cd7e (diff) | |
download | gpt-chat-cli-569c9a18a34793f46ed0d11e92b4f9c1848aa6ba.tar.xz gpt-chat-cli-569c9a18a34793f46ed0d11e92b4f9c1848aa6ba.zip |
Add more tricks
-rw-r--r-- | README.md | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -208,6 +208,56 @@ sorting an array of pointers to `dl_entry` structures based on the `access_time` [#] ``` +Create a bash alias for a particular model: + +``` +$ alias gpt3='gpt-chat-cli -m gpt-3.5-turbo' +$ gpt3 +[#] ... +``` + +Of course, custom scripting can extend the capabilities. For example, this `bash` function will suggest commands to accomplish tasks on the command line: + +```bash +function cmd { + local request="$1" + local shell=$(basename "${SHELL}") + + local os="" + + if command -v lsb_release >/dev/null 2>&1; then + os="$ lsb_release -a\n$(lsb_release -a)\n" + fi + + local kernel="" + + if command -v uname >/dev/null 2>&1; then + kernel="$ uname -s -r\n$(uname -s -r)\n" + fi + + local prompt="" + + prompt="${prompt}Suggest a command to be run in the $shell to accomplish the following task:\n" + prompt="${prompt}$request\n" + prompt="${prompt}Please output the command and a short description\n" + + if [ -n "${os}" ] || [ -n "${kernel}" ]; then + prompt="${prompt}Here is some additional info about the system:${os}${kernel}" + fi + + printf "$prompt" | gpt-chat-cli +} +``` + +``` +$ cmd "test if ip forwarding is enabled" +[gpt-3.5-turbo-0301] You can use the `sysctl` command to test if IP forwarding is enabled. Here's the command you can run in your zsh shell: + +sysctl net.ipv4.ip_forward + +This command will return `net.ipv4.ip_forward = 0` if IP forwarding is disabled and `net.ipv4.ip_forward = 1` if IP forwarding is enabled. +``` + #### Known Issues There are a couple known issues. PRs are accepted: |