Skip to content

Commit

Permalink
added a shell.nix for pgformatter, and a wip trigger for db size main…
Browse files Browse the repository at this point in the history
…tenance
  • Loading branch information
terminaldweller committed Jun 11, 2024
1 parent d1af44b commit 556c839
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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."
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 2 additions & 0 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)

Expand Down
19 changes: 19 additions & 0 deletions scripts/entry_limit_trigger.pgsql
Original file line number Diff line number Diff line change
@@ -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 ();

4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [ pgformatter ];
}

0 comments on commit 556c839

Please sign in to comment.