Grow the task switcher's box and let it attach images
This commit is contained in:
@@ -326,8 +326,8 @@ func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, projectID st
|
||||
}
|
||||
|
||||
if req.Workflow != nil {
|
||||
if req.Prompt != nil {
|
||||
writeError(w, http.StatusBadRequest, errors.New("prompt can't be given with workflow"))
|
||||
if req.Prompt != nil || req.Images != nil {
|
||||
writeError(w, http.StatusBadRequest, errors.New("prompt and images can't be given with workflow"))
|
||||
return
|
||||
}
|
||||
if title == "" {
|
||||
@@ -348,7 +348,12 @@ func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, projectID st
|
||||
return
|
||||
}
|
||||
|
||||
if req.Prompt == nil {
|
||||
images, ok := s.images(w, r, req.Images)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if req.Prompt == nil && len(images) == 0 {
|
||||
t, err := s.agents.CreateTask(r.Context(), p, title, actor(r), p.DefaultBranch, actor(r))
|
||||
if err != nil {
|
||||
writeAgentError(w, err)
|
||||
@@ -358,7 +363,11 @@ func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, projectID st
|
||||
return
|
||||
}
|
||||
|
||||
if strings.TrimSpace(*req.Prompt) == "" {
|
||||
prompt := ""
|
||||
if req.Prompt != nil {
|
||||
prompt = *req.Prompt
|
||||
}
|
||||
if strings.TrimSpace(prompt) == "" && len(images) == 0 {
|
||||
writeError(w, http.StatusBadRequest, errors.New("prompt is empty"))
|
||||
return
|
||||
}
|
||||
@@ -371,7 +380,7 @@ func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, projectID st
|
||||
if req.Model != nil {
|
||||
model = *req.Model
|
||||
}
|
||||
t, err := s.agents.StartTask(r.Context(), p, u, title, *req.Prompt, model)
|
||||
t, err := s.agents.StartTask(r.Context(), p, u, title, prompt, model, images)
|
||||
if err != nil {
|
||||
writeAgentError(w, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user