Skip to content

Commit

Permalink
Merge pull request #77 from innightwolfsleep/innightwolfsleep-patch-1
Browse files Browse the repository at this point in the history
Innightwolfsleep patch 1
  • Loading branch information
innightwolfsleep authored Sep 15, 2023
2 parents fac358f + 87a2f87 commit fe349ef
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 58 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
112 changes: 54 additions & 58 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

![Image1](https://github.com/innightwolfsleep/storage/raw/main/textgen_telegram.PNG)

Providing chat like telegram bot interface for [abetlen/llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [huggingface/transformers](https://github.com/huggingface/transformers).
In addition, can an extension for [oobabooga/text-generation-webui](https://github.com/oobabooga/text-generation-webui).
An extension for [oobabooga/text-generation-webui](https://github.com/oobabooga/text-generation-webui).

In addition, can work as standalone app.


---------------
HOW TO INSTALL (**standalone app**):
Expand All @@ -17,22 +19,7 @@ HOW TO RUN (**standalone app**):
3) move your model file to `models/`
4) set **model_path** to your model in `configs/app_config.json`
5) start `run.cmd`(windows) or `run.sh`(linux)
---------------
HOW TO INSTALL (**extension mode**):

1) obviously, install [oobabooga/text-generation-webui](https://github.com/oobabooga/text-generation-webui) first, add model, set all options you need
2) run `cmd_windows.bat` or `cmd_linux.sh` to enable venv
3) clone this repo to "text-generation-webui\extensions"
`git clone https://github.com/innightwolfsleep/text-generation-webui-telegram_bot text-generation-webui\extensions\telegram_bot`
4) install requirements
`pip install -r text-generation-webui\extensions\telegram_bot\ext_requirements_ext.txt`

HOW TO USE (**extension mode**):
1) get bot token from https://t.me/BotFather
2) add your bot token in `text-generation-webui\extensions\telegram_bot\configs\telegram_token.txt` file or oobabooga environment
3) run server.py with `--extensions telegram_bot`
4) (optional) if you are facing internet issue, change `proxy_url` at `extension_config.json` into your own proxy. For example: `https://127.0.0.1:10808`
---------------
6) ---------------

FEATURES:
- chat and notebook modes
Expand All @@ -42,7 +29,7 @@ FEATURES:
- buttons: continue previous message, regenerate last message, remove last messages from history, reset history button, new char loading menu
- you can load new characters from text-generation-webui\characters with button
- you can load new model during conversation with button
- chatting "+" or "#" prefix for impersonate: "#Hero sister" or "+Castle guard". Or even ask bot generate your own message "+You"
- "+" or "#" user message prefix for impersonate: "#Chiharu sister" or "+Castle guard". Or even ask bot generate your own message "+You"
- "-" or "!" prefix to replace last bot message
- "++" prefix replace bot name during chat (switch conversation to another character)
- "--" prefix replace you name during chat
Expand All @@ -58,8 +45,8 @@ FEATURES:

CONFIGURATION:

`run_config.json` - config for running as standalone app (`run.sh` or `run.cmd`)
`extension_config` - config for running as extension for [oobabooga/text-generation-webui](https://github.com/oobabooga/text-generation-webui)
`app_config.json` - config for running as standalone app (`run.sh` or `run.cmd`)
`ext_config.json` - config for running as extension for [oobabooga/text-generation-webui](https://github.com/oobabooga/text-generation-webui)

```
x_config.json
Expand All @@ -80,50 +67,59 @@ x_config.json
- generator_text_generator_webui_api - use oobabooga/text-generation-webui API extension
model_path=models\llama-13b.ggml.q4_0.bin
path to model .bin file
characters_dir_path=characters
default_char=Example.yaml
default cahracter and path to cahracters folder
presets_dir_path=presets
default_preset=Shortwave.yaml
default generation preset and path to preset folder
model_lang=en
user_lang=en
default model and user language. User language can be switched by users, individualy.
html_tag_open=<pre>
html_tag_close=</pre>
tags for bot answers in tg. By default - preformatted text (pre)
history_dir_path=history
directory for users history
token_file_path=configs\\telegram_token.txt
bot token. Ask https://t.me/BotFather
admins_file_path=configs\\telegram_admins.txt
users whos id's in admins_file switched to admin mode and can choose settings-for-all (generating settings and model)
users_file_path=configs\\telegram_users.txt
if just one id in users_file - bot will ignore all users except this id (id's). Even admin will be ignored
generator_params_file_path=configs\\telegram_generator_params.json
default text generation params, overwrites by choosen preset
user_rules_file_path=configs\\telegram_user_rules.json
user rules matrix
telegram_sd_config=configs\\telegram_sd_config.json
stable diffusion api config
stopping_strings=<END>,<START>,end{code}
eos_token=None
generating settings
translation_as_hidden_text=on
if "on" and model/user lang not the same - translation will be writed under spoiler. If "off" - translation without spoiler, no original text in message.
characters_dir_path=characters
default_char=Example.yaml
default cahracter and path to cahracters folder
presets_dir_path=presets
default_preset=Shortwave.yaml
default generation preset and path to preset folder
model_lang=en
user_lang=en
default model and user language. User language can be switched by users, individualy.
html_tag_open=<pre>
html_tag_close=</pre>
tags for bot answers in tg. By default - preformatted text (pre)
history_dir_path=history
directory for users history
token_file_path=configs\\telegram_token.txt
bot token. Ask https://t.me/BotFather
admins_file_path=configs\\telegram_admins.txt
users whos id's in admins_file switched to admin mode and can choose settings-for-all (generating settings and model)
users_file_path=configs\\telegram_users.txt
if just one id in users_file - bot will ignore all users except this id (id's). Even admin will be ignored
generator_params_file_path=configs\\telegram_generator_params.json
default text generation params, overwrites by choosen preset
user_rules_file_path=configs\\telegram_user_rules.json
user rules matrix
telegram_sd_config=configs\\telegram_sd_config.json
stable diffusion api config
stopping_strings=<END>,<START>,end{code}
eos_token=None
generating settings
translation_as_hidden_text=on
if "on" and model/user lang not the same - translation will be writed under spoiler. If "off" - translation without spoiler, no original text in message.
sd_api_url="http://127.0.0.1:7860"
stable diffusion api url, need to use "photo" prefixes
proxy_url
to avoid provider blocking
stable diffusion api url, need to use "photo" prefixes
proxy_url
to avoid provider blocking
telegram_generator_params.json
config for generator
telegram_sd_config.json
config for stable diffusion
telegram_admins.txt
list of users id who forced to admin mode.
list of users id who forced to admin mode. If telegram_users not empty - must be in telegram_users too!
telegram_users.txt
list og users id (or groups id) who permitted interact with bot. If empty - everyone permitted
list og users id (or groups id) who permitted interact with bot. If empty - everyone permitted
telegram_token.txt
telegram bot token
telegram bot token
telegram_user_rules.json
buttons visibility config for various bot modes
```

0 comments on commit fe349ef

Please sign in to comment.