gpt4 book ai didi

dialogflow-es - 是否可以在前端(Angular)中使用 dialogflow-nodejs-client-v2?

转载 作者:行者123 更新时间:2023-12-04 02:59:12 24 4
gpt4 key购买 nike

我很久以前使用 Firebase 和 dialogflow-javascript-client 构建了一个应用程序。

现在,dialogflow-javascript-client 已弃用。由于 dialogflow-nodejs-client-v2 是一个 node.js 客户端,它不应该在 Angular 上运行。他们是否放弃了对 javascript 的支持?我无法从开发人员那里得到任何答案,他们似乎只是在回避它。

如果不可能,我唯一的解决方案是在我的应用程序中放弃对 Dialogflow 的支持。

对于从 Javascript 迁移的用户,绝对没有文档或信息,这是他们唯一给你的东西:

enter image description here

当然我还是尝试运行它,认为它也是为在 javascript 上运行而构建的...

但这是我得到的:

WARNING in ./node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/google-gax/node_modules/grpc/src/grpc_extension.js 32:12-33 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/google-gax/node_modules/grpc/node_modules/minimatch/minimatch.js Module not found: Error: Can't resolve 'path' in 'D:\ng\ww-app\node_modules\google-gax\node_modules\grpc\node_modules\minimatch'

WARNING in ./node_modules/minimatch/minimatch.js Module not found: Error: Can't resolve 'path' in 'D:\ng\ww-app\node_modules\minimatch'

ERROR in ./node_modules/dialogflow/src/v2/agents_client.js Module not found: Error: Can't resolve './agents_client_config' in 'D:\ng\ww-app\node_modules\dialogflow\src\v2'

.... (many more following)

最佳答案

dialogflow-nodejs-client-v2 仅支持 node.js 环境。要将您的代理更新到 V2,您应该创建一个 Cloud Function for Firebase将请求发送到 dialogflow-nodejs-client-v2,然后从您的 Angular 代码调用该 Cloud Function,而不是直接调用 API。

这种方法的一个主要好处是:您的 API 凭据将不再暴露在客户端,这是一种安全风险。

关于dialogflow-es - 是否可以在前端(Angular)中使用 dialogflow-nodejs-client-v2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50890919/

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