Skip to content

Commit

Permalink
New markprompt_required setting for the authoring form
Browse files Browse the repository at this point in the history
If markprompt_required is set the marks field in the authoring form
will be required and will show an error if it is left blank.
  • Loading branch information
marcusgreen committed Nov 16, 2024
1 parent 9f9872b commit 86da900
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion edit_aitext_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ protected function definition_inner($mform) {
$mform->setType('markscheme', PARAM_RAW);
$mform->setDefault('markscheme', get_config('qtype_aitext', 'defaultmarksscheme'));
$mform->addHelpButton('markscheme', 'markscheme', 'qtype_aitext');
$mform->addRule('markscheme', get_string('markschememissing', 'qtype_aitext'), 'required');
if (get_config('qtype_aitext', 'markprompt_required')== 1) {
$mform->addRule('markscheme', get_string('markschememissing', 'qtype_aitext'), 'required');
}
$models = explode(",", get_config('tool_aiconnect', 'model'));
if (count($models) > 1 ) {
$models = array_combine($models, $models);
Expand Down
2 changes: 2 additions & 0 deletions lang/en/qtype_aitext.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
$string['graderinfoheader'] = 'Grader information';
$string['jsonprompt'] = 'JSon prompt';
$string['jsonprompt_setting'] = 'Instructions sent to convert the returned value into json';
$string['markprompt_required'] = 'Mark prompt required';
$string['markprompt_required_setting'] = 'If set, when authoring a question a prompt asking for marking is a required field and will show an error if it is left empty';
$string['markscheme'] = 'Mark scheme';
$string['markscheme_help'] = 'This will tell the AI grader how to give a numerical grade to the student response. The total possible score is this question\'s \'Default mark\'';
$string['markschememissing'] = 'The marke scheme is missing. Please enter a prompt, how to mark the users input';
Expand Down
6 changes: 6 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
new lang_string('use_local_ai_manager_setting', 'qtype_aitext'),
0
));
$settings->add(new admin_setting_configcheckbox(
'qtype_aitext/markprompt_required',
new lang_string('markprompt_required', 'qtype_aitext'),
new lang_string('markprompt_required_setting', 'qtype_aitext'),
0
));

}

0 comments on commit 86da900

Please sign in to comment.