演讲者未显示 symbl ai 实时文字记录

问题描述 投票:0回答:1

我已经通过 websocket 连接到 symbl 的流 api 并发送了

start request
,如下所示;

{
        type: "start_request",
        meetingTitle: "Symbl Connect SIP",
        config: {
          confidenceThreshold: 0.5,
          languageCode: "en-US",
          speechRecognition: {
            encoding: "LINEAR16",
            sampleRateHertz:
              userType === "user" ? this.sampleRateUser : this.sampleRateAgent,
          },
          trackers: {
            enableAllTrackers: true,
            interimResults: true,
          },
 speaker: {
          ...speaker,
          name: userType,
        },
        },
       
      }

但是,当我绑定到

onmessage
事件时,实时
transcription
message_response
没有应具有名称和 userId 的
from
(
message_response
) 或
user
(转录)字段。输出看起来像这样;

  • message_response
messages: [
    {
      payload: {
        content: string,
        contentType: "text/plain",
      },
      id: string,
      channel: {
        id: "realtime-api",
      },
      metadata: {
        disablePunctuation: true,
        originalContent: string,
        words: string,
        originalMessageId: string,
      },
      dismissed: false,
      duration: {
        startTime: string,
        endTime: string,
        timeOffset: number,
        duration: number,
      },
      entities: [],
    },
  ]
  • 实时转录
{
    type: "recognition_result",
    isFinal: false,
    payload: {
      raw: {
        alternatives: [
          {
            words: [],
            transcript: "Hello",
            confidence: 0,
          },
        ],
      },
    },
    punctuated: {
      transcript: "Hello",
    }
}

在本例中缺少

user
from
字段。

我期望输出是这样的;

{
    type: "recognition_result",
    isFinal: false,
    payload: {
      raw: {
        alternatives: [
          {
            words: [],
            transcript: "Hello",
            confidence: 0,
          },
        ],
      },
    },
    punctuated: {
      transcript: "Hello",
    },
    user: {
      name: "agent",
      userId: "[email protected]",
    "id": "1a726dac-1c95-484d-a99e-69e36950bf32"
  }

{
      from: {
        id: string,
        name: string,
        userId: string,
      },
      payload: {
        content: string,
        contentType: "text/plain",
      },
      id: string,
      channel: {
        id: "realtime-api",
      },
      metadata: {
        disablePunctuation: true,
        originalContent: string,
        words: string,
        originalMessageId: string,
      },
      dismissed: false,
      duration: {
        startTime: string,
        endTime: string,
        timeOffset: number,
        duration: number,
      },
      entities: [],
    }
webrtc
1个回答
0
投票

要解决此问题,您所需要做的就是将配置对象外部的

speaker
对象移至与配置相同的级别。像这样;

{
        type: "start_request",
        meetingTitle: "Symbl Connect SIP",
        config: {
          confidenceThreshold: 0.5,
          languageCode: "en-US",
          speechRecognition: {
            encoding: "LINEAR16",
            sampleRateHertz:
              userType === "user" ? this.sampleRateUser : this.sampleRateAgent,
          },
          trackers: {
            enableAllTrackers: true,
            interimResults: true,
          },
        },
       speaker: {
          ...speaker,
          name: userType,
        },
      }
}
© www.soinside.com 2019 - 2024. All rights reserved.