Jade/LLM.go
2024-05-18 14:51:48 +02:00

37 lines
752 B
Go

package main
import (
"fmt"
"github.com/edgedb/edgedb-go"
"github.com/flosch/pongo2"
"github.com/gofiber/fiber/v2"
)
// LLM stuff
func deleteLLM(c *fiber.Ctx) error {
id := c.FormValue("id")
idUUID, _ := edgedb.ParseUUID(id)
err := edgeClient.Execute(edgeCtx, `
DELETE LLM
FILTER .id = <uuid>$0;
`, idUUID)
if err != nil {
fmt.Println("Error in edgeClient.Execute: in deleteLLM")
fmt.Println(err)
}
return c.SendString("")
}
func openLlmModal(c *fiber.Ctx) error {
out, err := pongo2.Must(pongo2.FromFile("views/partials/modal-llm-setting.html")).Execute(pongo2.Context{})
if err != nil {
c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "Error rendering template",
})
}
return c.SendString(out)
}