We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 582cdfc commit 347b45bCopy full SHA for 347b45b
app/jobs/generate_automatic_comments_job.rb
@@ -23,10 +23,14 @@ def perform(request_for_comment, current_user)
23
end
24
25
private
26
-
+
27
+ def add_line_numbers(code)
28
+ code.split("\n").each_with_index.map { |line, index| "#{index + 1}: #{line}" }.join("\n")
29
+ end
30
31
def perform_request(request_for_comment, file, chat_gpt_service)
32
prompt = ChatGptHelper.format_prompt(
- learner_solution: file.content,
33
+ learner_solution: add_line_numbers(file.content),
34
exercise: request_for_comment.submission.exercise.description,
35
test_results: Testrun.where(submission_id: request_for_comment.submission.id).map(&:log).join("\n"),
36
question: request_for_comment.question
0 commit comments