用烧瓶运行RASA

时间:2019-06-13 11:25:24

标签: flask rasa-nlu rasa-core

我想在Python代码而不是命令行中使用--enable-api运行RASA。下面是我的代码不起作用。让我知道我该怎么做。问题是一旦我点击了服务,因为通道是“ cmdline”,它就出现在命令行中。我不知道该如何解决。

Postman

1 个答案:

答案 0 :(得分:1)

您正在使用以下命令在 run_weather_bot 功能的命令行中调用rasa bot。

  

rasa_core.run.serve_application(agent,channel ='cmdline')

您可以看到它作为命令行应用程序。

为了与rasa chatbot进行对话,我对您的代码进行了一些更改。您可以参考AGENT文档和Weather bot文章以了解RASA代理的连接以及RASA代理如何处理输入消息。

import tkinter as tk
from tkinter import StringVar

program_name="Quick Testing"
global loginout_button
loginoutbutton = StringVar()


def loginout_press():
    if loginout_button['text'] == "Log In":
       loginout_button.configure(text="Log Out")

else:
    loginout_button.configure(text="Log In") ###

class ProgramMain (tk.Tk):
    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        self.title(program_name)
        user_frame = tk.Frame(self, bg="grey", bd=2, relief="raised")
        user_frame.place(relx=0, rely=0.0, relwidth=9, relheight=1)
        loginout_button = tk.Button(user_frame, text="Log In", fg='black', bg="grey", font='bold 10',
                                command=loginout_press)
        loginout_button.place(relx=0.0, rely=0.0, relwidth=0.12, relheight=1)


app = ProgramMain()
app.mainloop()
相关问题