Skip to content

Commit

Permalink
Merge pull request #120 from UN-OCHA/OPS-10643-no-ai-text
Browse files Browse the repository at this point in the history
feat: Change wording when no summary is present
  • Loading branch information
attiks authored Aug 1, 2024
2 parents 21b21b1 + 341dec8 commit 07e23e9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config/core.entity_form_display.node.summary.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ third_party_settings:
id: ''
open: false
description: ''
required_fields: false
required_fields: true
id: node.summary.default
targetEntityType: node
bundle: summary
Expand Down
34 changes: 23 additions & 11 deletions html/modules/custom/ocha_ai_summarize/ocha_ai_summarize.module
Original file line number Diff line number Diff line change
Expand Up @@ -1612,17 +1612,29 @@ function ocha_ai_summarize_notify_user(NodeInterface $node) {
$params['subject'] = t('AI Summarize: @title - has been processed.', [
'@title' => $node->getTitle(),
]);
$params['message'] = implode("\r\n", [
t('Your document has been processed by @model.', ['@model' => $ai_model]),
'',
t('You can always see your results and provide feedback online here: @link', [
'@link' => $node->toUrl()->setAbsolute()->toString(),
]),
'',
$sub_title,
'',
$ai_text,
]);

if (!empty($ai_text)) {
$params['message'] = implode("\r\n", [
t('Your document has been processed by @model.', ['@model' => $ai_model]),
'',
t('You can always see your results and provide feedback online here: @link', [
'@link' => $node->toUrl()->setAbsolute()->toString(),
]),
'',
$sub_title,
'',
$ai_text,
]);
}
else {
$params['message'] = implode("\r\n", [
t('Your document has been processed by @model but was unable to generate it.', ['@model' => $ai_model]),
'',
t('You can always see your results and provide feedback online here: @link', [
'@link' => $node->toUrl()->setAbsolute()->toString(),
]),
]);
}

$mail_manager->mail($module, $key, $to, $langcode, $params);
}
Expand Down

0 comments on commit 07e23e9

Please sign in to comment.