agent fix

This commit is contained in:
2026-09-24 12:36:33 +05:30
parent 294fb8ab93
commit bb14445e21
10 changed files with 661 additions and 15 deletions

View File

@@ -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,
})
}