diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-17 03:08:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-17 03:08:12 +0300 |
commit | e7ddd83a4484ff9fdf355d8eb726db9bfd3dd521 (patch) | |
tree | b848db807804e8ab903825b6eeb12183362c619e /scripts | |
parent | 740262cd8084189111bc134900bbbc1278b7e7ea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/duo_chat/reporter.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/duo_chat/reporter.rb b/scripts/duo_chat/reporter.rb index e72a393694f..686a49164a7 100755 --- a/scripts/duo_chat/reporter.rb +++ b/scripts/duo_chat/reporter.rb @@ -5,7 +5,7 @@ require 'gitlab' require 'json' class Reporter - IDENTIFIABLE_NOTE_TAG = 'gitlab-org/ai-powered/ai-framework:duo-chat-qa-evaluation' + IDENTIFIABLE_NOTE_TAG = 'gitlab-org/ai-powered/ai-framework:duo-chat-qa-evaluation-' GRADE_TO_EMOJI_MAPPING = { correct: ":white_check_mark:", @@ -25,7 +25,7 @@ class Reporter .merge_request_notes(ci_project_id, merge_request_iid) .auto_paginate .select do |note| - note.body.include? IDENTIFIABLE_NOTE_TAG + note.body.include? note_identifier_tag end note = report_notes.max_by { |note| Time.parse(note.created_at) } @@ -47,13 +47,17 @@ class Reporter private def report_filename - ENV['QA_EVAL_REPORT_FILENAME'] + "#{ENV['DUO_RSPEC']}.md" end def artifact_path File.join(ENV['CI_PROJECT_DIR'], report_filename) end + def note_identifier_tag + "#{IDENTIFIABLE_NOTE_TAG}#{ENV['DUO_RSPEC']}" + end + def com_gitlab_client @com_gitlab_client ||= Gitlab.client( endpoint: "https://gitlab.com/api/v4", @@ -63,7 +67,7 @@ class Reporter def report_note report = <<~MARKDOWN - <!-- #{IDENTIFIABLE_NOTE_TAG} --> + <!-- #{note_identifier_tag} --> ## GitLab Duo Chat QA evaluation @@ -101,7 +105,7 @@ class Reporter if report.length > 1000000 return <<~MARKDOWN - <!-- #{IDENTIFIABLE_NOTE_TAG} --> + <!-- #{note_identifier_tag} --> ## GitLab Duo Chat QA evaluation @@ -121,7 +125,7 @@ class Reporter def report_data @report_data ||= Dir[File.join(ENV['CI_PROJECT_DIR'], "tmp/duo_chat/qa*.json")] - .flat_map { |file| JSON.parse(File.read(file)) } + .map { |file| JSON.parse(File.read(file)) } end def eval_content |