package main

import (
	"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 {
		panic(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 {
		panic(err)
	}
	return c.SendString(out)
}
