diff --git a/README.md b/README.md index 59f45fe4..31770042 100644 --- a/README.md +++ b/README.md @@ -453,21 +453,16 @@ Possible options for `CODE_THEME`: https://pygments.org/styles/ ``` ## Docker -Run the container using the `OPENAI_API_KEY` environment variable, and a docker volume to store cache: +Run the container using the `OPENAI_API_KEY` environment variable, and a docker volume to store cache. Consider to set the environment variables `OS_NAME` and `SHELL_NAME` according to your preferences. ```shell docker run --rm \ - --env OPENAI_API_KEY="your OPENAI API key" \ + --env OPENAI_API_KEY=api_key \ + --env OS_NAME=$(uname -s) \ + --env SHELL_NAME=$(echo $SHELL) \ --volume gpt-cache:/tmp/shell_gpt \ - ghcr.io/ther1d/shell_gpt --chat rainbow "what are the colors of a rainbow" + ghcr.io/ther1d/shell_gpt -s "update my system" ``` -When using a container, please note: -* The \[E\]xecute option for --shell with interaction will not work, since it would try this Execute in the docker container. -=> setting the `SHELL_INTERACTION` environment variable to false , makes sense. -* Since, most likely the os and shell of your container are not identical to the environment you want help with: -set the environment variables `OS_NAME` and `SHELL_NAME` according to your setup. - - Example of a conversation, using an alias and the `OPENAI_API_KEY` environment variable: ```shell alias sgpt="docker run --rm --volume gpt-cache:/tmp/shell_gpt --env OPENAI_API_KEY --env OS_NAME=$(uname -s) --env SHELL_NAME=$(echo $SHELL) ghcr.io/ther1d/shell_gpt" @@ -476,8 +471,6 @@ sgpt --chat rainbow "what are the colors of a rainbow" sgpt --chat rainbow "inverse the list of your last answer" sgpt --chat rainbow "translate your last answer in french" ``` -Note: -Consider filling in a more specific OS_NAME instead of using $(uname -s) You also can use the provided `Dockerfile` to build your own image: ```shell @@ -498,7 +491,7 @@ ENV USE_LITELLM=true ENV OPENAI_API_KEY=bad_key ENV SHELL_INTERACTION=false ENV PRETTIFY_MARKDOWN=false -ENV OS_NAME="Red Hat Enterprise Linux 8.6 (Ootpa)" +ENV OS_NAME="Arch Linux" ENV SHELL_NAME=auto WORKDIR /app diff --git a/sgpt/__version__.py b/sgpt/__version__.py index aa56ed40..c0f285b0 100644 --- a/sgpt/__version__.py +++ b/sgpt/__version__.py @@ -1 +1 @@ -__version__ = "1.4.3" +__version__ = "1.4.4" diff --git a/sgpt/config.py b/sgpt/config.py index 82a078af..bc083733 100644 --- a/sgpt/config.py +++ b/sgpt/config.py @@ -34,9 +34,9 @@ "API_BASE_URL": os.getenv("API_BASE_URL", "default"), "PRETTIFY_MARKDOWN": os.getenv("PRETTIFY_MARKDOWN", "true"), "USE_LITELLM": os.getenv("USE_LITELLM", "false"), - "SHELL_INTERACTION ": os.getenv("SHELL_INTERACTION ", "true"), + "SHELL_INTERACTION": os.getenv("SHELL_INTERACTION ", "true"), "OS_NAME": os.getenv("OS_NAME", "auto"), - "SHELL_NAME ": os.getenv("SHELL_NAME", "auto"), + "SHELL_NAME": os.getenv("SHELL_NAME", "auto"), # New features might add their own config variables here. } diff --git a/sgpt/function.py b/sgpt/function.py index aee653fc..d1156ae2 100644 --- a/sgpt/function.py +++ b/sgpt/function.py @@ -2,7 +2,7 @@ import sys from abc import ABCMeta from pathlib import Path -from typing import Any, Callable, Dict, List, Union +from typing import Any, Callable, Dict, List from .config import cfg diff --git a/sgpt/handlers/handler.py b/sgpt/handlers/handler.py index 1cbc4ae7..c6302132 100644 --- a/sgpt/handlers/handler.py +++ b/sgpt/handlers/handler.py @@ -90,7 +90,6 @@ def get_completion( messages: List[Dict[str, Any]], functions: Optional[List[Dict[str, str]]], ) -> Generator[str, None, None]: - name = arguments = "" is_shell_role = self.role.name == DefaultRoles.SHELL.value is_code_role = self.role.name == DefaultRoles.CODE.value