Conversation's response in two and more bubbles

dialogflow

#1

Hello, community! I’m trying to split text into several bubbles (speech messages) continiously followings each other , but generally I always get one bubble. I’ve tried ssml, speechEditor and other variants described in doc. Does anybody solved this issue?


#2

Good point.
I’m waiting for a Pull Request and will publish the feature tomorrow.

It will look like this

this.$googleAction!.appendSimpleResponse({
    displayText: 'Hello',
    textToSpeech: 'Test'
});

#3

@AlexSwe it’s quite similar to https://www.jovo.tech/docs/google-assistant/visual-output#display-text , but does it resolves the issue with multiple bubbles? I’ve found here https://stackoverflow.com/questions/49417694/how-can-i-create-a-multi-part-response-with-dialogflow that someone tried to investigate this case earlier, bit seems no luck!


#4

Published the feature a couple of minutes ago.

Yes, this will add a second bubble. (it’s not possible to add more)

Full sample:

this.tell('HelloWorld');
this.$googleActionappendSimpleResponse({
    displayText: 'Hello',
    textToSpeech: 'Test'
});


#5

Have tested and should say it works fine! By the way, could we send in a cast of second speech buble e.g. Basic Card?


#6

Try this:

const basicCard = new BasicCard()
            .setTitle('Title')
            .setImage({
                url: 'http://via.placeholder.com/450x350?text=Basic+Card',
                accessibilityText: 'accessibilityText'})
            .setFormattedText('Formatted Text')
            .setImageDisplay('WHITE');
this.$googleAction.appendResponse({
        basicCard
});
this.tell('HelloWorld');

#7

Thank you! I got it. When I use SSML with markup my agent pronounce all tags . Can I avoid it?


#8

Can you share some code? Usually SSML-tags aren’t pronounced


#9

I use SpeechBuilder

function get_help_info(e_g_jovo_obj) {

    return e_g_jovo_obj.speechBuilder()
        .addSentence('You are playing XXX quiz.')
        .addBreak('100ms')
        .addSentence('Do you need to hear the question once more?');
}

So, the output contains tags <speak>, <s>.
Using

let info = get_help_info();
this.$googleAction.appendSimpleResponse({
                displayText: ...,
                textToSpeech: ...
            });

like that needs some processing of info object , 'cause appendSimpleResponse won’t work with it and when I use info.speech property then SSML tags are shown in the output and assistant pronounce tags also.


#10

So, you want to remove the SSML tags from the string?
You could use a SpeechBuilder helper method.

const { App, SpeechBuilder } = require('jovo-framework');

In your case:

SpeechBuilder.removeSSML(info.speech)

#11

Not actually. Yes, I can strip tags, but it will cause effect on both display text and text to speech. What I really want is to use appendSimpleResponse for second bubble , show html-stripped text on device screen , but still hear voice with delays(breaks) and other SSML features.


#12

I may misunderstand something, but the sample below should solve the problem?! :smiley:

let textWithoutSSML = SpeechBuilder.removeSSML(info.speech);

this.$googleAction.appendSimpleResponse({
                displayText: textWithoutSSML ,
                textToSpeech: info.speech
});

#13

I think I’ve been testing this one :slight_smile: I’ll check one more time. Thank you!


#14
this.ask(speech);

const { SpeechBuilder } = require('jovo-framework');
let sp = this.speechBuilder()
        .addSentence('Hello, how are you?')
        .addBreak('300ms')
        .addSentence('Hope you are doing well.');

let textWithoutSSML = SpeechBuilder.removeSSML(sp.speech);
this.$googleAction.appendSimpleResponse({
        displayText: textWithoutSSML,
        textToSpeech: sp.speech
});

Unforunately, my rich response output is

"richResponse": {
"items": [
{
"simpleResponse": {
"ssml": "<speak><s>Hello and welcome back, my friend!</s> <break time=\"300ms\"/> <s>You are on </s> <say-as interpret-as=\"ordinal\">2</say-as> level. Get ready for your question. <break time=\"100ms\"/> <s>The right answer contains </s> <say-as interpret-as=\"cardinal\">4</say-as>  letters. <break time=\"300ms\"/></speak>"
}
},
{
"simpleResponse": {
"displayText": "Hello, how are you?  Hope you are doing well.",
"textToSpeech": "<s>Hello, how are you?</s> <break time=\"300ms\"/> <s>Hope you are doing well.</s>"
}
}
]
}

and all meta tags from appendSimpleResponse() was sayed by assistant