ai work started

This commit is contained in:
2026-01-12 16:56:02 +03:00
parent bcf9f5f813
commit edc9614b83
8 changed files with 2649 additions and 2 deletions

34
plugins/testrp.go Normal file
View 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)
}