update readme
This commit is contained in:
parent
2f0f9a76f2
commit
74ca7e80b3
13
README.md
13
README.md
@ -3,21 +3,32 @@
|
||||
THIS CODE IS MEANT TO BE SELF HOSTED USING THE LIBRARY: https://abetlen.github.io/llama-cpp-python/
|
||||
|
||||
|
||||
This code is for a Discord bot that uses OpenAI's GPT-3 language model to generate responses to user messages. It listens for messages in two specified Discord channels, and when a user sends a message, it appends it to the conversation history and sends it to the GPT-3 API to generate a response. The response is then sent back to the user in the same channel. The bot uses the Node.js discord.js library to interact with the Discord API and the node-fetch library to make HTTP requests to the GPT-3 API.
|
||||
This code is for a Discord bot that uses OpenAI's GPT-3 language model (self hosted at home) to generate responses to user messages. It listens for messages in two specified Discord channels, and when a user sends a message, it appends it to the conversation history and sends it to the GPT-3 API to generate a response. The response is then sent back to the user in the same channel. The bot uses the Node.js discord.js library to interact with the Discord API and the node-fetch library to make HTTP requests to the GPT-3 API.
|
||||
|
||||
Here is a summary of the main parts of the code:
|
||||
|
||||
Import required modules and set environment variables using dotenv.
|
||||
|
||||
Create a new Client instance and set the intents and partials.
|
||||
|
||||
Define two channel IDs that the bot will listen to.
|
||||
|
||||
Create a Map to store ongoing conversations with users.
|
||||
|
||||
Define functions to update the bot's presence status, check if any conversation is busy, and set a conversation as busy or not busy.
|
||||
|
||||
Listen for the ready event and update the bot's presence status.
|
||||
|
||||
Listen for the messageCreate event and respond to messages that are sent in the specified channels.
|
||||
|
||||
When a message is received, check if any conversation is busy. If so, delete the message and send a busy response to the user.
|
||||
|
||||
If no conversation is busy, append the user message to the conversation history and send it to the GPT-3 API to generate a response.
|
||||
|
||||
If the response is not empty, send it back to the user in the same channel. If it is empty, send a reset message and delete the conversation history for that user.
|
||||
|
||||
Define a generateResponse function that sends a request to the GPT-3 API to generate a response. If the request times out or an error occurs, handle it accordingly.
|
||||
|
||||
Call the generateResponse function within the messageCreate event listener function.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user