feat: correctly implement bitbucket & add OpenAIAdapter
This commit is contained in:
@@ -8,7 +8,8 @@ import (
|
||||
|
||||
func (s *Service) MakeReview(ctx context.Context, organisation string, repo string, prID int) error {
|
||||
// Fetch Diff using positional args from shared RepoArgs
|
||||
diff, err := s.git.GetDiff(organisation, repo, prID)
|
||||
diff, err := s.git.GetDiff(ctx, organisation, repo, prID)
|
||||
defer diff.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error fetching diff: %w", err)
|
||||
}
|
||||
@@ -21,11 +22,14 @@ func (s *Service) MakeReview(ctx context.Context, organisation string, repo stri
|
||||
|
||||
fmt.Printf("Analysis complete. Found %d issues.\n---\n", len(comments))
|
||||
|
||||
model := s.chat.GetProviderName()
|
||||
|
||||
for _, c := range comments {
|
||||
c.Message = fmt.Sprintf("%s (Generated by: %s)", c.Message, model)
|
||||
fmt.Printf("File: %s\nLine: %d\nMessage: %s\n%s\n",
|
||||
c.File, c.Line, c.Message, "---")
|
||||
|
||||
if err := s.git.AddComment(organisation, repo, prID, c); err != nil {
|
||||
if err := s.git.AddComment(ctx, organisation, repo, prID, c); err != nil {
|
||||
log.Printf("Failed to add comment: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user