简体   繁体   English

如何在 DialogFlow 上建立永久会话?

[英]How to make a permanent session on DialogFlow?

I imagine that to do this I need, somehow, to save the contexts in a DB and return them when requested.我想要做到这一点,我需要以某种方式将上下文保存在数据库中并在请求时返回它们。 In another topic here on Stackoverflow, I found this code below, but when implementing it an error is returned.在 Stackoverflow 上的另一个主题中,我在下面找到了这段代码,但是在实现它时会返回一个错误。

 // request to dialogflow detect intent const request = { session: session, queryInput: { input }, context:"last received context from dialogflow" //recent context from db }; detectIntent(request).then(response=>{ const context = response.context; //response context db.save(context); // save this in db return response; });

dialogflow won't call intents unless the input context is present.除非存在输入上下文,否则对话流不会调用意图。 no matter how high a priority i give to an intent, if there is a missing context, it won't be invoked.无论我给意图的优先级有多高,如果缺少上下文,它都不会被调用。 How to resolve this ?如何解决这个问题?

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

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