From 18ac8e674f14039d6ba3059f166b0ba89f87388c Mon Sep 17 00:00:00 2001 From: yokowu <18836617@qq.com> Date: Fri, 18 Jul 2025 22:50:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=8C=E6=95=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/proxy/repo/proxy.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/internal/proxy/repo/proxy.go b/backend/internal/proxy/repo/proxy.go index 9970d8f..f31235b 100644 --- a/backend/internal/proxy/repo/proxy.go +++ b/backend/internal/proxy/repo/proxy.go @@ -233,25 +233,25 @@ func (r *ProxyRepo) Report(ctx context.Context, req *domain.ReportReq) error { } func (r *ProxyRepo) handleFileWritten(ctx context.Context, tx *db.Tx, rc *db.Task, req *domain.ReportReq) error { - lines := 0 + lineCount := 0 switch req.Tool { case "appliedDiff", "editedExistingFile", "insertContent": if strings.Contains(req.Content, "<<<<<<<") { lines := diff.ParseConflictsAndCountLines(req.Content) for _, line := range lines { - rc.CodeLines += int64(line) + lineCount += line } } else { - rc.CodeLines = int64(strings.Count(req.Content, "\n")) + lineCount = strings.Count(req.Content, "\n") } case "newFileCreated": - rc.CodeLines = int64(strings.Count(req.Content, "\n")) + lineCount = strings.Count(req.Content, "\n") } - if lines > 0 { + if lineCount > 0 { if err := tx.Task. UpdateOneID(rc.ID). - AddCodeLines(int64(lines)). + AddCodeLines(int64(lineCount)). SetIsAccept(true). Exec(ctx); err != nil { return err @@ -264,7 +264,7 @@ func (r *ProxyRepo) handleFileWritten(ctx context.Context, tx *db.Tx, rc *db.Tas SetRole(consts.ChatRoleSystem). SetPrompt("写入文件"). SetCompletion(""). - SetCodeLines(int64(lines)). + SetCodeLines(int64(lineCount)). SetCode(req.Content). SetOutputTokens(0). Save(ctx); err != nil {