Feat: remove bot

This commit is contained in:
Grail Finder
2025-06-27 07:35:25 +03:00
parent 12fe92b261
commit 86b1ecf82e
9 changed files with 165 additions and 100 deletions

View File

@ -194,3 +194,18 @@ func HandleAddBot(w http.ResponseWriter, r *http.Request) {
// go bot.StartBot()
notify(models.NotifyRoomUpdatePrefix+fi.Room.ID, "")
}
func HandleRemoveBot(w http.ResponseWriter, r *http.Request) {
botName := r.URL.Query().Get("bot")
log.Debug("got remove-bot request", "bot_name", botName)
fi, err := getFullInfoByCtx(r.Context())
if err != nil {
abortWithError(w, err.Error())
return
}
if err := llmapi.RemoveBot(botName, fi.Room); err != nil {
abortWithError(w, err.Error())
return
}
notify(models.NotifyRoomUpdatePrefix+fi.Room.ID, "")
}