Skip to content

Commit e9e7373

Browse files
committed
Add help button to the prompttest header
1 parent 8065fad commit e9e7373

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

edit_aitext_form.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ protected function definition_inner($mform) {
8888

8989
// Add repeated sample answer options along with the field for returned responses.
9090
$mform->addElement('header', 'prompttester', get_string('prompttester', 'qtype_aitext'));
91+
$mform->addHelpButton('prompttester','prompttesthelp', 'qtype_aitext');
9192

9293
$answeroptions = ['maxlen' => 50, 'rows' => 6, 'size' => 30];
9394
$evaloptions = ['cols' => 50, 'rows' => 5, 'disabled' => 'disabled' ];

lang/en/qtype_aitext.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
$string['prompt'] = 'Prompt';
9494
$string['prompt_setting'] = 'Wrapper text for the prompt set to the AI System, [responsetext] is whatever the student typed as an answer. The ai prompt value from the question will be appended to this';
9595
$string['prompttester'] = 'Prompt Tester';
96+
$string['prompttesthelp_help'] = 'When the form is saved only the test response is saved, not the value returned by the LLM';
9697
$string['response'] = 'Response';
9798
$string['responsefieldlines'] = 'Input box size';
9899
$string['responseformat'] = 'Response format';

question.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,13 @@ public function perform_request(string $prompt, string $purpose = 'feedback'): s
170170
}
171171
return $llmresponse->get_content();
172172
} else if ($backend == 'core_ai_subsystem') {
173-
global $USER;
174-
$manager = new \core_ai\manager();
173+
global $USER, $CFG, $DB;
174+
// There was a breaking change in the move to Moodle 5x.
175+
if(str_starts_with($CFG->release, '5')) {
176+
$manager = new \core_ai\manager($DB);
177+
} else {
178+
$manager = new \core_ai\manager();
179+
}
175180
$action = new \core_ai\aiactions\generate_text(
176181
contextid: $this->contextid,
177182
userid: $USER->id,

0 commit comments

Comments
 (0)