Bot框架V4 Nodejs聊天记录记录

时间:2019-03-05 09:26:36

标签: node.js botframework

为了审核/历史记录,我必须在CosmosDB中记录用户与机器人的对话。在使用.Net的V3中,我正在使用表记录器模块,如下面的代码。

builder.RegisterModule(new TableLoggerModule(account,chatHistoryTableName));

现在,我们正在将Bot升级/重写为NodeJS中的V4。请指导NodeJS中的V4是否有类似的方法可以保存整个对话?

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

此示例尚未合并:https://github.com/Microsoft/BotBuilder-Samples/pull/1266

它使用AzureBlobTranscriptStore和TranscriptLoggerMiddleware

const { AzureBlobTranscriptStore  } = require('botbuilder-azure');
const { TranscriptLoggerMiddleware } = require('botbuilder-core');

// Get blob service configuration as defined in .bot file
const blobStorageConfig = botConfig.findServiceByNameOrId(BLOB_CONFIGURATION);
// The transcript store has methods for saving and retrieving bot conversation transcripts.
let transcriptStore = new AzureBlobTranscriptStore({storageAccountOrConnectionString: blobStorageConfig.connectionString,
                                                    containerName: blobStorageConfig.container
                                                    });
// Create the middleware layer responsible for logging incoming and outgoing activities
// into the transcript store.
var transcriptMiddleware = new TranscriptLoggerMiddleware(transcriptStore);
adapter.use(transcriptMiddleware);