在 Docker 上使用 Text to Speech Adapter 部署 Voice Gateway

This documentation applies to a beta feature of IBM® Voice Gateway. For terms of use, see the beta license agreement.

对于本地安装,可以在 Docker 上将 Text to Speech Adapter 部署为 IBM® Voice Gateway 环境的一部分。Voice Gateway Text to Speech Adapter 封装为单独 Docker 映像,您需要与核心 SIP Orchestrator 和 Media Relay 映像一起配置和部署此映像。

开始之前

在 Docker 上部署 Text to Speech Adapter

以下指示信息假设您已成功将基本 Voice Gateway 环境部署到 Docker。有关 Docker 部署入门的完整设置信息,请参阅在Docker 上部署 Voice Gateway

  1. 切换到要从中部署 Voice Gateway 的目录,然后提取最新映像。您将需要 Voice Gateway 的核心映像,即 SIP Orchestrator (voice-gateway-so) 和 Media Relay (voice-gateway-mr) 以及 Text to Speech Adapter 映像 (voice-gateway-tts-adapter)。

    提示:如果先前部署了 Voice Gateway,那么可以使用现有映像。

     docker pull ibmcom/voice-gateway-so:latest
     docker pull ibmcom/voice-gateway-mr:latest
     docker pull ibmcom/voice-gateway-tts-adapter:latest
    
  2. 克隆 sample.voice.gateway GitHub 存储库并转至包含以下样本文件的 tts-adapter 目录:

    • docker-compose.yml:Docker 部署文件,该文件预先配置了将 Voice Gateway 与 Text to Speech Adapter 一起部署所需要的最低配置。

    docker-compose.yml 文件复制到部署目录。

  3. docker-compose.yml 文件中,填写任何空白环境变量以配置 Watson Assistant、Speech to Text 服务和 Google Cloud Text-to-Speech API。

    提示:对于先前部署,只要将 tts.adapter 容器的配置添加到现有 docker-compose.yml 文件即可。

    • sip.orchestrator 容器下,指定 Watson Assistant 凭证和工作空间标识,如以下示例所示。

      sip.orchestrator:
       ...
       environment:
      
         - WATSON_CONVERSATION_URL=https://gateway.watsonplatform.net/conversation/api/
         - WATSON_CONVERSATION_USERNAME=9h7f54cb-d9ed-46b3-8492-e9a9bf555021
         - WATSON_CONVERSATION_PASSWORD=InWtiUpYhF1Z
         - WATSON_CONVERSATION_WORKSPACE_ID=a23de67h-e527-40d5-a867-5c0ce9e72d0d
      
      • media.relay 容器下,配置 Speech to Text 服务的凭证。
      media.relay:
      ...
       environment:
      
         - WATSON_STT_USERNAME=9h7f54cb-5epb-80d6-45c3-da41d2bf7a71
         - WATSON_STT_PASSWORD=asxNzDLpIJ6F
         - WATSON_STT_URL=https://stream.watsonplatform.net/speech-to-text/api
      
      • tts.adapter 容器下,安装已从 Google Cloud 项目下载的凭证 JSON 文件。此外,在 GOOGLE_APPLICATION_CREDENTIALS 环境变量上指定容器内的位置。

      如果要指定除英语以外的其他语言,请在 GOOGLE_TTS_VOICE_LANGUAGE_CODE 环境变量上指定 BCP-47 语言标记。例如,对于西班牙语(西班牙),指定 es-ES。请注意,要使某种语言受支持,该语言必须受到与 Voice Gateway 集成的所有服务的支持,包括第三方语音服务和 Watson Assistant 服务。请参阅受支持的语言以获取详细信息。

      例如:

       tts.adapter:
         ...
         environment:
      
           - GOOGLE_APPLICATION_CREDENTIALS=/tts-adapter/credentials/google-service-account.json
           - GOOGLE_TTS_VOICE_LANGUAGE_CODE=es-ES
         volumes:
           - "/path/to/credentials/google-service-account.json:/tts-adapter/credentials/google-service-account.json"
      
  4. 通过运行以下命令启动容器:

    docker-compose up
    

后续操作

您可以进一步配置 Voice Gateway 部署,方法是编辑 docker-compose.yml 文件,然后重新部署容器。