Skip to content

Commit 8f65485

Browse files
committed
refactor: remove needConfirm parameter from ApplyEdits
- Remove the `needConfirm` parameter from the `ApplyEdits` method and its related functions. Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent caf13c9 commit 8f65485

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/ui/coders/code_editor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Coder interface {
4040
// UpdateCodeFences updates the code fence for the given code.
4141
UpdateCodeFences(ctx context.Context, code string) (string, string)
4242
// ApplyEdits applies the given list of edits to the code.
43-
ApplyEdits(ctx context.Context, edits []PartialCodeBlock, needConfirm bool) error
43+
ApplyEdits(ctx context.Context, edits []PartialCodeBlock) error
4444
// Execute runs the code editor with the specified input messages.
4545
Execute(ctx context.Context, messages []llms.ChatMessage) error
4646
}

internal/ui/coders/diff_block_editor.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ func (e *EditBlockCoder) UpdateCodeFences(_ context.Context, code string) (strin
9797
return e.fence[0], e.fence[1]
9898
}
9999

100-
func (e *EditBlockCoder) ApplyEdits(ctx context.Context, edits []PartialCodeBlock, needConfirm bool) error {
100+
func (e *EditBlockCoder) ApplyEdits(ctx context.Context, edits []PartialCodeBlock) error {
101101
var failed []PartialCodeBlock
102102

103103
for _, block := range edits {
104-
if err := e.applyEdit(ctx, block, needConfirm); err != nil {
104+
if err := e.applyEdit(ctx, block); err != nil {
105105
failed = append(failed, block)
106106
}
107107
}
@@ -113,7 +113,7 @@ func (e *EditBlockCoder) ApplyEdits(ctx context.Context, edits []PartialCodeBloc
113113
return nil
114114
}
115115

116-
func (e *EditBlockCoder) applyEdit(_ context.Context, block PartialCodeBlock, needConfirm bool) error {
116+
func (e *EditBlockCoder) applyEdit(_ context.Context, block PartialCodeBlock) error {
117117
absPath, err := absFilePath(e.coder.codeBasePath, block.Path)
118118
if err != nil {
119119
return err
@@ -234,7 +234,7 @@ func (e *EditBlockCoder) Execute(ctx context.Context, messages []llms.ChatMessag
234234
return errbook.New("No edits were made")
235235
}
236236

237-
err = e.ApplyEdits(ctx, edits, false)
237+
err = e.ApplyEdits(ctx, edits)
238238
if err != nil {
239239
return err
240240
}

0 commit comments

Comments
 (0)