ai work started
This commit is contained in:
34
plugins/testrp.go
Normal file
34
plugins/testrp.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"kurumibot/laniakea"
|
||||
"kurumibot/utils/ai"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func RegisterTestRP(bot *laniakea.Bot) {
|
||||
rp := laniakea.NewPlugin("RP")
|
||||
rp = rp.Command(generate, "g", "gen")
|
||||
|
||||
bot.AddPlugins(rp.Build())
|
||||
}
|
||||
|
||||
func generate(ctx *laniakea.MsgContext, db *laniakea.DatabaseContext) {
|
||||
api := ai.NewOpenAIAPI(ai.CosmoRPUrl, os.Getenv("PAWAN_KEY"), "cosmorp-2.5")
|
||||
res, err := api.CreateCompletion(ai.CreateCompletionReq{
|
||||
Model: "cosmorp-2.5",
|
||||
Messages: []ai.Message{
|
||||
{
|
||||
Role: "developer",
|
||||
Content: "123",
|
||||
},
|
||||
{
|
||||
Role: "user",
|
||||
Content: strings.Join(ctx.Args, " "),
|
||||
},
|
||||
},
|
||||
})
|
||||
log.Println(res, err)
|
||||
}
|
||||
Reference in New Issue
Block a user