Feature Set Documentation (#130)

* added client events documentation

* wording updated
This commit is contained in:
Jonathan Smoley
2024-10-19 16:46:51 -07:00
committed by GitHub
parent 624ff2e5c8
commit 68a5e097fe
4 changed files with 103 additions and 72 deletions

View File

@@ -11,6 +11,7 @@
* features: `'feature/**'` * features: `'feature/**'`
* releases: `'releases/**'` * releases: `'releases/**'`
* bugs: `'bug/**'` * bugs: `'bug/**'`
* docs: `'docs/**'`
## Run the Bot ## Run the Bot
* Refer to all sections below before running the bot. * Refer to all sections below before running the bot.

View File

@@ -10,9 +10,6 @@
<a href="#"></a><a href="https://github.com/kevinthedang/discord-ollama/actions/workflows/coverage.yml"><img alt="Code Coverage" src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kevinthedang/bc7b5dcfa16561ab02bb3df67a99b22d/raw/coverage.json"></a> <a href="#"></a><a href="https://github.com/kevinthedang/discord-ollama/actions/workflows/coverage.yml"><img alt="Code Coverage" src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kevinthedang/bc7b5dcfa16561ab02bb3df67a99b22d/raw/coverage.json"></a>
</div> </div>
## Guides
* [User Slash Commands](./docs/commands-guide.md)
## About/Goals ## About/Goals
Ollama is an AI model management tool that allows users to install and use custom large language models locally. Ollama is an AI model management tool that allows users to install and use custom large language models locally.
The project aims to: The project aims to:
@@ -34,6 +31,11 @@ The project aims to:
* [ ] Documentation on creating your own LLM * [ ] Documentation on creating your own LLM
* [ ] Documentation on web scrapping and cleaning * [ ] Documentation on web scrapping and cleaning
## Documentation
These are guides to the feature set included and the events triggered in this app.
* [User Slash Commands](./docs/commands-guide.md)
* [Client Events](./docs/events-guide.md)
## Environment Setup ## Environment Setup
* Clone this repo using `git clone https://github.com/kevinthedang/discord-ollama.git` or just use [GitHub Desktop](https://desktop.github.com/) to clone the repo. * Clone this repo using `git clone https://github.com/kevinthedang/discord-ollama.git` or just use [GitHub Desktop](https://desktop.github.com/) to clone the repo.
* You will need a `.env` file in the root of the project directory with the bot's token. There is a `.env.sample` is provided for you as a reference for what environment variables. * You will need a `.env` file in the root of the project directory with the bot's token. There is a `.env.sample` is provided for you as a reference for what environment variables.
@@ -44,6 +46,7 @@ The project aims to:
* [Docker Setup for Servers and Local Machines](./docs/setup-docker.md) * [Docker Setup for Servers and Local Machines](./docs/setup-docker.md)
* Nvidia is recommended for now, but support for other GPUs should be development. * Nvidia is recommended for now, but support for other GPUs should be development.
* Local use is not recommended. * Local use is not recommended.
## Resources ## Resources
* [NodeJS](https://nodejs.org/en) * [NodeJS](https://nodejs.org/en)
* This project runs on `lts\hydrogen`. * This project runs on `lts\hydrogen`.

View File

@@ -1,105 +1,105 @@
## Commands Guide ## Commands Guide
This is a guide to all of the slash commands for the bot. This is a guide to all of the slash commands for the app.
* Action Commands are commands that do not affect a user's `preference file`. * Action Commands are commands that do not affect a user's `preference file`.
* Guild Commands can also be considered action commands. * Guild Commands can also be considered action commands.
> [!NOTE] > [!NOTE]
> Administrator commands are only usable by actually administrators on the Discord server. > Administrator commands are only usable by actual administrators on the Discord server.
### Guild Commands (Administrator) ### Guild Commands (Administrator)
1. Disable (or Toggle Chat) Command 1. Disable (or Toggle Chat)
This command will `enable` or `disable` whether or not the bot will respond to users. For example, we set the `enabled` field to `true` to allow the bot to respond to users. This command will `enable` or `disable` whether or not the app will respond to users.
``` ```
/toggle-chat enabled true /toggle-chat enabled true
``` ```
2. Shutoff Command 2. Shutoff
This command will shutoff the bot and no users will be able to respond to the bot anymore. The bot must be manually restarted upon being shutoff. This command will shutoff the app so no users can converse with it.
The app must be manually restarted upon being shutoff.
Below we shutoff the bot by putting `true` in the `are-your-sure` field. Below shuts off the app by putting `true` in the `are-your-sure` field.
``` ```
/shutoff are-you-sure true /shutoff are-you-sure true
``` ```
### Action Commands ### Action Commands
1. Clear Channel (Message) History Command 1. Clear Channel (Message) History
This command will clear the history of the current channel for the user that calls it. For example, just running the command in any channel will clear the message history. This command will clear the history of the current channel for the user that calls it.
Running the command in any channel will clear the message history.
``` ```
/clear-user-channel-history /clear-user-channel-history
``` ```
2. Pull Model Command 2. Pull Model
This command will pull a model that exists on the [Ollama Model Library](https://ollama.com/library). If it does not exist there, it will throw a hissy fit. This command will pull a model that exists on the [Ollama Model Library](https://ollama.com/library). If it does not exist there, it will throw a hissy fit.
Below we try to pull the `codellama` model. Below trys to pull the `codellama` model.
``` ```
/pull-model model-to-pull codellama /pull-model model-to-pull codellama
``` ```
3. Thread Create Command 3. Thread Create
This command creates a public thread to talk with the bot if you do not want to talk in a `GuildText` channel. This command creates a public thread to talk with the app instead of using a `GuildText` channel.
You can just run the command below: ```
/thread
```
``` 4. (Private) Thread Create
/thread This command creates a private thread to talk with the bot privately.
``` Invite others to the channel and they will be able to talk to the app as well.
4. Private Thread Create Command ```
This command creates a private thread to talk with the bot privately. You can invite others to the channel and they will be able to talk to the bot there. /private-thread
```
You can just run the command below:
```
/private-thread
```
### User Preference Commands ### User Preference Commands
1. Capacity Command 1. Capacity
This command changes how much context it will keep within your conversations with the discord bot. This is applied for all of your existing chats whenever you interact with the bot. For example, below I am setting my message history capacity to at most 5 messages at once. This command changes how much context it will keep in conversations with the app.
This is applied for all of existing chats when interacting with the app.
``` Below sets the message history capacity to at most 5 messages at once.
/modify-capacity context-capacity 5
```
2. Message Stream Command ```
This command will toggle whether or not the bot will "stream" a response kind of how ChatGPT and many UI's do it. /modify-capacity context-capacity 5
```
> [!NOTE] 2. Message Stream
> This is a very slow progress on Discord because they do not allow what I call "spamming" changes within 5 seconds. This command will toggle whether or not the app will "stream" a response.
(think of how ChatGPT and other interfaces do this)
Below, we can set `stream` to true to make the bot respond not all at once. Below sets the `stream` to true to make the app respond in increments.
``` ```
/message-stream stream true /message-stream stream true
``` ```
> [!NOTE]
> This is a very slow progress on Discord because "spamming" changes within 5 seconds is not allowed.
3. Message Style Command 3. Message Style
This command allows user to select their preferred way the bot to respond. This command allows a user to select whether to embed the app's response.
Below enables the embed style. ```
/message-style embed true
```
``` This allows the app to respond as a user would normally respond.
/message-style embed true
```
This way allows the bot to respond as you would normally see a user respond. ```
/message-style embed false
```
``` 4. Switch Model
/message-style embed false This command will switch the user-preferred model so long as it exists in within the local ollama service or from the [Ollama Model Library](https://ollama.com/library).
``` If it cannot be found locally, it will attempt to find it in the model library.
4. Switch Model Command Below we are trying to switch to a specific model size.
This command will switch the user preferred model so long as it exists in within their local ollama service or from the [Ollama Model Library](https://ollama.com/library). If it cannot be found locally, it will attempt to find it in the model library.
Below we are trying to switch to a specific model size.
```
/switch-model model-to-use llama3.2:1.3b
```
```
/switch-model model-to-use llama3.2:1.3b
```

27
docs/events-guide.md Normal file
View File

@@ -0,0 +1,27 @@
## Events Guide
This is a guide to all of the client events for the app.
> [!NOTE] Each of these is logged to the console for a developer to track.
1. ClientReady
This event signifies that the Discord app is online.
Here the app's activity is set and its commands are registered.
2. InteractionCreate
This event signifies that a user interacted from Discord in some way.
Here commands are selected from a knowledge bank and executed if found.
> [!NOTE] Possible interactions include commands, buttons, menus, etc.
3. MessageCreate
This event signifies that a message was sent.
Here user questions and comments for the LLM are processed.
1. check message is from a user and mentions the app
2. check for interaction preferences
3. add the message to a queue
4. check the response for success
5. send a response back to the user.
4. ThreadDelete
This event signifies that a Discord Thread was deleted.
Here any preferences set for interaction within the thread are cleared away.