fix agent hot-reload issue and added list agents endpoint

This commit is contained in:
yusing
2025-02-11 12:45:34 +08:00
parent 429a77de8e
commit 71619042fd
6 changed files with 47 additions and 16 deletions

View File

@@ -28,6 +28,7 @@ const (
ListHomepageCategories = "homepage_categories"
ListIcons = "icons"
ListTasks = "tasks"
ListAgents = "agents"
)
func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
@@ -77,6 +78,8 @@ func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
U.RespondJSON(w, r, icons)
case ListTasks:
U.RespondJSON(w, r, task.DebugTaskList())
case ListAgents:
U.RespondJSON(w, r, cfg.ListAgents())
default:
U.HandleErr(w, r, U.ErrInvalidKey("what"), http.StatusBadRequest)
}