diff --git a/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-expectations.ts b/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-expectations.ts index 79eafc42e97..038bfd3f45d 100644 --- a/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-expectations.ts +++ b/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-expectations.ts @@ -208,6 +208,20 @@ function generatedAnswerExpectations(selector: GeneratedAnswerSelector) { .log(`should display the rephrase button with the label ${label}`); }, + displayDisclaimer: (display: boolean) => { + selector + .disclaimer() + .should(display ? 'exist' : 'not.exist') + .log(`${should(display)} display the disclaimer`); + }, + + disclaimerContains: (text: string) => { + selector + .disclaimer() + .contains(text) + .log(`the disclaimer should contain "${text}"`); + }, + rephraseButtonIsSelected: (name: string, selected: boolean) => { selector .rephraseButtonByLabel(name) diff --git a/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-selectors.ts b/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-selectors.ts index e92b91536b1..11e6cf5a3f8 100644 --- a/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-selectors.ts +++ b/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer-selectors.ts @@ -29,6 +29,7 @@ export interface GeneratedAnswerSelector extends ComponentSelector { citationTooltipUri: (index: number) => CypressSelector; citationTooltipTitle: (index: number) => CypressSelector; citationTooltipText: (index: number) => CypressSelector; + disclaimer: () => CypressSelector; } export const GeneratedAnswerSelectors: GeneratedAnswerSelector = { @@ -126,4 +127,8 @@ export const GeneratedAnswerSelectors: GeneratedAnswerSelector = { '[data-cy="generated-answer__citations"] [data-cy="citation__tooltip-text"]' ) .eq(index), + disclaimer: () => + GeneratedAnswerSelectors.get().find( + '[data-cy="generated-answer__disclaimer"]' + ), }; diff --git a/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer.cypress.ts b/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer.cypress.ts index 3af3642a4b1..2725c49427a 100644 --- a/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer.cypress.ts +++ b/packages/quantic/cypress/e2e/default-2/generatedAnswer/generated-answer.cypress.ts @@ -65,6 +65,9 @@ const genQaMessageTypePayload = { const retryableErrorCodes = [500, 429]; +const GENERATED_ANSWER_DISCLAIMER = + 'Generated content may contain errors. Verify important information.'; + describe('quantic-generated-answer', () => { beforeEach(() => { cy.clock(0, ['Date']); @@ -136,6 +139,12 @@ describe('quantic-generated-answer', () => { Expect.generatedAnswerIsStreaming(false); }); + it('should display the disclaimer', () => { + Expect.displayDisclaimer(true); + Expect.disclaimerContains(GENERATED_ANSWER_DISCLAIMER); + Expect.generatedAnswerIsStreaming(false); + }); + it('should perform a search query with the default rephrase button', () => { cy.wait(InterceptAliases.Search); Expect.searchQueryContainsCorrectRephraseOption( @@ -228,6 +237,7 @@ describe('quantic-generated-answer', () => { scope('when loading the page', () => { Expect.displayGeneratedAnswerCard(true); Expect.generatedAnswerFooterIsOnMultiline(true); + Expect.displayDisclaimer(true); }); }); }); @@ -258,6 +268,7 @@ describe('quantic-generated-answer', () => { Expect.displayCopyToClipboardButton(false); Expect.displayToggleGeneratedAnswerButton(true); Expect.toggleGeneratedAnswerButtonIsChecked(true); + Expect.displayDisclaimer(false); }); }); @@ -596,6 +607,7 @@ describe('quantic-generated-answer', () => { Expect.displayGeneratedAnswerContent(false); Expect.displayLikeButton(false); Expect.displayDislikeButton(false); + Expect.displayDisclaimer(false); if (analyticsMode === 'next') { NextAnalyticsExpectations.emitQnaAnswerActionEvent( { @@ -864,6 +876,7 @@ describe('quantic-generated-answer', () => { cy.wait(getStreamInterceptAlias(streamId)); } Expect.displayGeneratedAnswerCard(true); + Expect.displayDisclaimer(false); Actions.clickRetry(); cy.wait(InterceptAliases.Search); diff --git a/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.html b/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.html index 914b0c2c9c4..f2d51553272 100644 --- a/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.html +++ b/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.html @@ -119,6 +119,10 @@ +
+ +
+
diff --git a/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js b/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js index 1bcd2e640b9..5cb4edbbab4 100644 --- a/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js +++ b/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js @@ -21,7 +21,7 @@ export default class ExampleInsightPanel extends LightningElement { /** @type {string} */ @api engineId = 'example-insight-panel'; /** @type {string} */ - @api insightId = '6a333202-b1e0-451e-8664-26a1f93c2faf'; + @api insightId = '142be676-703c-445f-b2d3-fcc7c0a3ded8'; connectedCallback() { this.template.addEventListener( diff --git a/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js-meta.xml b/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js-meta.xml index 0fe56d9cda8..50c2e4e193e 100644 --- a/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js-meta.xml +++ b/packages/quantic/force-app/examples/main/lwc/exampleInsightPanel/exampleInsightPanel.js-meta.xml @@ -12,7 +12,7 @@ - + \ No newline at end of file diff --git a/packages/quantic/force-app/main/default/labels/CustomLabels.labels-meta.xml b/packages/quantic/force-app/main/default/labels/CustomLabels.labels-meta.xml index 6d5bf107f24..cd18f45f26d 100644 --- a/packages/quantic/force-app/main/default/labels/CustomLabels.labels-meta.xml +++ b/packages/quantic/force-app/main/default/labels/CustomLabels.labels-meta.xml @@ -1400,11 +1400,18 @@ false Generated answer ON - + quantic_GeneratedAnswerOff Generated answer OFF en_US false Generated answer OFF + + quantic_RGADisclaimer + Generated content may contain errors. Verify important information. + en_US + false + Generated answer disclaimer + \ No newline at end of file diff --git a/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js b/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js index 17668eec259..704f30a8a88 100644 --- a/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js +++ b/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js @@ -10,6 +10,7 @@ import irrelevant from '@salesforce/label/c.quantic_Irrelevant'; import loading from '@salesforce/label/c.quantic_Loading'; import other from '@salesforce/label/c.quantic_Other'; import outOfDate from '@salesforce/label/c.quantic_OutOfDate'; +import rgaDisclaimer from '@salesforce/label/c.quantic_RGADisclaimer'; import thisAnswerWasHelpful from '@salesforce/label/c.quantic_ThisAnswerWasHelpful'; import thisAnswerWasNotHelpful from '@salesforce/label/c.quantic_ThisAnswerWasNotHelpful'; import tryAgain from '@salesforce/label/c.quantic_TryAgain'; @@ -102,6 +103,7 @@ export default class QuanticGeneratedAnswer extends LightningElement { generatingAnswer, generatedAnswerIsHidden, answerGenerated, + rgaDisclaimer, }; /** @type {GeneratedAnswer} */ @@ -399,7 +401,7 @@ export default class QuanticGeneratedAnswer extends LightningElement { } get generatedAnswerFooterCssClass() { - return `slds-grid slds-grid_align-spread generated-answer__footer--${ + return `slds-grid slds-wrap slds-grid_align-spread generated-answer__footer--${ this.multilineFooter ? 'multiline' : 'standard' }`; } @@ -421,6 +423,14 @@ export default class QuanticGeneratedAnswer extends LightningElement { }`; } + get shouldShowDisclaimer() { + return this.isVisible && !this.isStreaming; + } + + get disclaimerCssClass() { + return `slds-var-m-top_small slds-col slds-size_1-of-1 slds-text-color_weak slds-text-body_small ${this.multilineFooter ? '' : 'slds-text-align_right'}`; + } + /** * Sets the component in the initialization error state. */ diff --git a/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html b/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html index d1197c22559..f88b9ce776f 100644 --- a/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html +++ b/packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html @@ -65,6 +65,13 @@ >
+ diff --git a/packages/quantic/force-app/main/translations/fr.translation-meta.xml b/packages/quantic/force-app/main/translations/fr.translation-meta.xml index 2d8a40900e1..ef41ba51cb9 100644 --- a/packages/quantic/force-app/main/translations/fr.translation-meta.xml +++ b/packages/quantic/force-app/main/translations/fr.translation-meta.xml @@ -776,4 +776,8 @@ quantic_GeneratedAnswerOff + + + quantic_RGADisclaimer + diff --git a/packages/quantic/quantic-examples-community/experiences/Quantic_Examples1/views/insightPanelExample.json b/packages/quantic/quantic-examples-community/experiences/Quantic_Examples1/views/insightPanelExample.json index 69200b41d64..7806c62ad81 100644 --- a/packages/quantic/quantic-examples-community/experiences/Quantic_Examples1/views/insightPanelExample.json +++ b/packages/quantic/quantic-examples-community/experiences/Quantic_Examples1/views/insightPanelExample.json @@ -34,7 +34,7 @@ { "componentAttributes": { "engineId": "example-insight-panel", - "insightId": "6a333202-b1e0-451e-8664-26a1f93c2faf" + "insightId": "142be676-703c-445f-b2d3-fcc7c0a3ded8" }, "componentName": "c:exampleInsightPanel", "id": "fb698de6-174b-447f-817b-08959bfa06ce",