我希望能够在DialogFlow对话中重置上下文。这就是我的尝试:
func sendApiRequest(outgoing: String, isInitial: Bool) {
let request = ApiAI.shared().textRequest()
request?.query = [outgoing]
if isInitial {
let requestContext = AIRequestContext.init(name: "startup", andLifespan: 0, andParameters: nil)
request?.requestContexts = [requestContext]
}
// (send and get response)
..但是这无法重置上下文。有办法吗?
答案 0 :(得分:2)
使用Node.js这对我们有用
{{1}}
答案 1 :(得分:1)
您可以通过DELETE /contexts
路由重置所有上下文。
参考: https://dialogflow.com/docs/reference/agent/contexts#delete_contexts
由于iOS docs没有真正的对话流... 看看这里: https://github.com/dialogflow/dialogflow-apple-client/blob/b4959a548c24094b0742dc77eda4381d32f35ec4/ApiAI/Classes/AITextRequest.m#L53