diff options
-rw-r--r-- | README.md | 21 | ||||
-rw-r--r-- | config-example.toml | 13 | ||||
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | plugins.go | 2 | ||||
-rw-r--r-- | scripts/entry_limit_trigger.pgsql | 19 | ||||
-rw-r--r-- | shell.nix | 4 |
7 files changed, 54 insertions, 8 deletions
@@ -295,7 +295,8 @@ ircProxy = "socks5://127.0.0.1:9050" llmProxy = "http://127.0.0.1:8180" skipTLSVerify = false useTLS = true -plugins = ["./plugins/rss.lua"] +plugins = ["/plugins/plugin1.lua", "/plugins/plugin2.lua"] +adminOnly = false [ircd.liberanet] ircServer = "irc.libera.chat" @@ -323,14 +324,17 @@ debug = true out = true ircProxy = "socks5://127.0.0.1:9051" llmProxy = "http://127.0.0.1:8181" -[ircd.liberanet.customCommands.digest] -sql = "select log from liberanet_milla_us_market_news;" -limit = 10 -prompt = "give me digest of the provided news" -[ircd.liberanet.customCommands.summarize] -sql= "select log from liberanet_milla_us_market_news;" +adminOnly = true +[ircd.devinet_terra.customCommands.digest] +sql = "select log from liberanet_milla_us_market_news order by log desc;" +limit = 300 +context = ["you are a sentiment-analysis bot"] +prompt= "i have provided to you news headlines in the form of previous conversations between you and me using the user role. please provide the digest of the news for me." +[ircd.devinet_terra.customCommands.summarize] +sql= "select log from liberanet_milla_us_market_news order by log desc;" limit= 300 -prompt= "given all the data, summarize the news for me" +context = ["you are a sentiment-analysis bot"] +prompt= "i have provided to you news headlines in the form of previous conversations between you and me using the user role. please summarize the provided news for me. provide some details." ``` ## Commands @@ -693,6 +697,7 @@ The following libraries are loaded by milla by default: - [gluahttp](https://github.com/cjoudrey/gluahttp) - [gluayaml](https://github.com/kohkimakimoto/gluayaml) - [gluasocket](https://gitlab.com/megalithic-llc/gluasocket) +- [gluare](https://github.com/yuin/gluare) ## FAQ diff --git a/config-example.toml b/config-example.toml index 60f32a4..2b12ecb 100644 --- a/config-example.toml +++ b/config-example.toml @@ -27,6 +27,8 @@ ircProxy = "socks5://127.0.0.1:9050" llmProxy = "http://127.0.0.1:8180" skipTLSVerify = false useTLS = true +plugins = ["/plugins/plugin1.lua", "/plugins/plugin2.lua"] +adminOnly = false [ircd.liberanet] ircServer = "irc.libera.chat" @@ -54,3 +56,14 @@ debug = true out = true ircProxy = "socks5://127.0.0.1:9051" llmProxy = "http://127.0.0.1:8181" +adminOnly = true +[ircd.devinet_terra.customCommands.digest] +sql = "select log from liberanet_milla_us_market_news order by log desc;" +limit = 300 +context = ["you are a sentiment-analysis bot"] +prompt= "i have provided to you news headlines in the form of previous conversations between you and me using the user role. please provide the digest of the news for me." +[ircd.devinet_terra.customCommands.summarize] +sql= "select log from liberanet_milla_us_market_news order by log desc;" +limit= 300 +context = ["you are a sentiment-analysis bot"] +prompt= "i have provided to you news headlines in the form of previous conversations between you and me using the user role. please summarize the provided news for me. provide some details." @@ -12,6 +12,7 @@ require ( github.com/kohkimakimoto/gluayaml v0.0.0-20160815032708-6fe413d49d73 github.com/lrstanley/girc v0.0.0-20240125042120-9add3166e52e github.com/sashabaranov/go-openai v1.19.3 + github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed github.com/yuin/gopher-lua v1.1.1 gitlab.com/megalithic-llc/gluasocket v0.3.1 golang.org/x/net v0.24.0 @@ -113,6 +113,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed h1:I1vcLHWU9m30rA90rMrKPu0eD3NDA4FBlkB8WMaDyUw= +github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed/go.mod h1:9w6KSdZh23UWqOywWsRLUcJUrUNjRh4Ql3z9uVgnSP4= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= gitlab.com/megalithic-llc/gluasocket v0.3.1 h1:CtsSTZa3G5WnMbhZ3TgvpLwpVlQv6KjO2mqxNOGrhY4= @@ -13,6 +13,7 @@ import ( "github.com/kohkimakimoto/gluayaml" "github.com/lrstanley/girc" openai "github.com/sashabaranov/go-openai" + "github.com/yuin/gluare" lua "github.com/yuin/gopher-lua" "gitlab.com/megalithic-llc/gluasocket" ) @@ -332,6 +333,7 @@ func RunScript(scriptPath string, client *girc.Client, appConfig *TomlConfig) { gluaxmlpath.Preload(luaState) luaState.PreloadModule("http", gluahttp.NewHttpModule(&http.Client{}).Loader) luaState.PreloadModule("yaml", gluayaml.Loader) + luaState.PreloadModule("re", gluare.Loader) log.Print("Running script: ", scriptPath) diff --git a/scripts/entry_limit_trigger.pgsql b/scripts/entry_limit_trigger.pgsql new file mode 100644 index 0000000..d7d99c2 --- /dev/null +++ b/scripts/entry_limit_trigger.pgsql @@ -0,0 +1,19 @@ +CREATE OR REPLACE FUNCTION milla.janitor () + RETURNS TRIGGER + AS $$ +BEGIN + UPDATE + posts + SET + updated_at = now() + WHERE + id = NEW.id; + RETURN new; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER janitor_trigger + AFTER INSERT ON milla.tables + EXECUTE PROCEDURE milla.janitor (); + diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..442fa42 --- /dev/null +++ b/shell.nix @@ -0,0 +1,4 @@ +{ pkgs ? import <nixpkgs> {} }: + pkgs.mkShell { + nativeBuildInputs = with pkgs.buildPackages; [ pgformatter ]; +} |