附加以下代码段。 botbuilder 4.1.5中已弃用UniversalBot和ChatConnector。
data_augmentation_options = [(preprocessor.resize_image, {
'new_height': 20,
'new_width': 20,
'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
}),(preprocessor.random_horizontal_flip, {
})]
答案 0 :(得分:1)
您的问题相当笼统。
3.x中的会话对象已被删除。取而代之的是使用配件。您将需要在bot类中执行以下操作:
public onTurn = async (turnContext: TurnContext) => {
const userProfile = await this.userProfile.get(turnContext, new UserProfile());
const conversationData = await this.dialogStateAccessor.get(turnContext, { dialogStack: undefined });
// set vars in cache
userProfile.yourUserVarProp = "userValue";
conversationData.yourConversationVarProp = "conversationValue";
// persist userVars through dialog turn
await this.userProfile.set(turnContext, userProfile);
// persist conversationVars through dialog turn
await this.dialogStateAccessor.set(turnContext, conversationData);
//
// -> your dialogs here (await dc.beginDialog("dialogname");)
//
// save uservars to db at end of a turn
await this.userState.saveChanges(turnContext);
// save conversationVars to db at end of a turn
await this.conversationState.saveChanges(turnContext);
}
但是还有一些构造函数的东西
...并创建userProfile和dialogStateAccessor本身。
整个图片最好看一下https://github.com/Microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs。