@@ -67,7 +67,7 @@ import XAppOverlay from "./functional/xapp-overlay/XAppOverlay";
67
67
import { getSourceBackgroundColor } from "../utils/sourceMapping" ;
68
68
import type { Options } from "@cognigy/socket-client/lib/interfaces/options" ;
69
69
import speechOutput from "./plugins/speech-output" ;
70
- import getMessagesListWithoutPrivacyMessage from "../utils/filter-out-privacy-message " ;
70
+ import getMessagesListWithoutControlCommands from "../utils/filter-out-control-commands " ;
71
71
72
72
export interface WebchatUIProps {
73
73
currentSession : string ;
@@ -1382,7 +1382,7 @@ export class WebchatUI extends React.PureComponent<
1382
1382
1383
1383
// Find privacy message and remove it from the messages list (these message types are not displayed in the chat log).
1384
1384
// If we do not remove, it will cause the collatation of the first user message.
1385
- const messagesExcludingPrivacyMessage = getMessagesListWithoutPrivacyMessage ( messages ) ;
1385
+ const messagesExcludingPrivacyMessage = getMessagesListWithoutControlCommands ( messages , [ "acceptPrivacyPolicy" ] ) ;
1386
1386
1387
1387
return (
1388
1388
< >
@@ -1391,9 +1391,13 @@ export class WebchatUI extends React.PureComponent<
1391
1391
</ TopStatusMessage >
1392
1392
{ messagesExcludingPrivacyMessage . map ( ( message , index ) => {
1393
1393
// Lookahead if there is a user reply
1394
- const hasReply = messages
1394
+ const hasReply = messagesExcludingPrivacyMessage
1395
1395
. slice ( index + 1 )
1396
- . some ( message => message . source === "user" ) ;
1396
+ . some (
1397
+ message =>
1398
+ message . source === "user" &&
1399
+ ! ( message ?. data ?. _cognigy as any ) ?. controlCommands ,
1400
+ ) ;
1397
1401
1398
1402
return (
1399
1403
< Message
@@ -1408,7 +1412,7 @@ export class WebchatUI extends React.PureComponent<
1408
1412
onSetFullscreen = { ( ) => this . props . onSetFullscreenMessage ( message ) }
1409
1413
openXAppOverlay = { openXAppOverlay }
1410
1414
plugins = { messagePlugins }
1411
- prevMessage = { messages ?. [ index - 1 ] }
1415
+ prevMessage = { messagesExcludingPrivacyMessage ?. [ index - 1 ] }
1412
1416
theme = { this . state . theme }
1413
1417
/>
1414
1418
) ;
0 commit comments