我正在尝试使用 DirectLine(Bot Framework)拦截发送到虚拟代理机器人的请求和响应。我已经使用以下方式订阅了直线活动:
directLine.activity$.subscribe(message => console.log(message));
从这里我得到了我可以在客户端显示之前操作的消息对象。我想要的是找到机器人为对话选择的主题。根据主题我想做不同的事情,我怎样才能得到它?
这是我收到的消息示例:
{
type: 'message',
id: 'IvkoXGKm9ZKIHdjv6foMM6-in|0000001',
timestamp: '2023-03-20T05:26:13.7251392Z',
channelId: 'directline',
from: { id: '5903103d-ad35-496c-acb4-9f797198ab51', name: 'John' },
conversation: { id: 'IvkoXGKm9ZKIHdjv6foMM6-in' },
textFormat: 'markdown',
membersAdded: [],
membersRemoved: [],
reactionsAdded: [],
reactionsRemoved: [],
text: 'Can you tell me your name ?',
speak: '<speak version="1.0" xml:lang="en-US" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns="http://www.w3.org/2001/10/synthesis">Can you tell me your name ?</speak>',
attachments: [],
entities: [],
replyToId: 'IvkoXGKm9ZKIHdjv6foMM6-in|0000000',
listenFor: [],
textHighlights: []
}
我期望应该有一种方法可以从消息中获取主题。任何帮助,将不胜感激。谢谢!