aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md139
-rw-r--r--defaults.go135
-rw-r--r--main.go122
-rw-r--r--types.go150
4 files changed, 311 insertions, 235 deletions
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`.<br/>
-| 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:<br><br>- `noop` for no syntax highlighting<br>- `terminal` for 8-color terminals<br>- `terminal8` for 8-color terminals<br>- `terminal16` for 16-color terminals<br>- `terminal256` for 256-color terminals<br>- `terminal16m` for truecolor terminals<br>- `html` for HTML output<br><br>**_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:<br><br>- [ollama](https://github.com/ollama/ollama)<br>- chatgpt<br>- gemini<br>- [openrouter](https://openrouter.ai/)<br> |
-| 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.<br><br>`admins = ["admin1", "admin2"]`<br> |
-| ircChannels | List of channels for the bot to join when it connects to the server.<br>`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]`<br>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.<br><br>**_NOTE 1_**: This behaviour is consistant across all places where a channel name is the input.<br><br>**_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.<br> |
-| 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.<br><br>`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]` |
-| ircProxy | Determines which proxy to use to connect to the IRC network:<br>`ircProxy = "socks5://127.0.0.1:9050"` |
-| llmProxy | Determines which proxy to use to connect to the LLM endpoint:<br>`llmProxy = "socks5://127.0.0.1:9050"` |
-| generalProxy | Determines which proxy to use for other things:<br>`llmProxy = "socks5://127.0.0.1:9050"`<br><br>**_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.<br><br>`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"]`<br>`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:<br><br>- `noop` for no syntax highlighting<br>- `terminal` for 8-color terminals<br>- `terminal8` for 8-color terminals<br>- `terminal16` for 16-color terminals<br>- `terminal256` for 256-color terminals<br>- `terminal16m` for truecolor terminals<br>- `html` for HTML output<br><br>**_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:<br><br>- [ollama](https://github.com/ollama/ollama)<br>- chatgpt<br>- gemini<br>- [openrouter](https://openrouter.ai/)<br> |
+| 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.<br><br>`admins = ["admin1", "admin2"]`<br> |
+| ircChannels | List of channels for the bot to join when it connects to the server.<br>`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]`<br>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.<br><br>**_NOTE 1_**: This behaviour is consistant across all places where a channel name is the input.<br><br>**_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.<br> |
+| 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.<br><br>`ircChannels = [["#channel1","channel1password"], ["#channel2",""], ["#channel3"]]` |
+| ircProxy | Determines which proxy to use to connect to the IRC network:<br>`ircProxy = "socks5://127.0.0.1:9050"` |
+| llmProxy | Determines which proxy to use to connect to the LLM endpoint:<br>`llmProxy = "socks5://127.0.0.1:9050"` |
+| generalProxy | Determines which proxy to use for other things:<br>`llmProxy = "socks5://127.0.0.1:9050"`<br><br>**_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.<br><br>`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"]`<br>`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.<br/>
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.<br/>
+### 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:
diff --git a/defaults.go b/defaults.go
new file mode 100644
index 0000000..60217ae
--- /dev/null
+++ b/defaults.go
@@ -0,0 +1,135 @@
+package main
+
+func AddSaneDefaults(config *TomlConfig) {
+ if config.IrcNick == "" {
+ config.IrcNick = "milla"
+ }
+
+ if config.ChromaStyle == "" {
+ config.ChromaStyle = "rose-pine-moon"
+ }
+
+ if config.ChromaFormatter == "" {
+ config.ChromaFormatter = "noop"
+ }
+
+ if config.DatabaseAddress == "" {
+ config.DatabaseAddress = "postgres"
+ }
+
+ if config.DatabaseUser == "" {
+ config.DatabaseUser = "milla"
+ }
+
+ if config.DatabaseName == "" {
+ config.DatabaseName = "milladb"
+ }
+
+ if config.Temperature == 0 {
+ config.Temperature = 0.5
+ }
+
+ if config.RequestTimeout == 0 {
+ config.RequestTimeout = 10
+ }
+
+ if config.MillaReconnectDelay == 0 {
+ config.MillaReconnectDelay = 30
+ }
+
+ if config.IrcPort == 0 {
+ config.IrcPort = 6697
+ }
+
+ if config.KeepAlive == 0 {
+ config.KeepAlive = 600
+ }
+
+ if config.MemoryLimit == 0 {
+ config.MemoryLimit = 20
+ }
+
+ if config.PingDelay == 0 {
+ config.PingDelay = 20
+ }
+
+ if config.PingTimeout == 0 {
+ config.PingTimeout = 20
+ }
+
+ if config.OllamaMirostatEta == 0 {
+ config.OllamaMirostatEta = 0.1
+ }
+
+ if config.OllamaMirostatTau == 0 {
+ config.OllamaMirostatTau = 5.0
+ }
+
+ if config.OllamaNumCtx == 0 {
+ config.OllamaNumCtx = 4096
+ }
+
+ if config.OllamaRepeatLastN == 0 {
+ config.OllamaRepeatLastN = 64
+ }
+
+ if config.OllamaRepeatPenalty == 0 {
+ config.OllamaRepeatPenalty = 1.1
+ }
+
+ if config.OllamaSeed == 0 {
+ config.OllamaSeed = 42
+ }
+
+ if config.OllamaNumPredict == 0 {
+ config.OllamaNumPredict = -1
+ }
+
+ if config.TopK == 0 {
+ config.TopK = 40
+ }
+
+ if config.TopP == 0.0 {
+ config.TopP = 0.9
+ }
+
+ if config.OllamaMinP == 0 {
+ config.OllamaMinP = 0.05
+ }
+
+ if config.Temperature == 0 {
+ config.Temperature = 0.7
+ }
+
+ if config.IrcBackOffMaxInterval == 0 {
+ config.IrcBackOffMaxInterval = 500
+ }
+
+ if config.IrcBackOffRandomizationFactor == 0 {
+ config.IrcBackOffRandomizationFactor = 0.5
+ }
+
+ if config.IrcBackOffMultiplier == 0 {
+ config.IrcBackOffMultiplier = 1.5
+ }
+
+ if config.IrcBackOffMaxInterval == 0 {
+ config.IrcBackOffMaxInterval = 60
+ }
+
+ if config.DbBackOffMaxInterval == 0 {
+ config.DbBackOffMaxInterval = 500
+ }
+
+ if config.DbBackOffRandomizationFactor == 0 {
+ config.DbBackOffRandomizationFactor = 0.5
+ }
+
+ if config.DbBackOffMultiplier == 0 {
+ config.DbBackOffMultiplier = 1.5
+ }
+
+ if config.DbBackOffMaxInterval == 0 {
+ config.DbBackOffMaxInterval = 60
+ }
+}
diff --git a/main.go b/main.go
index f3a5e2d..e3b6ed0 100644
--- a/main.go
+++ b/main.go
@@ -47,108 +47,6 @@ var (
errUnsupportedType = errors.New("unsupported type")
)
-func addSaneDefaults(config *TomlConfig) {
- if config.IrcNick == "" {
- config.IrcNick = "milla"
- }
-
- if config.ChromaStyle == "" {
- config.ChromaStyle = "rose-pine-moon"
- }
-
- if config.ChromaFormatter == "" {
- config.ChromaFormatter = "noop"
- }
-
- if config.DatabaseAddress == "" {
- config.DatabaseAddress = "postgres"
- }
-
- if config.DatabaseUser == "" {
- config.DatabaseUser = "milla"
- }
-
- if config.DatabaseName == "" {
- config.DatabaseName = "milladb"
- }
-
- if config.Temperature == 0 {
- config.Temperature = 0.5
- }
-
- if config.RequestTimeout == 0 {
- config.RequestTimeout = 10
- }
-
- if config.MillaReconnectDelay == 0 {
- config.MillaReconnectDelay = 30
- }
-
- if config.IrcPort == 0 {
- config.IrcPort = 6697
- }
-
- if config.KeepAlive == 0 {
- config.KeepAlive = 600
- }
-
- if config.MemoryLimit == 0 {
- config.MemoryLimit = 20
- }
-
- if config.PingDelay == 0 {
- config.PingDelay = 20
- }
-
- if config.PingTimeout == 0 {
- config.PingTimeout = 20
- }
-
- if config.OllamaMirostatEta == 0 {
- config.OllamaMirostatEta = 0.1
- }
-
- if config.OllamaMirostatTau == 0 {
- config.OllamaMirostatTau = 5.0
- }
-
- if config.OllamaNumCtx == 0 {
- config.OllamaNumCtx = 4096
- }
-
- if config.OllamaRepeatLastN == 0 {
- config.OllamaRepeatLastN = 64
- }
-
- if config.OllamaRepeatPenalty == 0 {
- config.OllamaRepeatPenalty = 1.1
- }
-
- if config.OllamaSeed == 0 {
- config.OllamaSeed = 42
- }
-
- if config.OllamaNumPredict == 0 {
- config.OllamaNumPredict = -1
- }
-
- if config.TopK == 0 {
- config.TopK = 40
- }
-
- if config.TopP == 0.0 {
- config.TopP = 0.9
- }
-
- if config.OllamaMinP == 0 {
- config.OllamaMinP = 0.05
- }
-
- if config.Temperature == 0 {
- config.Temperature = 0.7
- }
-}
-
func getTableFromChanName(channel, ircdName string) string {
tableName := ircdName + "_" + channel
tableName = strings.ReplaceAll(tableName, "#", "")
@@ -1221,7 +1119,14 @@ func connectToDB(appConfig *TomlConfig, ctx *context.Context, irc *girc.Client)
return pgxpool.NewWithConfig(*ctx, poolConfig)
}
- pool, err = backoff.Retry(*ctx, dbConnect, backoff.WithBackOff(backoff.NewExponentialBackOff()))
+ expBackoff := backoff.WithBackOff(&backoff.ExponentialBackOff{
+ InitialInterval: time.Millisecond * time.Duration(appConfig.DbBackOffInitialInterval),
+ RandomizationFactor: appConfig.DbBackOffRandomizationFactor,
+ Multiplier: appConfig.DbBackOffMultiplier,
+ MaxInterval: time.Second * time.Duration(appConfig.DbBackOffMaxInterval),
+ })
+
+ pool, err = backoff.Retry(*ctx, dbConnect, expBackoff)
if err != nil {
LogError(err)
}
@@ -1542,7 +1447,14 @@ func runIRC(appConfig TomlConfig) {
defer cancel()
for {
- _, err := backoff.Retry(ctx, connectToIRC, backoff.WithBackOff(backoff.NewExponentialBackOff()))
+ expBackoff := backoff.WithBackOff(&backoff.ExponentialBackOff{
+ InitialInterval: time.Millisecond * time.Duration(appConfig.IrcBackOffInitialInterval),
+ RandomizationFactor: appConfig.IrcBackOffRandomizationFactor,
+ Multiplier: appConfig.IrcBackOffMultiplier,
+ MaxInterval: time.Second * time.Duration(appConfig.IrcBackOffMaxInterval),
+ })
+
+ _, err := backoff.Retry(ctx, connectToIRC, expBackoff)
if err != nil {
LogError(err)
} else {
@@ -1578,7 +1490,7 @@ func main() {
}
for key, value := range config.Ircd {
- addSaneDefaults(&value)
+ AddSaneDefaults(&value)
value.IRCDName = key
config.Ircd[key] = value
}
diff --git a/types.go b/types.go
index bfc0216..be8b064 100644
--- a/types.go
+++ b/types.go
@@ -19,6 +19,12 @@ type LogModel struct {
// DateAdded pgtype.Date `db:"dateadded"`
}
+type PluginType struct {
+ Name string `toml:"name"`
+ Path string `toml:"path"`
+ EnvVars [][]string `toml:"envVars"`
+}
+
type CustomCommand struct {
SQL string `toml:"sql"`
Limit int `toml:"limit"`
@@ -60,74 +66,82 @@ type RssFile struct {
}
type TomlConfig struct {
- IrcServer string `toml:"ircServer"`
- IrcNick string `toml:"ircNick"`
- IrcSaslUser string `toml:"ircSaslUser"`
- IrcSaslPass string `toml:"ircSaslPass"`
- Endpoint string `toml:"endpoint"`
- Model string `toml:"model"`
- ChromaStyle string `toml:"chromaStyle"`
- ChromaFormatter string `toml:"chromaFormatter"`
- Provider string `toml:"provider"`
- Apikey string `toml:"apikey"`
- ClientCertPath string `toml:"clientCertPath"`
- ServerPass string `toml:"serverPass"`
- Bind string `toml:"bind"`
- Name string `toml:"name"`
- DatabaseAddress string `toml:"databaseAddress"`
- DatabasePassword string `toml:"databasePassword"`
- DatabaseUser string `toml:"databaseUser"`
- DatabaseName string `toml:"databaseName"`
- LLMProxy string `toml:"llmProxy"`
- IRCProxy string `toml:"ircProxy"`
- GeneralProxy string `toml:"generalProxy"`
- IRCDName string `toml:"ircdName"`
- WebIRCPassword string `toml:"webIRCPassword"`
- WebIRCGateway string `toml:"webIRCGateway"`
- WebIRCHostname string `toml:"webIRCHostname"`
- WebIRCAddress string `toml:"webIRCAddress"`
- RSSFile string `toml:"rssFile"`
- AnthropicVersion string `toml:"anthropicVersion"`
- Plugins []string `toml:"plugins"`
- Context []string `toml:"context"`
- SystemPrompt string `toml:"systemPrompt"`
- CustomCommands map[string]CustomCommand `toml:"customCommands"`
- WatchLists map[string]WatchList `toml:"watchList"`
- LuaStates map[string]LuaLstates
- LuaCommands map[string]LuaCommand
- TriggeredScripts map[string]TriggeredScripts
- Rss map[string]RssFile `toml:"rss"`
- RequestTimeout int `toml:"requestTimeout"`
- MillaReconnectDelay int `toml:"millaReconnectDelay"`
- IrcPort int `toml:"ircPort"`
- KeepAlive int `toml:"keepAlive"`
- MemoryLimit int `toml:"memoryLimit"`
- PingDelay int `toml:"pingDelay"`
- PingTimeout int `toml:"pingTimeout"`
- OllamaMirostat int `json:"ollamaMirostat"`
- OllamaMirostatEta float64 `json:"ollamaMirostatEta"`
- OllamaMirostatTau float64 `json:"ollamaMirostatTau"`
- OllamaNumCtx int `json:"ollamaNumCtx"`
- OllamaRepeatLastN int `json:"ollamaRepeatLastN"`
- OllamaRepeatPenalty float64 `json:"ollamaRepeatPenalty"`
- Temperature float64 `json:"temperature"`
- OllamaSeed int `json:"ollamaSeed"`
- OllamaNumPredict int `json:"ollamaNumPredict"`
- OllamaMinP float64 `json:"ollamaMinP"`
- TopP float32 `toml:"topP"`
- TopK int32 `toml:"topK"`
- EnableSasl bool `toml:"enableSasl"`
- SkipTLSVerify bool `toml:"skipTLSVerify"`
- UseTLS bool `toml:"useTLS"`
- DisableSTSFallback bool `toml:"disableSTSFallback"`
- AllowFlood bool `toml:"allowFlood"`
- Debug bool `toml:"debug"`
- Out bool `toml:"out"`
- AdminOnly bool `toml:"adminOnly"`
- pool *pgxpool.Pool
- Admins []string `toml:"admins"`
- IrcChannels [][]string `toml:"ircChannels"`
- ScrapeChannels [][]string `toml:"scrapeChannels"`
+ IrcServer string `toml:"ircServer"`
+ IrcNick string `toml:"ircNick"`
+ IrcSaslUser string `toml:"ircSaslUser"`
+ IrcSaslPass string `toml:"ircSaslPass"`
+ Endpoint string `toml:"endpoint"`
+ Model string `toml:"model"`
+ ChromaStyle string `toml:"chromaStyle"`
+ ChromaFormatter string `toml:"chromaFormatter"`
+ Provider string `toml:"provider"`
+ Apikey string `toml:"apikey"`
+ ClientCertPath string `toml:"clientCertPath"`
+ ServerPass string `toml:"serverPass"`
+ Bind string `toml:"bind"`
+ Name string `toml:"name"`
+ DatabaseAddress string `toml:"databaseAddress"`
+ DatabasePassword string `toml:"databasePassword"`
+ DatabaseUser string `toml:"databaseUser"`
+ DatabaseName string `toml:"databaseName"`
+ LLMProxy string `toml:"llmProxy"`
+ IRCProxy string `toml:"ircProxy"`
+ GeneralProxy string `toml:"generalProxy"`
+ IRCDName string `toml:"ircdName"`
+ WebIRCPassword string `toml:"webIRCPassword"`
+ WebIRCGateway string `toml:"webIRCGateway"`
+ WebIRCHostname string `toml:"webIRCHostname"`
+ WebIRCAddress string `toml:"webIRCAddress"`
+ RSSFile string `toml:"rssFile"`
+ AnthropicVersion string `toml:"anthropicVersion"`
+ Plugins []string `toml:"plugins"`
+ Context []string `toml:"context"`
+ SystemPrompt string `toml:"systemPrompt"`
+ CustomCommands map[string]CustomCommand `toml:"customCommands"`
+ WatchLists map[string]WatchList `toml:"watchList"`
+ LuaStates map[string]LuaLstates
+ LuaCommands map[string]LuaCommand
+ TriggeredScripts map[string]TriggeredScripts
+ Rss map[string]RssFile `toml:"rss"`
+ RequestTimeout int `toml:"requestTimeout"`
+ MillaReconnectDelay int `toml:"millaReconnectDelay"`
+ IrcPort int `toml:"ircPort"`
+ KeepAlive int `toml:"keepAlive"`
+ MemoryLimit int `toml:"memoryLimit"`
+ PingDelay int `toml:"pingDelay"`
+ PingTimeout int `toml:"pingTimeout"`
+ OllamaMirostat int `json:"ollamaMirostat"`
+ OllamaMirostatEta float64 `json:"ollamaMirostatEta"`
+ OllamaMirostatTau float64 `json:"ollamaMirostatTau"`
+ OllamaNumCtx int `json:"ollamaNumCtx"`
+ OllamaRepeatLastN int `json:"ollamaRepeatLastN"`
+ OllamaRepeatPenalty float64 `json:"ollamaRepeatPenalty"`
+ Temperature float64 `json:"temperature"`
+ OllamaSeed int `json:"ollamaSeed"`
+ OllamaNumPredict int `json:"ollamaNumPredict"`
+ OllamaMinP float64 `json:"ollamaMinP"`
+ TopP float32 `toml:"topP"`
+ TopK int32 `toml:"topK"`
+ IrcBackOffInitialInterval int `toml:"ircBackOffInitialInterval"`
+ IrcBackOffRandomizationFactor float64 `toml:"ircbackOffRandomizationFactor"`
+ IrcBackOffMultiplier float64 `toml:"ircBackOffMultiplier"`
+ IrcBackOffMaxInterval int `toml:"ircBackOffMaxInterval"`
+ DbBackOffInitialInterval int `toml:"dbBackOffInitialInterval"`
+ DbBackOffRandomizationFactor float64 `toml:"dbBackOffRandomizationFactor"`
+ DbBackOffMultiplier float64 `toml:"dbBackOffMultiplier"`
+ DbBackOffMaxInterval int `toml:"dbBackOffMaxInterval"`
+ EnableSasl bool `toml:"enableSasl"`
+ SkipTLSVerify bool `toml:"skipTLSVerify"`
+ UseTLS bool `toml:"useTLS"`
+ DisableSTSFallback bool `toml:"disableSTSFallback"`
+ AllowFlood bool `toml:"allowFlood"`
+ Debug bool `toml:"debug"`
+ Out bool `toml:"out"`
+ AdminOnly bool `toml:"adminOnly"`
+ pool *pgxpool.Pool
+ Admins []string `toml:"admins"`
+ IrcChannels [][]string `toml:"ircChannels"`
+ ScrapeChannels [][]string `toml:"scrapeChannels"`
}
func (config *TomlConfig) insertLState(