gpt4 book ai didi

node.js - Bot 框架 V4 Nodejs 聊天记录记录

转载 作者:搜寻专家 更新时间:2023-10-31 23:50:09 26 4
gpt4 key购买 nike

出于审计/历史目的,我必须在 CosmosDB 中记录用户与机器人的对话。在使用 .Net 的 V3 中,我使用的是表记录器模块,如下面的代码。

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

现在我们正在将机器人升级/重写为 NodeJS 中的 V4。请指导是否有类似的方法可用于 NodeJS 中的 V4 来保存整个对话?

最佳答案

此示例尚未合并: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);

关于node.js - Bot 框架 V4 Nodejs 聊天记录记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54999417/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com