diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-07 23:54:32 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-08 06:27:34 +0000 |
| commit | d422394021e4fb9ddb5405024468f03d962c5f5d (patch) | |
| tree | e3d4ef9c9b49aee21cba553c33abbbbdb7359f72 /internal/api/templates.go | |
| parent | c6ce11e17af9a4b62bbbc082e5f13bb3a3b656a6 (diff) | |
feat(api): update template handlers to use AgentConfig
Diffstat (limited to 'internal/api/templates.go')
| -rw-r--r-- | internal/api/templates.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/api/templates.go b/internal/api/templates.go index 0139895..024a6df 100644 --- a/internal/api/templates.go +++ b/internal/api/templates.go @@ -27,7 +27,7 @@ func (s *Server) handleCreateTemplate(w http.ResponseWriter, r *http.Request) { var input struct { Name string `json:"name"` Description string `json:"description"` - Claude task.ClaudeConfig `json:"claude"` + Agent task.AgentConfig `json:"agent"` Timeout string `json:"timeout"` Priority string `json:"priority"` Tags []string `json:"tags"` @@ -46,13 +46,16 @@ func (s *Server) handleCreateTemplate(w http.ResponseWriter, r *http.Request) { ID: uuid.New().String(), Name: input.Name, Description: input.Description, - Claude: input.Claude, + Agent: input.Agent, Timeout: input.Timeout, Priority: input.Priority, Tags: input.Tags, CreatedAt: now, UpdatedAt: now, } + if tmpl.Agent.Type == "" { + tmpl.Agent.Type = "claude" + } if tmpl.Priority == "" { tmpl.Priority = "normal" } @@ -98,7 +101,7 @@ func (s *Server) handleUpdateTemplate(w http.ResponseWriter, r *http.Request) { var input struct { Name string `json:"name"` Description string `json:"description"` - Claude task.ClaudeConfig `json:"claude"` + Agent task.AgentConfig `json:"agent"` Timeout string `json:"timeout"` Priority string `json:"priority"` Tags []string `json:"tags"` @@ -114,7 +117,10 @@ func (s *Server) handleUpdateTemplate(w http.ResponseWriter, r *http.Request) { existing.Name = input.Name existing.Description = input.Description - existing.Claude = input.Claude + existing.Agent = input.Agent + if existing.Agent.Type == "" { + existing.Agent.Type = "claude" + } existing.Timeout = input.Timeout existing.Priority = input.Priority if input.Tags != nil { |
