Skip to content

Commit

Permalink
MDL-82900 AI: Update language strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhawkins committed Sep 30, 2024
1 parent 97c2bea commit 1bb9217
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 76 deletions.
4 changes: 2 additions & 2 deletions admin/settings/ai.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

if ($hassiteconfig) {
// Add settings page for AI provider settings.
$providers = new admin_settingpage('aiprovider', new lang_string('aiprovidersettings', 'ai'));
$providers = new admin_settingpage('aiprovider', new lang_string('aiproviders', 'ai'));
$providers->add(new admin_setting_heading('availableproviders',
get_string('availableproviders', 'core_ai'),
get_string('availableproviders_desc', 'core_ai')));
Expand All @@ -48,7 +48,7 @@
}

// Add settings page for AI placement settings.
$placements = new admin_settingpage('aiplacement', new lang_string('aiplacementsettings', 'ai'));
$placements = new admin_settingpage('aiplacement', new lang_string('aiplacements', 'ai'));
$placements->add(new admin_setting_heading('availableplacements',
get_string('availableplacements', 'core_ai'),
get_string('availableplacements_desc', 'core_ai')));
Expand Down
2 changes: 1 addition & 1 deletion ai/classes/table/aiplacement_management_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function get_action_url(array $params = []): moodle_url {
#[\Override]
protected function get_column_list(): array {
$columns = [
'name' => get_string('name', 'core'),
'name' => get_string('placement', 'core_ai'),
];

if ($this->supports_disabling()) {
Expand Down
2 changes: 1 addition & 1 deletion ai/classes/table/aiprovider_action_management_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function get_dynamic_table_html_end(): string {
*/
protected function get_column_list(): array {
return [
'namedesc' => get_string('name', 'core'),
'namedesc' => get_string('action', 'core_ai'),
'enabled' => get_string('pluginenabled', 'core_plugin'),
'settings' => get_string('settings', 'core'),
];
Expand Down
2 changes: 1 addition & 1 deletion ai/classes/table/aiprovider_management_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function get_action_url(array $params = []): moodle_url {
#[\Override]
protected function get_column_list(): array {
$columns = [
'name' => get_string('name', 'core'),
'name' => get_string('provider', 'core_ai'),
];

if ($this->supports_disabling()) {
Expand Down
2 changes: 1 addition & 1 deletion ai/provider/azureai/classes/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function get_action_settings(
$settings[] = new \admin_setting_configtext(
"aiprovider_azureai/action_{$actionname}_apiversion",
new \lang_string("action_apiversion", 'aiprovider_azureai'),
new \lang_string("action_apiversion_desc", 'aiprovider_azureai'),
'',
'2024-06-01',
PARAM_ALPHANUMEXT,
);
Expand Down
23 changes: 11 additions & 12 deletions ai/provider/azureai/lang/en/aiprovider_azureai.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,29 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['action_apiversion'] = 'Azure AI API version';
$string['action_apiversion_desc'] = 'Enter the version number for your Azure AI API.';
$string['action_apiversion'] = 'API version';
$string['action_deployment'] = 'Deployment ID';
$string['action_deployment_desc'] = 'The deployment ID that relates to the API endpoint the provider uses for this action.';
$string['action_systeminstruction'] = 'System Instruction';
$string['action_systeminstruction_desc'] = 'The instruction is used provided along with the user request for this action. It provides information to the AI model on how to generate the response.';
$string['action_systeminstruction_desc'] = 'This instruction is sent to the AI model along with the user\'s prompt. Editing this instruction is not recommended unless absolutely required.';
$string['apikey'] = 'Azure AI API key';
$string['apikey_desc'] = 'Enter your Azure AI API key.';
$string['deployment'] = 'Azure AI API deployment name';
$string['deployment_desc'] = 'Enter the deployment name for your Azure AI API.';
$string['enableglobalratelimit'] = 'Enable global rate limiting';
$string['enableglobalratelimit_desc'] = 'Enable global rate limiting for the Azure AI API provider.';
$string['enableuserratelimit'] = 'Enable user rate limiting';
$string['enableuserratelimit_desc'] = 'Enable user rate limiting for the Azure AI API provider.';
$string['enableglobalratelimit'] = 'Set site-wide rate limit';
$string['enableglobalratelimit_desc'] = 'Limit the number of requests that the Azure AI API provider can receive across the entire site every hour.';
$string['enableuserratelimit'] = 'Set user rate limit';
$string['enableuserratelimit_desc'] = 'Limit the number of requests each user can make to the Azure AI API provider every hour.';
$string['endpoint'] = 'Azure AI API endpoint';
$string['endpoint_desc'] = 'Enter the endpoint URL for your Azure AI API. In the form of: https://YOUR_RESOURCE_NAME.azureai.azure.com/azureai/deployments';
$string['globalratelimit'] = 'Global rate limit';
$string['globalratelimit_desc'] = 'Set the number of requests per hour allowed for the global rate limit.';
$string['endpoint_desc'] = 'Enter the endpoint URL for your Azure AI API, in the following format: https://YOUR_RESOURCE_NAME.azureai.azure.com/azureai/deployments';
$string['globalratelimit'] = 'Maximum number of site-wide requests';
$string['globalratelimit_desc'] = 'The number of site-wide requests allowed per hour.';
$string['pluginname'] = 'Azure AI API Provider';
$string['privacy:metadata'] = 'The Azure Ai API provider plugin does not store any personal data.';
$string['privacy:metadata:aiprovider_azureai:externalpurpose'] = 'This information is sent to the Azure API in order for a response to be generated. Your Azure AI account settings may change how Microsoft stores and retains this data. No user data is explicitly sent to Microsoft or stored in Moodle LMS by this plugin.';
$string['privacy:metadata:aiprovider_azureai:model'] = 'The model used to generate the response.';
$string['privacy:metadata:aiprovider_azureai:numberimages'] = 'The number of images used in the response. When generating images.';
$string['privacy:metadata:aiprovider_azureai:prompttext'] = 'The user entered text prompt used to generate the response.';
$string['privacy:metadata:aiprovider_azureai:responseformat'] = 'The format of the response. When generating images.';
$string['userratelimit'] = 'User rate limit';
$string['userratelimit_desc'] = 'Set the number of requests per hour allowed for the user rate limit.';
$string['userratelimit'] = 'Maximum number of requests per user';
$string['userratelimit_desc'] = 'The number of requests allowed per hour, per user.';
4 changes: 2 additions & 2 deletions ai/provider/azureai/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

$settings->add(new admin_setting_heading(
'aiprovider_azureai/general',
new lang_string('providersettings', 'core_ai'),
new lang_string('providersettings_desc', 'core_ai')
new lang_string('settings', 'core'),
'',
));

// Setting to store AzureAI API key.
Expand Down
4 changes: 2 additions & 2 deletions ai/provider/openai/classes/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function get_action_settings(
$settings[] = new \admin_setting_configtext(
"aiprovider_openai/action_{$actionname}_endpoint",
new \lang_string("action:{$actionname}:endpoint", 'aiprovider_openai'),
new \lang_string("action:{$actionname}:endpoint_desc", 'aiprovider_openai'),
'',
'https://api.openai.com/v1/chat/completions',
PARAM_URL,
);
Expand All @@ -199,7 +199,7 @@ public function get_action_settings(
$settings[] = new \admin_setting_configtext(
"aiprovider_openai/action_{$actionname}_endpoint",
new \lang_string("action:{$actionname}:endpoint", 'aiprovider_openai'),
new \lang_string("action:{$actionname}:endpoint_desc", 'aiprovider_openai'),
'',
'https://api.openai.com/v1/images/generations',
PARAM_URL,
);
Expand Down
33 changes: 15 additions & 18 deletions ai/provider/openai/lang/en/aiprovider_openai.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,34 @@
*/

$string['action:generate_image:endpoint'] = 'API endpoint';
$string['action:generate_image:endpoint_desc'] = 'The API endpoint the provider uses for this action.';
$string['action:generate_image:model'] = 'Image generation model';
$string['action:generate_image:model'] = 'AI model';
$string['action:generate_image:model_desc'] = 'The model used to generate images from user prompts.';
$string['action:generate_text:endpoint'] = 'API endpoint';
$string['action:generate_text:endpoint_desc'] = 'The API endpoint for the provider uses for this action.';
$string['action:generate_text:model'] = 'Text generation model';
$string['action:generate_text:model'] = 'AI model';
$string['action:generate_text:model_desc'] = 'The model used to generate the text response.';
$string['action:generate_text:systeminstruction'] = 'System instruction';
$string['action:generate_text:systeminstruction_desc'] = 'This instruction is provided together with the user prompt for this action. It provides information to the AI model on how to generate the response.';
$string['action:generate_text:systeminstruction_desc'] = 'This instruction is sent to the AI model along with the user\'s prompt. Editing this instruction is not recommended unless absolutely required.';
$string['action:summarise_text:endpoint'] = 'API endpoint';
$string['action:summarise_text:endpoint_desc'] = 'The API endpoint the provider uses for this action.';
$string['action:summarise_text:model'] = 'Text summarisation model';
$string['action:summarise_text:model'] = 'AI model';
$string['action:summarise_text:model_desc'] = 'The model used to summarise the provided text.';
$string['action:summarise_text:systeminstruction'] = 'System instruction';
$string['action:summarise_text:systeminstruction_desc'] = 'This instruction is provided together with the user prompt for this action. It provides information to the AI model on how to generate the response.';
$string['action:summarise_text:systeminstruction_desc'] = 'This instruction is sent to the AI model along with the user\'s prompt. Editing this instruction is not recommended unless absolutely required.';
$string['apikey'] = 'OpenAI API key';
$string['apikey_desc'] = 'Enter your OpenAI API key. You can get one from <a href="https://platform.openai.com/account/api-keys" target="_blank">here</a>';
$string['enableglobalratelimit'] = 'Enable global rate limiting';
$string['enableglobalratelimit_desc'] = 'Enable global rate limiting for the OpenAI API provider.';
$string['enableuserratelimit'] = 'Enable user rate limiting';
$string['enableuserratelimit_desc'] = 'Enable user rate limiting for the OpenAI API provider.';
$string['globalratelimit'] = 'Global rate limit';
$string['globalratelimit_desc'] = 'Set the number of requests per hour allowed for the global rate limit.';
$string['apikey_desc'] = 'Get a key from your <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API keys</a>.';
$string['enableglobalratelimit'] = 'Set site-wide rate limit';
$string['enableglobalratelimit_desc'] = 'Limit the number of requests that the OpenAI API provider can receive across the entire site every hour.';
$string['enableuserratelimit'] = 'Set user rate limit';
$string['enableuserratelimit_desc'] = 'Limit the number of requests each user can make to the OpenAI API provider every hour.';
$string['globalratelimit'] = 'Maximum number of site-wide requests';
$string['globalratelimit_desc'] = 'The number of site-wide requests allowed per hour.';
$string['orgid'] = 'OpenAI organization ID';
$string['orgid_desc'] = 'Enter your OpenAI organization ID. You can get one from <a href="https://platform.openai.com/account/org-settings" target="_blank">here</a>';
$string['orgid_desc'] = 'Get your OpenAI organisation ID from your <a href="https://platform.openai.com/account/org-settings" target="_blank">OpenAI account</a>.';
$string['pluginname'] = 'OpenAI API Provider';
$string['privacy:metadata'] = 'The OpenAI API provider plugin does not store any personal data.';
$string['privacy:metadata:aiprovider_openai:externalpurpose'] = 'This information is sent to the OpenAI API in order for a response to be generated. Your OpenAI account settings may change how OpenAI stores and retains this data. No user data is explicitly sent to OpenAI or stored in Moodle LMS by this plugin.';
$string['privacy:metadata:aiprovider_openai:model'] = 'The model used to generate the response.';
$string['privacy:metadata:aiprovider_openai:numberimages'] = 'The number of images used in the response. When generating images.';
$string['privacy:metadata:aiprovider_openai:prompttext'] = 'The user entered text prompt used to generate the response.';
$string['privacy:metadata:aiprovider_openai:responseformat'] = 'The format of the response. When generating images.';
$string['userratelimit'] = 'User rate limit';
$string['userratelimit_desc'] = 'Set the number of requests per hour allowed for the user rate limit.';
$string['userratelimit'] = 'Maximum number of requests per user';
$string['userratelimit_desc'] = 'The number of requests allowed per hour, per user.';
4 changes: 2 additions & 2 deletions ai/provider/openai/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

$settings->add(new admin_setting_heading(
'aiprovider_openai/general',
new lang_string('providersettings', 'core_ai'),
new lang_string('providersettings_desc', 'core_ai'),
new lang_string('settings', 'core'),
'',
));

// Setting to store OpenAI API key.
Expand Down
16 changes: 8 additions & 8 deletions ai/tests/behat/admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: An administrator can manage AI subsystem settings
@javascript
Scenario: An administrator can control the enabled state of AI Provider plugins using JavaScript
Given I am logged in as "admin"
And I navigate to "AI > Manage settings for AI providers" in site administration
And I navigate to "AI > AI providers" in site administration
When I toggle the "Enable OpenAI API Provider" admin switch "on"
And I should see "OpenAI API Provider enabled."
And I reload the page
Expand All @@ -18,7 +18,7 @@ Feature: An administrator can manage AI subsystem settings
@javascript
Scenario: An administrator can control the enabled state of AI Placement plugins using JavaScript
Given I am logged in as "admin"
And I navigate to "AI > Manage settings for AI placements" in site administration
And I navigate to "AI > AI placements" in site administration
When I toggle the "Enable HTML Text Editor Placement" admin switch "on"
And I should see "HTML Text Editor Placement enabled."
And I reload the page
Expand All @@ -29,32 +29,32 @@ Feature: An administrator can manage AI subsystem settings
@javascript
Scenario: Placement actions should be available when an Administrator enables AI Providers using JavaScript
Given I am logged in as "admin"
And I navigate to "AI > Manage settings for AI providers" in site administration
And I navigate to "AI > AI providers" in site administration
When I toggle the "Enable OpenAI API Provider" admin switch "on"
And I should see "OpenAI API Provider enabled."
And I navigate to "AI > Manage settings for AI placements" in site administration
And I navigate to "AI > AI placements" in site administration
And I click on the "Settings" link in the table row containing "HTML Text Editor Placement"
Then I should not see "This action is unavailable."

@javascript
Scenario: Placement actions should not be available when an Administrator disables AI Providers using JavaScript
Given I am logged in as "admin"
And I navigate to "AI > Manage settings for AI providers" in site administration
And I navigate to "AI > AI providers" in site administration
When I toggle the "Enable OpenAI API Provider" admin switch "off"
And I navigate to "AI > Manage settings for AI placements" in site administration
And I navigate to "AI > AI placements" in site administration
And I click on the "Settings" link in the table row containing "HTML Text Editor Placement"
And I should see "This action is unavailable." in the table row containing "Generate text"
Then I should see "This action is unavailable." in the table row containing "Generate image"

@javascript
Scenario: Placement actions should not be available for enabled Providers when an Administrator disables an Action using JavaScript
Given I am logged in as "admin"
And I navigate to "AI > Manage settings for AI providers" in site administration
And I navigate to "AI > AI providers" in site administration
When I toggle the "Enable OpenAI API Provider" admin switch "on"
And I should see "OpenAI API Provider enabled."
And I click on the "Settings" link in the table row containing "OpenAI API Provider"
And I toggle the "Generate text" admin switch "off"
And I navigate to "AI > Manage settings for AI placements" in site administration
And I navigate to "AI > AI placements" in site administration
And I click on the "Settings" link in the table row containing "HTML Text Editor Placement"
And I should see "This action is unavailable." in the table row containing "Generate text"
Then I should not see "This action is unavailable." in the table row containing "Generate image"
Loading

0 comments on commit 1bb9217

Please sign in to comment.