From 6cc012f1f8d37d674171dad1051a23ffaf2c5920 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Thu, 13 Feb 2025 21:08:09 -0500 Subject: added options to control the exponential backoff reconnects for irc and db --- README.md | 139 ++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 77 insertions(+), 62 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0318549..5c9660d 100644 --- a/README.md +++ b/README.md @@ -25,68 +25,76 @@ The bot will see a chat prompt as a command if the message begins with `botnick: An example is provided under `config-example.toml`. Please note that all the config options are specific to one instance which is defined by `ircd.nameofyourinstance`.
-| Option | Description | -| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ircServer | The address for the IRC server to connect to | -| ircNick | The nick the bot should use | -| enableSasl | Whether to use SASL for authentication | -| ircSaslUser | The SASL username | -| ircSaslPass | The SASL password for SASL plain authentication. Can also be passed as and environment variable | -| Endpoint | The address for the Ollama chat endpoint | -| model | The name of the model to use | -| chromaStyle | The style to use for syntax highlighting done by [chroma](https://github.com/alecthomas/chroma). This is basically what's called a "theme" | -| chromaFormatter | The formatter to use. This tells chroma how to generate the color in the output. The supported options are:

- `noop` for no syntax highlighting
- `terminal` for 8-color terminals
- `terminal8` for 8-color terminals
- `terminal16` for 16-color terminals
- `terminal256` for 256-color terminals
- `terminal16m` for truecolor terminals
- `html` for HTML output

**_NOTE_**: please note that the terminal formatters will increase the size of the IRC event. Depending on the IRC server, this may or may not be a problem. | -| provider | Which LLM provider to use. The supported options are:

- [ollama](https://github.com/ollama/ollama)
- chatgpt
- gemini
- [openrouter](https://openrouter.ai/)
| -| apikey | The apikey to use for the LLM provider. Can also be passed as and environment variable | -| clientCertPath | The path to the client certificate to use for client cert authentication | -| serverPass | The password to use for the IRC server the bot is trying to connect to if the server has a password. Can also be passed as and environment variable | -| bind | Which address to bind to for the IRC server | -| requestTimeout | The timeout for requests made to the LLM provider | -| millaReconnectDelay | How much to wait before reconnecting to the IRC server | -| ircPort | Which port to connect to for the IRC server | -| keepAlive | | -| memoryLimit | How many conversations to keep in memory for a model | -| pingDelay | Ping delay for the IRC server | -| pingTimeout | Ping timeout for the IRC server | -| skipTLSVerify | Skip verifying the IRC server's TLS certificate. This only makes sense if you are trying to connect to an IRC server with a self-signed certificate | -| useTLS | Whether to use TLS to connect to the IRC server. This option is provided to support usage on overlay networks such as Tor, i2p and [yggdrassil](https://github.com/yggdrasil-network/yggdrasil-go) | -| disableSTSFallback | Disables the "fallback" to a non-TLS connection if the strict transport policy expires and the first attempt to reconnect back to the TLS version fails | -| allowFlood | Disable [girc](https://github.com/lrstanley/girc)'s built-in flood protection | -| debug | Whether to enable debug logging. The logs are written to stdout | -| out | Whether to write raw messages to stdout | -| admins | List of admins for the bot. Only admins can use commands.

`admins = ["admin1", "admin2"]`
| -| ircChannels | List of channels for the bot to join when it connects to the server.
`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]`
In the provided example, milla will attempt to join `#channel1` with the provided password while for the other two channels, it will try to join normally.

**_NOTE 1_**: This behaviour is consistant across all places where a channel name is the input.

**_NOTE 2_**: Please note that the bot does not have to join a channel to be usable. One can simply query the bot directly as well.
| -| databaseUser | Name of the database user | -| databasePassword | Password for the database user | -| databaseAddress | Address of the database | -| databaseName | Name of the database | -| scrapeChannels | List of channels that the bot will scrape into a database table. You can later on use these databases for the custom commands.

`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]` | -| ircProxy | Determines which proxy to use to connect to the IRC network:
`ircProxy = "socks5://127.0.0.1:9050"` | -| llmProxy | Determines which proxy to use to connect to the LLM endpoint:
`llmProxy = "socks5://127.0.0.1:9050"` | -| generalProxy | Determines which proxy to use for other things:
`llmProxy = "socks5://127.0.0.1:9050"`

**_NOTE_**: Lua scripts do not use the `generalProxy` option. They will use whatever proxy that the invidividual script has them use. The RSS functionaly lets you use a proxy for every single entry. | -| ircdName | Name of the milla instance, must be unique across all instances | -| adminOnly | Milla will only answer if the nick is in the admin list | -| webIRCGateway | webirc gateway to use | -| webIRCHostname | webirc hostname to use | -| webIRCPassword | webirc password to use | -| webIRCAddress | webirc address to use | -| context | Artificially provide a history of messages for the bot.

`tomlcontext = ["you are a pirate. use the language and words a pirate would unless you are asked to do otherwise explicitly", "your name is caption blackbeard"]`
`tomlcontext = ["please respond in french even if i use another language unless you are specifically asked to use any language other than french", "your name is terra"]` | -| rssFile | The file that contains the rss feeeds | -| channel | The channel to send the rss feeds to | -| plugins | A list of plugins to load:`plugins = ["./plugins/rss.lua", "./plugins/test.lua"]` | -| systemPrompt | The system prompt for the AI chat bot | -| temperature | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| topP | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| topK | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaMirostat | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaMirostatEta | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaMirostatTau | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaNumCtx | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaRepeatLastN | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaRepeatPenalty | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaSeed | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaNumPredict | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | -| ollamaMinp | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| Option | Description | +| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ircServer | The address for the IRC server to connect to | +| ircNick | The nick the bot should use | +| enableSasl | Whether to use SASL for authentication | +| ircSaslUser | The SASL username | +| ircSaslPass | The SASL password for SASL plain authentication. Can also be passed as and environment variable | +| Endpoint | The address for the Ollama chat endpoint | +| model | The name of the model to use | +| chromaStyle | The style to use for syntax highlighting done by [chroma](https://github.com/alecthomas/chroma). This is basically what's called a "theme" | +| chromaFormatter | The formatter to use. This tells chroma how to generate the color in the output. The supported options are:

- `noop` for no syntax highlighting
- `terminal` for 8-color terminals
- `terminal8` for 8-color terminals
- `terminal16` for 16-color terminals
- `terminal256` for 256-color terminals
- `terminal16m` for truecolor terminals
- `html` for HTML output

**_NOTE_**: please note that the terminal formatters will increase the size of the IRC event. Depending on the IRC server, this may or may not be a problem. | +| provider | Which LLM provider to use. The supported options are:

- [ollama](https://github.com/ollama/ollama)
- chatgpt
- gemini
- [openrouter](https://openrouter.ai/)
| +| apikey | The apikey to use for the LLM provider. Can also be passed as and environment variable | +| clientCertPath | The path to the client certificate to use for client cert authentication | +| serverPass | The password to use for the IRC server the bot is trying to connect to if the server has a password. Can also be passed as and environment variable | +| bind | Which address to bind to for the IRC server | +| requestTimeout | The timeout for requests made to the LLM provider | +| millaReconnectDelay | How much to wait before reconnecting to the IRC server | +| ircPort | Which port to connect to for the IRC server | +| keepAlive | | +| memoryLimit | How many conversations to keep in memory for a model | +| pingDelay | Ping delay for the IRC server | +| pingTimeout | Ping timeout for the IRC server | +| skipTLSVerify | Skip verifying the IRC server's TLS certificate. This only makes sense if you are trying to connect to an IRC server with a self-signed certificate | +| useTLS | Whether to use TLS to connect to the IRC server. This option is provided to support usage on overlay networks such as Tor, i2p and [yggdrassil](https://github.com/yggdrasil-network/yggdrasil-go) | +| disableSTSFallback | Disables the "fallback" to a non-TLS connection if the strict transport policy expires and the first attempt to reconnect back to the TLS version fails | +| allowFlood | Disable [girc](https://github.com/lrstanley/girc)'s built-in flood protection | +| debug | Whether to enable debug logging. The logs are written to stdout | +| out | Whether to write raw messages to stdout | +| admins | List of admins for the bot. Only admins can use commands.

`admins = ["admin1", "admin2"]`
| +| ircChannels | List of channels for the bot to join when it connects to the server.
`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]`
In the provided example, milla will attempt to join `#channel1` with the provided password while for the other two channels, it will try to join normally.

**_NOTE 1_**: This behaviour is consistant across all places where a channel name is the input.

**_NOTE 2_**: Please note that the bot does not have to join a channel to be usable. One can simply query the bot directly as well.
| +| databaseUser | Name of the database user | +| databasePassword | Password for the database user | +| databaseAddress | Address of the database | +| databaseName | Name of the database | +| scrapeChannels | List of channels that the bot will scrape into a database table. You can later on use these databases for the custom commands.

`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]` | +| ircProxy | Determines which proxy to use to connect to the IRC network:
`ircProxy = "socks5://127.0.0.1:9050"` | +| llmProxy | Determines which proxy to use to connect to the LLM endpoint:
`llmProxy = "socks5://127.0.0.1:9050"` | +| generalProxy | Determines which proxy to use for other things:
`llmProxy = "socks5://127.0.0.1:9050"`

**_NOTE_**: Lua scripts do not use the `generalProxy` option. They will use whatever proxy that the invidividual script has them use. The RSS functionaly lets you use a proxy for every single entry. | +| ircdName | Name of the milla instance, must be unique across all instances | +| adminOnly | Milla will only answer if the nick is in the admin list | +| webIRCGateway | webirc gateway to use | +| webIRCHostname | webirc hostname to use | +| webIRCPassword | webirc password to use | +| webIRCAddress | webirc address to use | +| context | Artificially provide a history of messages for the bot.

`tomlcontext = ["you are a pirate. use the language and words a pirate would unless you are asked to do otherwise explicitly", "your name is caption blackbeard"]`
`tomlcontext = ["please respond in french even if i use another language unless you are specifically asked to use any language other than french", "your name is terra"]` | +| rssFile | The file that contains the rss feeeds | +| channel | The channel to send the rss feeds to | +| plugins | A list of plugins to load:`plugins = ["./plugins/rss.lua", "./plugins/test.lua"]` | +| systemPrompt | The system prompt for the AI chat bot | +| temperature | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| topP | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| topK | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaMirostat | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaMirostatEta | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaMirostatTau | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaNumCtx | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaRepeatLastN | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaRepeatPenalty | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaSeed | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaNumPredict | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ollamaMinp | [ollama docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values) | +| ircBackOffInitialInterval | Initial backoff value for reconnects to IRC. The value is in milliseconds. | +| ircBackOffRandomizationFactor | The randomization factor for the exponential backoff. | +| ircBackOffMultiplier | The multiplier for subsequent backoffs. | +| ircBackOffMaxInterval | The maximum value for the backoff interval. The value is in seconds. | +| dbBackOffInitialInterval | Initial backoff value for reconnects to the DB. The value is in milliseconds. | +| dbBackOffRandomizationFactor | The randomization factor for the exponential backoff. | +| dbBackOffMultiplier | The multiplier for subsequent backoffs. | +| dbBackOffMaxInterval | The maximum value for the backoff interval. The value is in seconds. | ## Custom Commands @@ -514,6 +522,13 @@ rss_feed() The example rss plugin, accepts a yaml file as input, reeds the provided rss feeds once, extracts the title, author name and link to the resource, sends the feed over to the `#rssfeed` irc channel and exits.
Also please note that this is just an example script. If you want milla to handle some rss feeds for you, you can use the builtin rss functionality.
+### Plugins + +| Name | Explanation | +| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ip.lua | A geo-ip lookup for both ipv4 and ipv6. The API request is sent to http://ip-api.com. You can set the `http_proxy` env var for this script. | +| urban.lua | Asks urban dictionary for the meaning. it only has one switch, `-n`, e.g. `-n 3` which will give you 3 definitions instead of the default 1 answer that will be returned. | + ### Milla's Lua Module Here's a list of the available function in milla's lua module: -- cgit v1.2.3