如何从IDE而不是内联编辑器编写实现代码?

问题描述 投票:0回答:1

我想知道是否可以使用首选的IDE而不是在提供的嵌入式编辑器中编写您的实现功能?如果是这样,谁能提供步骤/链接来建立IDE与指定代理之间的通信?

P.S。我已经尝试使用Dialogflow API,并且由于我不想将我的代理实施到网站中,所以没有用。

javascript python agent dialogflow-fulfillment
1个回答
0
投票

在这里,您可以使用以下步骤连接服务器以实现Dialogflow。

  1. 使用首选语言创建服务器(我使用过NodeJS / Express)
  2. 当您在本地主机上运行它时,将其公开,以便dialogflow可以连接到您的服务器。
  3. 使用ngrok进行代理公开。
  4. 在Dialogflow中添加履行详细信息。
  5. 在本地编写代码。

app.js

const app = express();
app.use('/assets', express.static(path.join(__dirname, 'assets')))
app.get("/", (req, res) => res.send("online"));
app.post("/dialogflow", express.json(), (req, res) => {
    const agent = new WebhookClient({ request: req, response: res });

    let intentMap = new Map();
    intentMap.set("Default Welcome Intent", welcome);
    intentMap.set("Exit Intent", exit);
});
function exit(agent){}
function welcome(agent){}

运行Ngrok并获取公共链接run ngrok get the public link

在Dialogflow实现中添加这些服务器详细信息enter image description here

[注意:这仅用于本地开发,以后您可以在运行您的实现的位置添加真实的生产服务器URL。

© www.soinside.com 2019 - 2024. All rights reserved.