Merge branch 'main' of https://github.com/Showdown76py/myai-discord
This commit is contained in:
commit
5d1debc0b0
@ -14,3 +14,5 @@ MAX_TOKEN_PER_REQUEST = [Maximum tokens per request] (recommended: 1800-2000)
|
|||||||
TOKEN = [Your Discord bot's token]
|
TOKEN = [Your Discord bot's token]
|
||||||
OPENAI_API_KEY = [OpenAI Token -- can be found at https://platform.openai.com/account/api-keys]
|
OPENAI_API_KEY = [OpenAI Token -- can be found at https://platform.openai.com/account/api-keys]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### The `tokens.db` database is blank and contains no data.
|
||||||
|
2
main.py
2
main.py
@ -51,7 +51,6 @@ def num_tokens_from_string(string: str) -> int:
|
|||||||
|
|
||||||
@app.event
|
@app.event
|
||||||
async def on_message(message: discord.Message):
|
async def on_message(message: discord.Message):
|
||||||
print('msg received')
|
|
||||||
if not isinstance(message.channel, discord.DMChannel): return
|
if not isinstance(message.channel, discord.DMChannel): return
|
||||||
if message.author.id == app.user.id: return
|
if message.author.id == app.user.id: return
|
||||||
try:
|
try:
|
||||||
@ -86,7 +85,6 @@ async def on_message(message: discord.Message):
|
|||||||
for arg in arguments.keys(): bprompt = bprompt.replace(f'|{arg}|', arguments[arg])
|
for arg in arguments.keys(): bprompt = bprompt.replace(f'|{arg}|', arguments[arg])
|
||||||
|
|
||||||
previous_tokens = 200+len(bprompt)+message_token_usage
|
previous_tokens = 200+len(bprompt)+message_token_usage
|
||||||
print(bprompt)
|
|
||||||
# (message_id, user_id, content, token, role, timestamp)
|
# (message_id, user_id, content, token, role, timestamp)
|
||||||
# order by timestamp (most recent to least recent)
|
# order by timestamp (most recent to least recent)
|
||||||
usable_messages = []
|
usable_messages = []
|
||||||
|
Loading…
Reference in New Issue
Block a user