-
Notifications
You must be signed in to change notification settings - Fork 48
/
chatbot.py
61 lines (43 loc) · 1.14 KB
/
chatbot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import click
import subprocess
from cs_client import build_chatbot_engine
@click.group()
def main(args=None):
"""Console script for chatbot"""
pass
@main.group()
def log(args=None):
"""Log handling"""
pass
@log.command()
def download(args=None):
"""Download log from server"""
subprocess.call(["rsync", "-Pav", "[email protected]:/root/service/chatbot/logs/*", "logs"])
print("Download log")
@main.group()
def server(args=None):
"""Server handling"""
pass
@server.command()
def cs():
"""Start ChatScript server"""
print("Start ChatScript server")
subprocess.call("./script_cs.sh", shell=True)
@server.command()
def cs_local():
"""Start ChatScript server"""
print("Start ChatScript local")
subprocess.call("./script_cs_local.sh", shell=True)
@server.command()
def web():
"""Start Web server"""
print("Start Web server")
subprocess.call("./script_web.sh", shell=True)
@main.command()
def build():
"""Build chatbot engine"""
print("Build chatbot engine")
build_chatbot_engine()
print("Chatbot engine is built successfully.")
if __name__ == '__main__':
main()