機械翻訳について

Genesysでのコール・トランスクリプトの追加、提案の表示および要約

Genesysトランスクリプトの場合、Webソケットを介して進行中の会話のトランスクリプト・テキストを提供すると想定されます。

この項では、次の例に示すように、トランスクリプション・サービスからトランスクリプション結果を送信することを想定しています。

グラフィックを挿入

トランスクリプション・サービスのトランスクリプション結果は、次の形式に従う必要があります。

{
    "role": "AGENT" OR "END_USER", // Notifies fusion whether to render this transcript as Agent message or End user message.
    "transcript": "Hello", // The message to be rendered.
    "final": true OR false, // If final is set as false, a transcription in progress animation will be shown in Fusion.
    "messageId" :"12345" 

}

設定ステップ

  1. vendorHandler.tsファイルで、次のクラス変数を初期化します。
    export class VendorHandler implements ICtiVendorHandler {
        // ...
        private static TRANSCRIPT_ENDPOINT_URL: string = 'ws://localhost:8080/transcriptResult'; // Your endpoint that sends transcript results
        private static messageIds: string[] = [];
        // ...
    }
  2. vendorHandler.tsファイルのmakeAgentAvailable関数で、次の例に示すようにWebソケットを初期化します。
    public async makeAgentAvailable(): Promise<void> {
            //....
     
            // Transcript result web socker
            let transcriptWebsocket: WebSocket = new WebSocket(`${VendorHandler.TRANSCRIPT_ENDPOINT_URL}`);
            transcriptWebsocket.onopen = this.transcriptWebSocketOnOpenHandler.bind(this);
            transcriptWebsocket.onmessage = this.transcriptWebSocketOnMessage.bind(this);
            transcriptWebsocket.onclose = this.transcriptWebSocketCloseHandler.bind(this);
            transcriptWebsocket.onerror = this.transcriptWebSocketErrorHandler.bind(this);
        }
  3. 次の例に示すように、前述のイベント・リスナーを定義します。
    public async transcriptWebSocketOnOpenHandler(): Promise<void> {
            console.log("WebSocket opened");
        }
        public transcriptWebSocketErrorHandler(error: any): void {
            console.log("WebSocket error", error);
        }
        public transcriptWebSocketCloseHandler(event: Event): void {
            console.log("WebSocket is closed", event);
        }
     
        public transcriptWebSocketOnMessage(event: MessageEvent): void {
            const jsonMessage = JSON.parse(event.data);
            console.log(jsonMessage);
            if (jsonMessage.eventName === "TranscriptResult") {
                await this.handleTranscriptResponseFromSpeechService(event);
            }
        }
  4. 関数handleTranscriptResponseFromSpeechServiceを定義します。
    private async handleTranscriptResponseFromSpeechService(event: any): Promise<void> {
            let state = "STARTED";
            const responseFromServer = JSON.parse(event.data);
            const role: string = responseFromServer.role == 'AGENT' ? 'AGENT' : 'END_USER'
            if (responseFromServer.final) {
                state = "CLOSED"
            } else {
                if (VendorHandler.messageIds.includes(responseFromServer?.messageId))  {
                    state = "INPROGRESS";
                } else {
                    VendorHandler.messageIds.push(responseFromServer?.messageId)
                }
            }
            await this.integrationEventsHandler.addRealTimeTranscript(responseFromServer?.messageId, responseFromServer?.transcript, role, state);
        }

進捗の確認

これらのステップを完了したら、OJET serveを使用してアプリケーションを起動し、Fusionアプリケーションにサインインします。 メディア・ツールバーを開き、エージェントの空き状況ボタンをクリックして、エージェントを呼び出せるようにします。 次に、カスタマ・ケア番号へのコールを開始します。 受信コール通知は、メディア・ツールバー・アプリケーションおよびFusionウィンドウに表示されます。 このコールは、メディア・ツールバー・アプリケーションまたはFusionアプリケーションから受け入れることができます。 会話が開始されると、リアルタイム・トランスクリプトがFusionエンゲージメント・パネルにレンダリングされます。