Skip to content

Commit

Permalink
Merge pull request #80 from flynnoct/dev
Browse files Browse the repository at this point in the history
v1.3.1
  • Loading branch information
flynnoct authored Apr 17, 2023
2 parents 6a428e7 + c136941 commit d8e301a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ In a group chat, use the `/chat` to invoke the Bot. It will not collect any othe
4. A practical Internet environment is required.
5. (Optional) [FFmpeg](https://ffmpeg.org) is required for the Bot to handle voice messages with Whisper. If you are not interested in using voice messages, you don't need to install it and **must set `enable_voice` in the config file to False**.

> **Note**: You should disable the privacy mode of the bot. Otherwise the bot will not receive the messages from the group chat. You can do this by sending `/setprivacy` to [@BotFather](https://t.me/BotFather).
### Installation

1. Git clone from main branch or download the latest release [Source code](https://github.com/flynnoct/chatgpt-telegram-bot/releases/latest) file and install the dependencies.
Expand All @@ -81,6 +79,8 @@ pip install -r requirements.txt

The config file includes sensitive information, such as telegram_token and openai_api_key, and we only release the corresponding template `config.json.template`. Therefore, you need to create a new `config.json` file by replacing the relative fields in the template with your own. Then, you can use the `config.py` script to udpate the config file through command line.

**Recommended:** You should keep `config.json.template` unmodified because the bot needs to read default configuration values from it. For backward compatibility, it is highly recommended to check the template for newly added parameters when you update to a new version.

```bash
cp config.json.template config.json
cd bin
Expand Down
6 changes: 6 additions & 0 deletions docs/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Version history

## v1.3.1

For backward compatibility, we add default parameter values to the `config.json.template` for newly added parameters.

Check issue [#78](https://github.com/flynnoct/chatgpt-telegram-bot/issues/78) for more information.

## v1.3.0

- System role customization is now supported.
Expand Down
5 changes: 5 additions & 0 deletions src/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ def load_config():
@staticmethod
def get(key):
ConfigLoader.load_config()
# If the key is not in the config file, return the default value
if key not in ConfigLoader._config:
with open("config.json.template", "r") as f:
config_dict_template = json.load(f)
return config_dict_template[key]
return ConfigLoader._config[key]

0 comments on commit d8e301a

Please sign in to comment.