summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/api/elaborate.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/api/elaborate.go b/internal/api/elaborate.go
index d275d61..00f3297 100644
--- a/internal/api/elaborate.go
+++ b/internal/api/elaborate.go
@@ -86,7 +86,8 @@ func (s *Server) claudeBinaryPath() string {
func (s *Server) handleElaborateTask(w http.ResponseWriter, r *http.Request) {
var input struct {
- Prompt string `json:"prompt"`
+ Prompt string `json:"prompt"`
+ WorkingDir string `json:"working_dir"`
}
if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "invalid JSON: " + err.Error()})
@@ -97,12 +98,17 @@ func (s *Server) handleElaborateTask(w http.ResponseWriter, r *http.Request) {
return
}
+ workDir := s.workDir
+ if input.WorkingDir != "" {
+ workDir = input.WorkingDir
+ }
+
ctx, cancel := context.WithTimeout(r.Context(), elaborateTimeout)
defer cancel()
cmd := exec.CommandContext(ctx, s.claudeBinaryPath(),
"-p", input.Prompt,
- "--system-prompt", buildElaboratePrompt(s.workDir),
+ "--system-prompt", buildElaboratePrompt(workDir),
"--output-format", "json",
"--model", "haiku",
)