diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-14 11:24:36 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-21 13:41:27 +0200 |
| commit | 0b3e5f5bd42a02c2a15b394b3768e517dc43f39c (patch) | |
| tree | 578f95913a12eebda908384f45e1d0e27977ba20 /internal/llm/tools/edit.go | |
| parent | 921f5ee5bd74837ff4566fc2d1e45051c87d9c38 (diff) | |
| download | opencode-0b3e5f5bd42a02c2a15b394b3768e517dc43f39c.tar.gz opencode-0b3e5f5bd42a02c2a15b394b3768e517dc43f39c.zip | |
handle errors correctly in the other tools
Diffstat (limited to 'internal/llm/tools/edit.go')
| -rw-r--r-- | internal/llm/tools/edit.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/llm/tools/edit.go b/internal/llm/tools/edit.go index 46b95aea2..b74e42729 100644 --- a/internal/llm/tools/edit.go +++ b/internal/llm/tools/edit.go @@ -27,8 +27,9 @@ type EditPermissionsParams struct { } type EditResponseMetadata struct { - Additions int `json:"additions"` - Removals int `json:"removals"` + Diff string `json:"diff"` + Additions int `json:"additions"` + Removals int `json:"removals"` } type editTool struct { @@ -216,6 +217,7 @@ func (e *editTool) createNewFile(ctx context.Context, filePath, content string) return WithResponseMetadata( NewTextResponse("File created: "+filePath), EditResponseMetadata{ + Diff: diff, Additions: stats.Additions, Removals: stats.Removals, }, @@ -308,6 +310,7 @@ func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string return WithResponseMetadata( NewTextResponse("Content deleted from file: "+filePath), EditResponseMetadata{ + Diff: diff, Additions: stats.Additions, Removals: stats.Removals, }, @@ -401,6 +404,7 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS return WithResponseMetadata( NewTextResponse("Content replaced in file: "+filePath), EditResponseMetadata{ + Diff: diff, Additions: stats.Additions, Removals: stats.Removals, }), nil |
