-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBot.py
More file actions
18 lines (14 loc) · 725 Bytes
/
Bot.py
File metadata and controls
18 lines (14 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Initialize bot and listen on port 5004
from rasa_core.channels.slack import SlackInput
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
import yaml
from rasa_core.utils import EndpointConfig
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/grandmarecipes')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/dialogue', interpreter=nlu_interpreter, action_endpoint=action_endpoint)
# Get Slack bot verification token
with open('slack_bot_verification.txt') as verificationFile:
bot_token = verificationFile.readline()
input_channel = SlackInput(bot_token)
agent.handle_channels([input_channel], 5004, serve_forever=True)