From 8788e113733a896484090aab2fa06ca098f35075 Mon Sep 17 00:00:00 2001
From: hibobmaster <32976627+hibobmaster@users.noreply.github.com>
Date: Thu, 21 Sep 2023 12:38:29 +0800
Subject: [PATCH] fix and do some improvements
---
.env.example | 4 ++--
README.md | 4 ++--
compose.yaml | 3 ++-
config.json.sample => config.json.example | 0
full-config.json.sample => full-config.json.example | 0
src/bot.py | 3 ++-
6 files changed, 8 insertions(+), 6 deletions(-)
rename config.json.sample => config.json.example (100%)
rename full-config.json.sample => full-config.json.example (100%)
diff --git a/.env.example b/.env.example
index 9922bbf..292eb93 100644
--- a/.env.example
+++ b/.env.example
@@ -1,6 +1,6 @@
HOMESERVER="https://matrix-client.matrix.org" # required
USER_ID="@lullap:xxxxxxxxxxxxx.xxx" # required
-PASSWORD="xxxxxxxxxxxxxxx" # Optional if you use access token
+PASSWORD="xxxxxxxxxxxxxxx" # required
DEVICE_ID="MatrixChatGPTBot" # required
ROOM_ID="!FYCmBSkCRUXXXXXXXXX:matrix.XXX.XXX" # Optional, if not set, bot will work on the room it is in
-OPENAI_API_KEY="xxxxxxxxxxxxxxxxx" # Optional, for !chat and !gpt command
+OPENAI_API_KEY="xxxxxxxxxxxxxxxxx" # Optional
diff --git a/README.md b/README.md
index 0350e4c..355a1e4 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## Introduction
-This is a simple Matrix bot that support using OpenAI API, Langchain to generate responses from user inputs. The bot responds to these commands: `!gpt`, `!chat` and `!pic` and `!new` and `!lc` and `!help` depending on the first word of the prompt.
+This is a simple Matrix bot that support using OpenAI API, Langchain to generate responses from user inputs. The bot responds to these commands: `!gpt`, `!chat`, `!pic`, `!new`, `!lc` and `!help` depending on the first word of the prompt.
![ChatGPT](https://i.imgur.com/kK4rnPf.jpeg)
## Feature
@@ -23,7 +23,7 @@ Create two empty file, for persist database only
touch sync_db manage_db
sudo docker compose up -d
```
-
+manage_db(can be ignored) is for langchain agent, sync_db is for matrix sync database
libolm-dev
diff --git a/compose.yaml b/compose.yaml
index e3c67b8..76b61e2 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -12,8 +12,9 @@ services:
# use env file or config.json
# - ./config.json:/app/config.json
# use touch to create empty db file, for persist database only
+ # manage_db(can be ignored) is for langchain agent, sync_db is for matrix sync database
- ./sync_db:/app/sync_db
- - ./manage_db:/app/manage_db
+ # - ./manage_db:/app/manage_db
# import_keys path
# - ./element-keys.txt:/app/element-keys.txt
networks:
diff --git a/config.json.sample b/config.json.example
similarity index 100%
rename from config.json.sample
rename to config.json.example
diff --git a/full-config.json.sample b/full-config.json.example
similarity index 100%
rename from full-config.json.sample
rename to full-config.json.example
diff --git a/src/bot.py b/src/bot.py
index cbdb73c..e62c611 100644
--- a/src/bot.py
+++ b/src/bot.py
@@ -117,7 +117,8 @@ class Bot:
self.base_path = Path(os.path.dirname(__file__)).parent
if lc_admin is not None:
- lc_admin = list(filter(None, lc_admin.split(",")))
+ if isinstance(lc_admin, str):
+ lc_admin = list(filter(None, lc_admin.split(",")))
self.lc_admin = lc_admin
self.lc_cache = {}
if self.lc_admin is not None: