Chatopera Cloud Service | Getting Started Tutorial | Documentation Center
GitHub | Gitee
This source code library provides multiple sample program projects. Based on these projects, you can:
For chattopera/chatbot-samples work orders, submit them to-
https://github.com/chatopera/docs/issues?q=label%3ASamples
The CLI command line tool is an automated script command. You can use the CLI command line tool to quickly import or export robot corpus. To use the CLI tool, you need to install the dependencies first:
CLI also relies on the operating system's command line terminal, such as PowerShell, CMD Prompt, Bash Shell, etc.
Open a command line interrupt, such as PowerShell, execute npm --version
and confirm that you can see similar output.
Prove that nodejs has been installed successfully. Then, execute:
npm install -g @chatopera/sdk
Install the CLI. After executing the above command, execute `` on the command line and confirm that you can see output similar to this.
git clone https://github.com/chatopera/chatbot-samples.git
cd chatbot-samples
pwd # 得到代码路径 ROOT_PATH
ls projects # projects 目录内存放多个示例项目
{{ROOT_PATH}}
is the path where the project https://github.com/chatopera/chatbot-samples is stored, such as /c/Users/Administrator/chatbot-samples
.
First, install the CLI and cloning code, then follow the steps below.
Import a sample program into an existing chatbot. Assume that you have created a chatbot at https://bot.chatopera.com/dashboard and obtained the ClientID and Secret information.
Then execute the following commands in order :
#cd {{ROOT_PATH}}/projects/{{PROJECT_NAME}} # 使用哪个示例项目,就进入哪个文件夹
cd {{ROOT_PATH}}/projects/GitHub工单机器人 # 比如,进入【GitHub工单机器人】
bot env # 自动生成 .env 文件,然后更新 .env 文件中的 BOT_CLIENT_ID 和 BOT_CLIENT_SECRET
bot dicts --action import -f bot.dicts.json # 导出词典
bot faq --action import -f bot.faqs.json # 导出知识库
bot intents --action import -f bot.intents.json # 导出意图识别
bot conversation --action import -f bot.conversations.c66 # 导出多轮对话
In this way, you can access the robot, such as from the H5 chat control, and talk to the robot.
Export the robot's corpus in the current .env
file to a local corpus file.
cd {{ROOT_PATH}}/projects/GitHub工单机器人 # 使用哪个示例项目,就进入哪个文件夹
bot dicts --action export -f bot.dicts.json # 假设已经创建了 .env 文件,并设定 BOT_CLIENT_ID 和 BOT_CLIENT_SECRET
bot faq --action export -f bot.faqs.json
bot intents --action export -f bot.intents.json
bot conversation --action export -f bot.conversations.c66
In this way, the backup of the robot's conversational skills is completed.
The file format is the same during import and export.
View the sample program directory.
Each example program is organized as follows.
根目录
├── README.md # 该项目的使用说明,必读
├── bot.dicts.json # 词典导入文件,包括引用词典、词汇表词典和正则表达式词典
├── bot.faqs.json # 知识库导入文件,包括标准问、扩展问、分类等
├── bot.intents.json # 意图识别导入文件,包含意图、说法、槽位等
├── bot.conversations.c66 # 多轮对话导入文件,包含脚本、函数等
├── conversations # 多轮对话文件解压后的内容,.c66 文件是 zip 压缩包
├── flow.mdj # UML 对话流程文件,描述对话流程,可能有
└── flow.xlsx # Excel 话术文件,描述对话流程,可能有
Learn about importing and exporting corpus and view the documentation
Set the following commands in the shell profile, such as ~/.zshrc
or ~/.bashrc
.
export CHATBOT_SAMPLES={{ROOT_PATH}}
# export bot files into current work dir
alias botexport="$CHATBOT_SAMPLES/bin/export.sh"
# import bot files under current work dir
alias botimport="$CHATBOT_SAMPLES/bin/import.sh"
# package conversations folder as bot.conversations.c66
alias botconpac="$CHATBOT_SAMPLES/bin/conversation.package.sh"
Now, use the commands botimport
and botexport
to complete the operations of importing and exporting BOT, such as:
cd projects/GitHub工单机器人
botimport # 导入语料到聊天机器人
botexport # 导出聊天机器人到语料
Apache 2.0