【发布时间】:2019-06-04 06:51:44
【问题描述】:
我需要集成 Azure bot 框架,我这样做并使用styleOptions 参数制作了一些样式,
但是当我尝试通过 webSpeechPonyFillFactory param 时,我没有得到麦克风图标或任何更改。
这是我的代码:
import { DirectLine } from 'botframework-directlinejs';
import React, { Component } from 'react';
import ReactWebChat,{ Components, createDirectLine, createCognitiveServicesSpeechServicesPonyfillFactory } from 'botframework-webchat';
import './chat.css'
class Chat extends Component {
constructor(props) {
super(props);
this.state = {
options: {},
webSpeechPonyfillFactory: {
region: 'westus',
subscriptionKey: "242a*88**************a70b2",
textNormalization: 'lexical'
}
};
this.directLine = new DirectLine({ token: 'hyyw*********************c' });
}
async componentDidMount(){
this.setState({webSpeechPonyfillFactory : await createCognitiveServicesSpeechServicesPonyfillFactory( { region: 'westus', subscriptionKey: '242a**************0b2',textNormalization: 'lexical' })});
}
render() {
return (
<div className="chat">
<ReactWebChat directLine={this.directLine} userID="" webSpeechPonyFillFactory={this.state.webSpeechPonyfillFactory}
styleOptions={{
backgroundColor: '#fff',
bubbleBackground: '#FFFFFF',
bubbleBorder: 'solid 0px #fff',
bubbleBorderRadius: 20
}} />
</div>
);
}
}export default Chat;
当我在 JS 中实现时,它可以工作,但是当我尝试与 React 集成时:(
【问题讨论】:
标签: reactjs azure botframework microsoft-cognitive