api key integration

This commit is contained in:
2026-09-24 11:01:16 +05:30
parent 697b77f8c1
commit 9698de32d5
9 changed files with 503 additions and 10 deletions

View File

@@ -98,6 +98,13 @@ func (ctl *AssistantController) Ask(c *fiber.Ctx) error {
"message": "Nearle Buddy is not switched on for this deployment.",
})
}
// Asking too fast gets its own status, so the console and whatever
// watches it can tell "you are going too quickly" apart from "that
// question was malformed". The message already says how long to wait.
var tooFast services.ErrTooFast
if errors.As(err, &tooFast) {
return assistantRefuse(c, http.StatusTooManyRequests, err.Error())
}
return assistantRefuse(c, http.StatusBadRequest, err.Error())
}