MDL-84779 core_ai: Add method for getting model settings keys

This commit is contained in:
David Woloszyn
2025-07-07 17:41:41 +10:00
parent a6b17d8f6b
commit fbb6eeac32
3 changed files with 36 additions and 1 deletions
@@ -0,0 +1,8 @@
issueNumber: MDL-84779
notes:
core_ai:
- message: >-
The method `has_model_settings` inside `core_ai\aimodel\base`
is now determined by values returned from a new method called
`get_model_settings`.
type: changed
+10 -1
View File
@@ -56,6 +56,15 @@ abstract class base {
* @return bool Whether the model has settings.
*/
public function has_model_settings(): bool {
return false;
return !empty($this->get_model_settings());
}
/**
* Get all settings that can be configured for a model.
*
* @return string[] Array of settings.
*/
public function get_model_settings(): array {
return [];
}
}
+18
View File
@@ -72,4 +72,22 @@ class action_settings_form extends moodleform {
return $data;
}
}
#[\Override]
public function get_data(): ?\stdClass {
$data = parent::get_data();
if ($data) {
if (isset($data->modeltemplate)) {
if ($data->modeltemplate === 'custom') {
$data->model = $data->custommodel;
} else {
// Set the model to the selected model template.
$data->model = $data->modeltemplate;
}
}
}
return $data;
}
}