8编码的google上,无法在操作中解析java-ssml

w6lpcovy  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(201)

我用tts模拟器尝试了ssml输出,结果很好。但是,当我从我的实现后端返回相同的ssml输出时,出现了错误。

  1. MalformedResponse at expected_inputs[0].input_prompt.rich_initial_prompt.items[0].simple_response: 'ssml' could not be parsed

我的后端实现将输出编码为utf-8,结果,输出将<to\u003c和>编码为\u003d,这使得每件事情都失败了。
从日志资源管理器捕获的原始响应:

  1. {
  2. "simpleResponse": {
  3. "displayText":"星級導師 - Zoe",
  4. "ssml":"\u003cspeak\u003e 星級導師 - Zoe \u003cbreak time\u003d\u00271\u0027 /\u003e \u003c/speak\u003e \u003cspeak\u003e \u003cp\u003e \u003cs\u003e香港中文大學體育運動科學系理學碩士學生,Zolar Fitness 創辦人,健身教練。由肥妹變成健身室老闆,致力推動健康資訊給香港人。\u003c/s\u003e \u003c/p\u003e\u003c/speak\u003e"
  5. }
  6. }

google上的actions是否接受utf-8编码来实现响应?或者我应该用其他编码来编码我的React?
(2020/12/03更新)
如果包含texttospeech组件,则不会显示此错误消息。

  1. {
  2. "simpleResponse": {
  3. "displayText":"星級導師 - Zoe",
  4. "ssml":"\u003cspeak\u003e 星級導師 - Zoe \u003cbreak time\u003d\u00271\u0027 /\u003e \u003c/speak\u003e \u003cspeak\u003e \u003cp\u003e \u003cs\u003e香港中文大學體育運動科學系理學碩士學生,Zolar Fitness 創辦人,健身教練。由肥妹變成健身室老闆,致力推動健康資訊給香港人。\u003c/s\u003e \u003c/p\u003e\u003c/speak\u003e",
  5. "textToSpeech":"\u003cspeak\u003e 星級導師 - Zoe \u003cbreak time\u003d\u00271\u0027 /\u003e \u003c/speak\u003e \u003cspeak\u003e \u003cp\u003e \u003cs\u003e香港中文大學體育運動科學系理學碩士學生,Zolar Fitness 創辦人,健身教練。由肥妹變成健身室老闆,致力推動健康資訊給香港人。\u003c/s\u003e \u003c/p\u003e\u003c/speak\u003e"
  6. }
  7. }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题