Skip to content

Commit 17b4417

Browse files
authored
refactor: rename functions for better clarity in tag handler (#337)
- Rename buildEnhancedIssuePrompt to buildIssueCodePrompt - Rename generateCodeImplementation to callAIAndGenerateCode - Rename buildCodePrompt to buildAIPromptForCode - Update function comments to match new names
1 parent 3df13b2 commit 17b4417

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/modes/tag_handler.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ func (th *TagHandler) handlePRReviewComment(
244244
}
245245
}
246246

247-
// buildEnhancedIssuePrompt 为Issue中的/code命令构建增强提示词
248-
func (th *TagHandler) buildEnhancedIssuePrompt(ctx context.Context, event *models.IssueCommentContext, args string) (string, error) {
247+
// buildIssueCodePrompt 为Issue中的/code命令构建增强提示词
248+
func (th *TagHandler) buildIssueCodePrompt(ctx context.Context, event *models.IssueCommentContext, args string) (string, error) {
249249
xl := xlog.NewWith(ctx)
250250

251251
// 收集Issue的完整上下文
@@ -442,8 +442,8 @@ func (th *TagHandler) executeIssueCodeProcessing(
442442
return err
443443
}
444444

445-
// 3. 生成代码实现
446-
codeOutput, err := th.generateCodeImplementation(ctx, event, cmdInfo, ws, pcm)
445+
// 3. 调用AI并生成代码实现
446+
codeOutput, err := th.callAIAndGenerateCode(ctx, event, cmdInfo, ws, pcm)
447447
if err != nil {
448448
result = &models.ProgressExecutionResult{
449449
Success: false,
@@ -616,8 +616,8 @@ func (th *TagHandler) initializeProgressTracking(
616616
return pcm, nil
617617
}
618618

619-
// generateCodeImplementation 生成代码实现
620-
func (th *TagHandler) generateCodeImplementation(
619+
// callAIAndGenerateCode 调用AI并生成代码实现
620+
func (th *TagHandler) callAIAndGenerateCode(
621621
ctx context.Context,
622622
event *models.IssueCommentContext,
623623
cmdInfo *models.CommandInfo,
@@ -639,8 +639,8 @@ func (th *TagHandler) generateCodeImplementation(
639639
}
640640
xl.Infof("Code client initialized successfully")
641641

642-
// 构建提示词
643-
codePrompt, err := th.buildCodePrompt(ctx, event, cmdInfo)
642+
// 构建AI提示词
643+
codePrompt, err := th.buildAIPromptForCode(ctx, event, cmdInfo)
644644
if err != nil {
645645
xl.Warnf("Failed to build enhanced prompt, falling back to simple prompt: %v", err)
646646
codePrompt = th.buildFallbackPrompt(event)
@@ -676,13 +676,13 @@ func (th *TagHandler) generateCodeImplementation(
676676
return codeOutput, nil
677677
}
678678

679-
// buildCodePrompt 构建代码生成提示词
680-
func (th *TagHandler) buildCodePrompt(
679+
// buildAIPromptForCode 构建AI代码生成提示词
680+
func (th *TagHandler) buildAIPromptForCode(
681681
ctx context.Context,
682682
event *models.IssueCommentContext,
683683
cmdInfo *models.CommandInfo,
684684
) (string, error) {
685-
return th.buildEnhancedIssuePrompt(ctx, event, cmdInfo.Args)
685+
return th.buildIssueCodePrompt(ctx, event, cmdInfo.Args)
686686
}
687687

688688
// buildFallbackPrompt 构建备用提示词

0 commit comments

Comments
 (0)