File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // Package qunyou ...
2+ package qunyou
3+
4+ import (
5+ "os/exec"
6+ "strings"
7+
8+ nano "github.com/fumiama/NanoBot"
9+
10+ "github.com/FloatTech/NanoBot-Plugin/utils/ctxext"
11+ ctrl "github.com/FloatTech/zbpctrl"
12+ )
13+
14+ func init () {
15+ en := nano .Register ("qunyou" , & ctrl.Options [* nano.Ctx ]{
16+ DisableOnDefault : false ,
17+ Help : "随机群友怪话\n - 看看群友" ,
18+ })
19+ en .OnMessagePrefix ("看看群友" ).Limit (ctxext .LimitByGroup ).Handle (func (ctx * nano.Ctx ) {
20+ prompt := ctx .State ["args" ].(string )
21+ sb := strings.Builder {}
22+ cmd := exec.Cmd {
23+ Path : "/usr/local/bin/llama2.run" ,
24+ Args : []string {"model.bin" },
25+ Dir : "/usr/local/src/llama2.c" ,
26+ Stdout : & sb ,
27+ }
28+ if prompt != "" {
29+ cmd .Args = append (cmd .Args , "-i" , prompt )
30+ }
31+ err := cmd .Run ()
32+ if err != nil {
33+ ctx .SendChain (nano .Text ("ERROR: " , err ))
34+ return
35+ }
36+ ctx .SendChain (nano .Text (sb .String ()))
37+ })
38+ }
You can’t perform that action at this time.
0 commit comments