要让Bixby阅读未显示的文本,你可以使用以下代码示例中的speech
动作和synthesizeSpeech
方法。
首先,在你的Bixby模型中创建一个action
,例如ReadUnseenText
,并在input
部分定义一个文本输入参数,例如unseenText
。
然后,你可以在action
的output
部分使用以下代码示例中的speech
动作,通过调用synthesizeSpeech
方法将文本转换为语音。
action (ReadUnseenText) {
description (Read unseen text)
type (Constructor)
collect {
input (unseenText) {
type (Text)
min (Required) max (One)
prompt-behavior (AlwaysElicitation)
}
}
output {
speech {
template ("#{value(unseenText)}")
synthesizeSpeech {
message ("#{value(unseenText)}")
contentType (ssml)
}
}
}
}
这段代码使用speech
动作来定义Bixby的响应,template
字段将显示文本响应在屏幕上,而synthesizeSpeech
字段通过调用message
方法将文本转换为语音,然后将其输出给用户。
这样,当用户调用这个action
并提供未显示的文本作为输入时,Bixby将会将文本读给用户听。