add start/pause (to improve further)

This commit is contained in:
Ettore Di Giacinto
2024-04-13 00:38:58 +02:00
parent 74b158e9f1
commit 54de6221d1
4 changed files with 77 additions and 0 deletions

View File

@@ -24,8 +24,13 @@ func RegisterRoutes(webapp *fiber.App, pool *AgentPool, db *InMemoryDatabase, ap
})
webapp.Get("/agents", func(c *fiber.Ctx) error {
statuses := map[string]bool{}
for _, a := range pool.List() {
statuses[a] = !pool.GetAgent(a).Paused()
}
return c.Render("views/agents", fiber.Map{
"Agents": pool.List(),
"Status": statuses,
})
})
@@ -72,6 +77,8 @@ func RegisterRoutes(webapp *fiber.App, pool *AgentPool, db *InMemoryDatabase, ap
webapp.Post("/chat/:name", app.Chat(pool))
webapp.Post("/create", app.Create(pool))
webapp.Get("/delete/:name", app.Delete(pool))
webapp.Put("/pause/:name", app.Pause(pool))
webapp.Put("/start/:name", app.Start(pool))
webapp.Post("/knowledgebase", app.KnowledgeBase(db))
webapp.Post("/knowledgebase/upload", app.KnowledgeBaseFile(db))