diff --git a/Chat.go b/Chat.go index cf2fc7c..e4f90c5 100644 --- a/Chat.go +++ b/Chat.go @@ -325,10 +325,10 @@ func LoadUsageKPIHandler(c *fiber.Ctx) error { return c.SendString(out) } -func LoadSettingsHandler(c *fiber.Ctx) error { +func LoadKeysHandler(c *fiber.Ctx) error { openaiExists, anthropicExists, mistralExists := getExistingKeys() - out, err := pongo2.Must(pongo2.FromFile("views/partials/popover-settings.html")).Execute(pongo2.Context{"IsLogin": checkIfLogin(), "OpenaiExists": openaiExists, "AnthropicExists": anthropicExists, "MistralExists": mistralExists}) + out, err := pongo2.Must(pongo2.FromFile("views/partials/popover-keys.html")).Execute(pongo2.Context{"IsLogin": checkIfLogin(), "OpenaiExists": openaiExists, "AnthropicExists": anthropicExists, "MistralExists": mistralExists}) if err != nil { c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ "error": "Error rendering template", @@ -385,3 +385,13 @@ func LoadModelSelectionHandler(c *fiber.Ctx) error { } return c.SendString(out) } + +func LoadSettingsHandler(c *fiber.Ctx) error { + out, err := pongo2.Must(pongo2.FromFile("views/partials/popover-settings.html")).Execute(pongo2.Context{"IsLogin": checkIfLogin()}) + if err != nil { + c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ + "error": "Error rendering template", + }) + } + return c.SendString(out) +} diff --git a/main.go b/main.go index d4be8f3..240f569 100644 --- a/main.go +++ b/main.go @@ -49,6 +49,7 @@ func main() { // Popovers app.Get("/loadModelSelection", LoadModelSelectionHandler) app.Get("/loadUsageKPI", LoadUsageKPIHandler) + app.Get("/loadKeys", LoadKeysHandler) app.Get("/loadSettings", LoadSettingsHandler) // Authentication diff --git a/views/chat.html b/views/chat.html index 07a56f1..7f76330 100644 --- a/views/chat.html +++ b/views/chat.html @@ -9,6 +9,7 @@ placeholder="Type your message here..." name="message">
+