@@ -86,13 +86,8 @@ export class BugFixAgent extends AIAgent {
8686 * 适用于简单更改或用户提供具体指令的情况
8787 */
8888 private async processDirectFix ( userInput : string , startTime : number , context ?: any ) : Promise < BugFixAgentResponse > {
89- // 增强用户输入,添加特定的代码修复指令
9089 const directFixPrompt = this . bugFixPlaybook . preparePrompt ( userInput , context ) ;
91-
92- // 使用现有的工具链处理流程,但使用修改后的提示
9390 const response = await super . processInputWithToolChaining ( directFixPrompt , startTime , context ) as AgentResponse ;
94-
95- // 提取有关修改文件的信息
9691 const modifiedFiles = this . extractModifiedFiles ( response . toolResults ) ;
9792
9893 return {
@@ -107,54 +102,41 @@ export class BugFixAgent extends AIAgent {
107102 * 更彻底的方法,适用于复杂重构
108103 */
109104 private async processAnalysisFirstFix ( userInput : string , startTime : number , context ?: any ) : Promise < BugFixAgentResponse > {
110- // 阶段 1: 分析阶段
111105 this . log ( '阶段 1: 在修复前分析代码库' ) ;
112106 const analysisMessages = await this . bugFixPlaybook . buildMessagesForRound ( userInput , context , 1 ) ;
113107
114- // 调用 LLM 进行分析
115108 const analysisResponse = await this . callLLM ( analysisMessages ) ;
116109 const parsedAnalysis = FunctionParser . parseResponse ( analysisResponse ) ;
117110
118- // 执行分析工具
119111 const analysisResults = await this . toolExecutor . executeToolsWithContext ( {
120112 round : 1 ,
121113 previousResults : [ ] ,
122114 userInput,
123115 workspacePath : this . config . workspacePath || process . cwd ( )
124116 } , parsedAnalysis . functionCalls ) ;
125117
126- // 阶段 2: 修复阶段
127118 this . log ( '阶段 2: 基于分析应用代码修复' ) ;
128119 const fixMessages = await this . bugFixPlaybook . buildMessagesForRound ( userInput , context , 2 ) ;
129120
130- // 调用 LLM 创建修复方案
131121 const fixResponse = await this . callLLM ( fixMessages ) ;
132122 const parsedFix = FunctionParser . parseResponse ( fixResponse ) ;
133123
134- // 执行修复工具
135124 const fixResults = await this . toolExecutor . executeToolsWithContext ( {
136125 round : 2 ,
137126 previousResults : analysisResults ,
138127 userInput,
139128 workspacePath : this . config . workspacePath || process . cwd ( )
140129 } , parsedFix . functionCalls ) ;
141130
142- // 组合所有工具结果
143131 const allToolResults = [ ...analysisResults , ...fixResults ] ;
144132
145- // 阶段 3: 验证(如果启用)
146133 if ( this . bugFixConfig . verifyChanges ) {
147134 this . log ( '阶段 3: 验证代码修复' ) ;
148- const verificationPrompt = this . bugFixPlaybook . prepareVerificationPrompt ( userInput , allToolResults ) ;
149-
150- // 从 LLM 获取验证响应
151135 const verificationMessages = await this . bugFixPlaybook . buildMessagesForRound ( userInput , context , 3 ) ;
152136 const verificationResponse = await this . callLLM ( verificationMessages ) ;
153137
154- // 生成最终响应
155138 const finalText = await this . generateBugFixFinalResponse ( userInput , verificationResponse , allToolResults , 3 ) ;
156139
157- // 提取有关修改文件的信息
158140 const modifiedFiles = this . extractModifiedFiles ( allToolResults ) ;
159141
160142 return {
@@ -168,7 +150,6 @@ export class BugFixAgent extends AIAgent {
168150 } ;
169151 }
170152
171- // 如果未启用验证,生成最终响应
172153 const summaryPrompt = this . bugFixPlaybook . prepareSummaryPrompt (
173154 userInput ,
174155 allToolResults ,
@@ -181,8 +162,6 @@ export class BugFixAgent extends AIAgent {
181162 ] as CoreMessage [ ] ;
182163
183164 const summaryResponse = await this . callLLM ( summaryMessages ) ;
184-
185- // 提取有关修改文件的信息
186165 const modifiedFiles = this . extractModifiedFiles ( allToolResults ) ;
187166
188167 return {
@@ -196,9 +175,6 @@ export class BugFixAgent extends AIAgent {
196175 } ;
197176 }
198177
199- /**
200- * 从工具结果中提取修改的文件列表
201- */
202178 private extractModifiedFiles ( toolResults : ToolResult [ ] ) : string [ ] {
203179 const modifiedFiles = new Set < string > ( ) ;
204180
0 commit comments