Skip to content

Commit

Permalink
Give legacy questions a default model if it is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed May 23, 2024
1 parent e60f1c2 commit 8e51729
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion question.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function grade_response(array $response) : array {
* @param string $aiprompt
* @param number $defaultmark
* @param string $markscheme
* @return void
* @return string;
*/
public function build_full_ai_prompt($response, $aiprompt, $defaultmark, $markscheme) {
$responsetext = strip_tags($response);
Expand Down
8 changes: 7 additions & 1 deletion questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ protected function initialise_question_instance(question_definition $question, $
$question->aiprompt = $questiondata->options->aiprompt;
$question->markscheme = $questiondata->options->markscheme;
$question->sampleanswer = $questiondata->options->sampleanswer;
$question->model = $questiondata->options->model;
/* Legacy quesitons may not have a model set, so assign the first in the settings */
if(empty($question->model)) {
$model = explode(",", get_config('tool_aiconnect', 'model'))[0];
$question->model = $model;
} else {
$question->model = $questiondata->options->model;
}
}
/**
* Delete a question from the database
Expand Down

0 comments on commit 8e51729

Please sign in to comment.