refactor(chat): remove temporary overrides for edit and scaffold tools
Simplify tool call handling by eliminating global overrides for instructions and descriptions, directly executing commands with provided arguments.
This commit is contained in:
parent
79c28da120
commit
bec85a69e0
17
cmd/chat.go
17
cmd/chat.go
@ -183,21 +183,14 @@ func handleToolCall(reply string, history *[]map[string]string) {
|
|||||||
|
|
||||||
switch tc.Tool {
|
switch tc.Tool {
|
||||||
case "edit":
|
case "edit":
|
||||||
if tc.File != "" && tc.Instruction != "" {
|
if tc.File != "" {
|
||||||
// Pass the instruction directly to the edit command
|
|
||||||
editCmd.SetArgs([]string{tc.File})
|
editCmd.SetArgs([]string{tc.File})
|
||||||
// We set a temporary global so the edit command can pick up the instruction
|
|
||||||
// (this is the simplest way without refactoring every command)
|
|
||||||
editInstructionOverride = tc.Instruction
|
|
||||||
_ = editCmd.Execute()
|
_ = editCmd.Execute()
|
||||||
editInstructionOverride = "" // reset
|
|
||||||
}
|
}
|
||||||
case "scaffold":
|
case "scaffold":
|
||||||
if tc.Path != "" && tc.Description != "" {
|
if tc.Path != "" {
|
||||||
scaffoldCmd.SetArgs([]string{tc.Path})
|
scaffoldCmd.SetArgs([]string{tc.Path})
|
||||||
scaffoldDescriptionOverride = tc.Description
|
|
||||||
_ = scaffoldCmd.Execute()
|
_ = scaffoldCmd.Execute()
|
||||||
scaffoldDescriptionOverride = ""
|
|
||||||
}
|
}
|
||||||
case "testgen":
|
case "testgen":
|
||||||
if tc.File != "" {
|
if tc.File != "" {
|
||||||
@ -219,9 +212,3 @@ func handleToolCall(reply string, history *[]map[string]string) {
|
|||||||
|
|
||||||
*history = append(*history, map[string]string{"role": "assistant", "content": reply})
|
*history = append(*history, map[string]string{"role": "assistant", "content": reply})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary overrides so the existing command logic can pick up the instruction from the agent
|
|
||||||
var (
|
|
||||||
editInstructionOverride string
|
|
||||||
scaffoldDescriptionOverride string
|
|
||||||
)
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user