agent fix
This commit is contained in:
@@ -56,9 +56,16 @@ type assistantAskRequest struct {
|
||||
// built, and this is what finally answers that question at runtime rather than
|
||||
// at build time.
|
||||
func (ctl *AssistantController) Status(c *fiber.Ctx) error {
|
||||
details := fiber.Map{"available": ctl.assistant.Available()}
|
||||
// Named "reason" rather than "error": not having an assistant is a
|
||||
// deployment choice, and the same field answers "we have not switched it
|
||||
// on" and "somebody misspelled a variable" — which are the two states that
|
||||
// looked identical from outside.
|
||||
if why := ctl.assistant.Unavailable(); why != "" {
|
||||
details["reason"] = why
|
||||
}
|
||||
return c.Status(http.StatusOK).JSON(fiber.Map{
|
||||
"code": http.StatusOK, "status": true, "message": "Success",
|
||||
"details": fiber.Map{"available": ctl.assistant.Available()},
|
||||
"code": http.StatusOK, "status": true, "message": "Success", "details": details,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user