MDL-84017 ai: help icons to describe the usage report token columns.
This commit is contained in:
@@ -24,6 +24,7 @@ use core_reportbuilder\local\filters\text;
|
||||
use core_reportbuilder\local\helpers\format;
|
||||
use core_reportbuilder\local\report\column;
|
||||
use core_reportbuilder\local\report\filter;
|
||||
use core\output\help_icon;
|
||||
use lang_string;
|
||||
|
||||
/**
|
||||
@@ -145,6 +146,7 @@ class ai_action_register extends base {
|
||||
->set_type(column::TYPE_INTEGER)
|
||||
->add_field("COALESCE({$generatetextalias}.prompttokens, {$summarisetextalias}.prompttokens)", 'prompttokens')
|
||||
->set_is_sortable(true)
|
||||
->set_help_icon(new help_icon('prompttokens', 'core_ai'))
|
||||
->add_callback(static function(?int $value): string {
|
||||
return $value ?? get_string('unknownvalue', 'core_ai');
|
||||
});
|
||||
@@ -168,6 +170,7 @@ class ai_action_register extends base {
|
||||
->set_type(column::TYPE_INTEGER)
|
||||
->add_field("COALESCE({$generatetextalias}.completiontoken, {$summarisetextalias}.completiontoken)", 'completiontokens')
|
||||
->set_is_sortable(true)
|
||||
->set_help_icon(new help_icon('completiontokens', 'core_ai'))
|
||||
->add_callback(static function(?int $value): string {
|
||||
return $value ?? get_string('unknownvalue', 'core_ai');
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ class usage extends system_report {
|
||||
* unique identifier.
|
||||
*/
|
||||
public function add_columns(): void {
|
||||
$columns = [
|
||||
$this->add_columns_from_entities([
|
||||
'ai_action_register:provider',
|
||||
'ai_action_register:actionname',
|
||||
'ai_action_register:timecreated',
|
||||
@@ -86,9 +86,7 @@ class usage extends system_report {
|
||||
'ai_action_register:success',
|
||||
'context:name',
|
||||
'user:fullnamewithlink',
|
||||
];
|
||||
|
||||
$this->add_columns_from_entities($columns);
|
||||
]);
|
||||
|
||||
// It's possible to set a default initial sort direction for one column.
|
||||
$this->set_initial_sort_column('ai_action_register:timecreated', SORT_DESC);
|
||||
@@ -101,7 +99,7 @@ class usage extends system_report {
|
||||
* unique identifier.
|
||||
*/
|
||||
protected function add_filters(): void {
|
||||
$filters = [
|
||||
$this->add_filters_from_entities([
|
||||
'ai_action_register:actionname',
|
||||
'ai_action_register:provider',
|
||||
'ai_action_register:timecreated',
|
||||
@@ -110,8 +108,6 @@ class usage extends system_report {
|
||||
'ai_action_register:success',
|
||||
'context:level',
|
||||
'user:fullname',
|
||||
];
|
||||
|
||||
$this->add_filters_from_entities($filters);
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ You can manage the actions for each provider in their settings.';
|
||||
$string['btninstancecreate'] = 'Create instance';
|
||||
$string['btninstanceupdate'] = 'Update instance';
|
||||
$string['completiontokens'] = 'Completion tokens';
|
||||
$string['completiontokens_help'] = 'Completion tokens are the text units generated by the AI model as a response to your input. Longer responses use more tokens, which typically increases the cost.';
|
||||
$string['configureprovider'] = 'Configure provider instance';
|
||||
$string['contentwatermark'] = 'Generated by AI';
|
||||
$string['createnewprovider'] = 'Create a new provider instance';
|
||||
@@ -121,6 +122,7 @@ $string['privacy:metadata:ai_policy_register:contextid'] = 'The ID of the contex
|
||||
$string['privacy:metadata:ai_policy_register:timeaccepted'] = 'The time the user accepted the AI policy.';
|
||||
$string['privacy:metadata:ai_policy_register:userid'] = 'The ID of the user whose data was saved.';
|
||||
$string['prompttokens'] = 'Prompt tokens';
|
||||
$string['prompttokens_help'] = 'Prompt tokens are the individual text units that make up the input you send to an AI model. Longer inputs use more tokens, which often leads to higher costs.';
|
||||
$string['provider'] = 'Provider';
|
||||
$string['provideractionsettings'] = 'Actions';
|
||||
$string['provideractionsettings_desc'] = 'Choose and configure the actions that the {$a} can perform on your site.';
|
||||
|
||||
Reference in New Issue
Block a user