简体   繁体   English

Bot Framework V4 Nodejs聊天历史记录

[英]Bot framework V4 Nodejs chat history logging

I have to log the user-bot conversation in CosmosDB for audit/history purpose. 为了审核/历史记录,我必须在CosmosDB中记录用户与机器人的对话。 In V3 using .Net, I was using table logger module, like the below code. 在使用.Net的V3中,我正在使用表记录器模块,如以下代码所示。

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

Now we are upgrading/rewriting the bot to V4 in NodeJS. 现在,我们将Bot升级/重写为NodeJS中的V4。 Please guide if there is a similar approach available for V4 in NodeJS to save the entire conversation? 请指导NodeJS中是否有针对V4的类似方法来保存整个对话?

This example hasn't been merged yet: https://github.com/Microsoft/BotBuilder-Samples/pull/1266 此示例尚未合并: https : //github.com/Microsoft/BotBuilder-Samples/pull/1266

It uses AzureBlobTranscriptStore and TranscriptLoggerMiddleware 它使用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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM