chat/README.md
2025-10-03 16:24:10 +00:00

82 lines
3.1 KiB
Markdown

# Chat
A Limnoria plugin that brings ChatGPT into your IRC channel
## Installation
1. Install the plugin
2. Put your API key in the plugin configuration registry like so:
```
/msg BotName config plugins.Chat.api_key YOUR_API_KEY
```
3. Load the plugin:
```
load Chat
```
## Configuration
The Chat plugin supports the following configuration parameters:
- **`api_key`**: The API key for accessing OpenAI's API. This must be set for the plugin to work.
- **`model`**: The OpenAI model to use for generating responses. Default: `gpt-4`.
- **`max_tokens`**: The maximum number of tokens to include in the response. Default: `256`.
- **`system_prompt`**: The system prompt to guide the assistant's behavior. Default: `You are a helpful assistant.`.
- **`scrollback_lines`**: The number of recent lines from the channel to include as context. Default: `10`.
- **`join_string`**: The string used to join multi-line responses into a single line. Default: ` / `.
- **`passive_mode`**: Controls passive participation. Options: `off`, `mention`, `smart`. Default: `off`.
- **`passive_probability`**: When `passive_mode` is `smart`, probability (0-1) that the bot considers replying when heuristics match. Default: `0.35`.
- **`passive_max_replies`**: Maximum passive replies per thread (`-1` disables the cap). Default: `3`.
- **`passive_engagement_timeout`**: Seconds before an active passive thread expires if the bot stays quiet. Default: `180`.
- **`passive_cooldown`**: Cooldown in seconds after ending a passive thread before starting a new one. Default: `120`.
- **`passive_trigger_words`**: Space-separated keywords that increase the chance of a passive response in `smart` mode. Default: *(empty)*.
- **`passive_prompt_addendum`**: Text appended to the system prompt while passive mode is active, shaping the bot's etiquette.
### Example Configuration
To set the API key:
```
/msg BotName config plugins.Chat.api_key YOUR_API_KEY
```
To change the model:
```
/msg BotName config plugins.Chat.model gpt-3.5-turbo
```
To adjust the maximum tokens:
```
/msg BotName config plugins.Chat.max_tokens 512
```
### Passive Mode
Enable light-weight participation by switching `passive_mode` to `mention` so the bot automatically answers when called by name:
```
/msg BotName config plugins.Chat.passive_mode mention
```
For a looser "hang out" presence, activate `smart` mode and adjust the heuristics:
```
/msg BotName config plugins.Chat.passive_mode smart
/msg BotName config plugins.Chat.passive_probability 0.25
/msg BotName config plugins.Chat.passive_trigger_words help thoughts idea
```
In smart mode the bot watches channel flow, but only jumps in when it is confident it can help or close an active thread. Direct `.chat`/`@Bot chat` commands still work exactly as before.
## Usage
Once configured, you can use the `chat` command to interact with the bot. For example:
```
@BotName chat What is the capital of France?
```
The bot will respond with the answer based on the configured model and context.
## Defaults
The plugin is designed to work out of the box with minimal configuration. Simply set the `api_key`, and the plugin will use sensible defaults for all other parameters.