Skip to content

Commit 73aec48

Browse files
authored
Update AI_INTEGRATION_README.md
1 parent 5d718df commit 73aec48

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

AI_INTEGRATION_README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project integrates ChatGPT into CodeOcean to provide automated feedback for
44

55
## Prerequisites
66

7-
- **ChatGPT API Key:** Stored securely via Rails credentials
7+
- **API Key:** Stored securely via Rails credentials
88
- **Internal User:** Requires an internal user (`[email protected]`) to create comments
99
- **Gem Required:** `gem 'ruby-openai'`
1010

@@ -20,9 +20,9 @@ This project integrates ChatGPT into CodeOcean to provide automated feedback for
2020

2121
Encapsulates API communication with ChatGPT.
2222

23-
- **Implementation:** `app/services/chat_gpt_service/chat_gpt_request.rb`
24-
- **Prompt files:** `app/services/chat_gpt_service/chat_gpt_prompts/` (EN and DE versions)
25-
- **Structured Output Schema:** `app/services/chat_gpt_service/chat_gpt_prompts/response_format.json`
23+
- **Implementation:** [`app/services/chat_gpt_service/chat_gpt_request.rb`](app/services/chat_gpt_service/chat_gpt_request.rb)
24+
- **Prompt files:** [`app/services/chat_gpt_service/chat_gpt_prompts/`](app/services/chat_gpt_service/chat_gpt_prompts/) (EN and DE versions)
25+
- **Structured Output Schema:** [`app/services/chat_gpt_service/chat_gpt_prompts/response_format.json`](app/services/chat_gpt_service/chat_gpt_prompts/response_format.json)
2626

2727
**Key Method:**
2828
- `execute(prompt, structured_output)`: Sends prompt and receives response
@@ -31,14 +31,15 @@ Encapsulates API communication with ChatGPT.
3131

3232
Responsible for formatting prompts and parsing responses.
3333

34+
- [`app/helpers/chat_gpt_helper.rb`](app/helpers/chat_gpt_helper.rb)
3435
- `format_prompt`: Loads locale-specific templates and replaces placeholders in the prompt from application
3536
- `format_response`: Parses structured JSON response from chatGPT to create general commenta(line 0) and line comments for RFC.
3637

3738
### Automatic Comment Job (RFC)
3839

3940
Handles background comment generation when students submit a Request for Comments.
4041

41-
- **Job class:** `GenerateAutomaticCommentsJob`
42+
- **Job class:** [`GenerateAutomaticCommentsJob`](app/jobs/generate_automatic_comments_job.rb)
4243
- **Service:** Uses `ChatGptRequest` to communicate with the API
4344
- **Process:**
4445
1. Prompts are built from student code and context
@@ -51,26 +52,25 @@ Handles background comment generation when students submit a Request for Comment
5152
Allows students to request feedback per test result after scoring.
5253

5354
- **Output modification:**
54-
`app/models/submission.rb`
55+
[`app/models/submission.rb`](app/models/submission.rb)
5556
Adds `testrun_id` to each test result:
5657
```ruby
5758
output.merge!(filename:, message: feedback_message(file, output), weight: file.weight, hidden_feedback: file.hidden_feedback, testrun_id: testrun.id)
5859
```
5960

6061
- **Frontend integration:**
61-
`app/assets/javascripts/editor/editor.js.erb`
62-
Adds data attribute to each test result card:
62+
[`app/assets/javascripts/editor/editor.js.erb`](app/assets/javascripts/editor/editor.js.erb)
6363
```js
6464
card.attr('data-testrun-id', result.testrun_id); // Add testrun_id to the card
6565
```
6666

6767
- **Triggering feedback request:**
68-
`app/assets/javascripts/editor.js`
68+
[`app/assets/javascripts/editor.js`](app/assets/javascripts/editor.js)
6969
Handles button click, calls backend route, and updates the UI with the ChatGPT feedback.
7070

7171
- **Route and logic:**
72-
- `app/controllers/submissions_controller.rb`: Handles `/testrun_ai_feedback_message` route
73-
- `app/models/testrun.rb`: Contains `generate_ai_feedback` method that builds prompt and fetches response
72+
- [`app/controllers/submissions_controller.rb`](app/controllers/submissions_controller.rb): Handles `/testrun_ai_feedback_message` route
73+
- [`app/models/testrun.rb`](app/models/testrun.rb): Contains `generate_ai_feedback` method that builds prompt and fetches response
7474

7575
### Exercise-Level Controls
7676

@@ -79,5 +79,4 @@ Instructors can toggle AI features per exercise using boolean flags:
7979
- `allow_ai_comment_for_rfc`: Enables RFC-based AI feedback
8080
- `allow_ai_feedback_on_score`: Enables test-based feedback
8181

82-
8382
---

0 commit comments

Comments
 (0)