Coder Social home page Coder Social logo

chatopera / chatbot-samples Goto Github PK

View Code? Open in Web Editor NEW
122.0 7.0 41.0 3.69 MB

🤖 聊天机器人,对话模板

Home Page: https://bot.chatopera.com/

License: Other

Shell 13.69% MAXScript 21.19% JavaScript 65.12%
chatbot natural-language-processing natural-language-understanding natural-language-generation personal-assistant

chatbot-samples's Introduction

Chatopera 对话模板

本源码库提供多个 对话模板 项目,基于这些项目,您可以:

  • 快速掌握 Chatopera 对话机器人开发,实现智能问答,智能客服等应用; 以对话模板为脚手架,学习最佳实践,开发多轮对话;

  • 快速掌握 Chatopera 机器人的系统集成。

开始阅读前,请完成

确保您已经完成新手任务!!!很简单的,40 分钟内,即可按照提示,一步步完成,以节省您的时间!少走弯路!

新手任务:使用入门教程一步步实现智能对话机器人

使用 CLI 导入

安装并配置 Chatopera CLI -

https://docs.chatopera.com/products/chatbot-platform/howto-guides/cli-export-import.html

TL; DR

首先,安装 Nodejs 和 Git for Windows(默认带有 Git Bash 环境)。

然后,执行:

npm install -g @chatopera/sdk

接着, 在 shell profile 中设置如下命令, 比如 ~/.zshrc or ~/.bashrc

export CHATBOT_SAMPLES=YOUR_CLONED_PLACE
# 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"

CHATBOT_SAMPLES 是项目 https://github.com/chatopera/chatbot-samples 存放的路径, 比如 /c/Users/Administrator/chatopera/chatbot-samples

现在,使用命令 botimportbotexport 完成导入 BOT 和导出 BOT 的操作, 比如

cd projects/OSSChatBot
botimport

更多关于导入和导出的介绍 -

https://docs.chatopera.com/products/chatbot-platform/howto-guides/cli-export-import.html

模板目录

程序 语言 位置 功能
FeishuWeatherBot zh_CN projects/FeishuWeatherBot Chatopera 飞书应用示例程序,一个能回答天气情况的飞书机器人
GuessNumber en_US projects/GuessNumber 小游戏, Guess the secret number in the bot's hat.
预定机票 zh_CN projects/预定机票 预约飞机票,查询天气
招聘面试 zh_CN projects/招聘面试 进行工作面试:提问技能知识、评估性格和心理素质,发送邮件报告面试过程。
小笑话 zh_CN projects/小笑话 发送“笑话”,机器人返回一个笑话,逗您一乐。

查看所有模板

对话模板目录结构

模板根目录
├── README.md                  # 模板描述文件
├── bot.dicts.json             # 词典导入文件,包括引用词典、词汇表词典和正则表达式词典
├── bot.faqs.json              # 知识库导入文件,包括标准问、扩展问、分类等
├── bot.intents.json           # 意图识别导入文件,包含意图、说法、槽位等
├── bot.conversations.c66      # 多轮对话导入文件,包含脚本、函数等
├── conversations              # 多轮对话文件解压后的内容,.c66 文件是 zip 压缩包
├── flow.mdj                   # UML 对话流程文件,描述对话流程
└── flow.xlsx                  # Excel 话术文件,描述对话流程

系统集成

https://docs.chatopera.com/products/chatbot-platform/howto-guides/index.html#发布机器人

技术支持

帮助

LICENSE

Apache 2.0

chatoper banner

chatbot-samples's People

Contributors

hailiang-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatbot-samples's Issues

是否支持上下问的情景,能否给个样例

如题,希望构建含有上下午的情景对话
问:杭州天津如何
答:多云
问:适合去什么地方游玩
答:公园或者乐园
问:公园可以去哪
答:可以去西湖转转
像是这种带有上下文语义的情景对话平台是否可以支持。可以做个例子示范下吗,谢谢。

和风天气返回

{
  "aqi": {
    "city": {
      "aqi": "162",
      "qlty": "中度污染",
      "pm25": "50",
      "pm10": "83",
      "no2": "17",
      "so2": "2",
      "co": "0.76",
      "o3": "231"
    }
  },
  "basic": {
    "city": "北京",
    "cnty": "\n**",
    "id": "CN101010100",
    "lat": "39.90498734",
    "lon": "116.4052887",
    "update": {
      "loc": "2018-07-04 18:51",
      "utc": "2018-07-04 10:51"
    }
  },
  "daily_forecast": [
    {
      "astro": {
        "mr\n": "23:27",
        "ms": "10:12",
        "sr": "04:51",
        "ss": "19:47"
      },
      "cond": {
        "code_d": "101",
        "code_n": "100",
        "txt_d": "多云",
        "txt_n": "晴"
      },
      "date": "2018-07-04",
      "hum": "55",
      "pcpn": "0.\n0",
      "pop": "6",
      "pres": "999",
      "tmp": {
        "max": "36",
        "min": "25"
      },
      "uv": "5",
      "vis": "10",
      "wind": {
        "deg": "181",
        "dir": "南风",
        "sc": "1-2",
        "spd": "2"
      }
    },
    {
      "astro": {
        "mr": "23:56",
        "ms\n": "11:11",
        "sr": "04:52",
        "ss": "19:47"
      },
      "cond": {
        "code_d": "101",
        "code_n": "302",
        "txt_d": "多云",
        "txt_n": "雷阵雨"
      },
      "date": "2018-07-05",
      "hum": "49",
      "pcpn": "0.0",
      "pop": "4",
      "pres": "1001",
      "tmp": {
        "max": "37",
        "min": "24"
      },
      "uv": "5",
      "vis": "20",
      "wind": {
        "deg": "92",
        "dir": "东风",
        "sc": "1-2",
        "spd": "11"
      }
    },
    {
      "astro": {
        "mr": "16:45",
        "ms": "12:12\n",
        "sr": "04:52",
        "ss": "19:47"
      },
      "cond": {
        "code_d": "302",
        "code_n": "302",
        "txt_d": "雷阵雨",
        "txt_n": "雷阵雨"
      },
      "date": "2018-07-06",
      "hum": "53",
      "pcpn": "0.0",
      "pop": "25",
      "\npres": "1008",
      "tmp": {
        "max": "33",
        "min": "23"
      },
      "uv": "5",
      "vis": "19",
      "wind": {
        "deg": "167",
        "dir": "东南风",
        "sc": "1-2",
        "spd": "5"
      }
    },
    {
      "astro": {
        "mr": "00:25",
        "ms": "13:14",
        "\nsr": "04:53",
        "ss": "19:46"
      },
      "cond": {
        "code_d": "302",
        "code_n": "302",
        "txt_d": "雷阵雨",
        "txt_n": "雷阵雨"
      },
      "date": "2018-07-07",
      "hum": "69",
      "pcpn": "0.0",
      "pop": "25",
      "pre\ns": "1009",
      "tmp": {
        "max": "31",
        "min": "21"
      },
      "uv": "4",
      "vis": "17",
      "wind": {
        "deg": "61",
        "dir": "东北风",
        "sc": "1-2",
        "spd": "7"
      }
    },
    {
      "astro": {
        "mr": "00:56",
        "ms": "14:19",
        "sr": "04:54",
        "ss": "19:46"
      },
      "cond": {
        "code_d": "302",
        "code_n": "302",
        "txt_d": "雷阵雨",
        "txt_n": "雷阵雨"
      },
      "date": "2018-07-08",
      "hum": "81",
      "pcpn": "0.0",
      "pop": "25",
      "pres": "\n1005",
      "tmp": {
        "max": "27",
        "min": "20"
      },
      "uv": "11",
      "vis": "15",
      "wind": {
        "deg": "76",
        "dir": "东北风",
        "sc": "1-2",
        "spd": "5"
      }
    },
    {
      "astro": {
        "mr": "01:30",
        "ms": "15:27",
        "sr": "04\n:54",
        "ss": "19:46"
      },
      "cond": {
        "code_d": "101",
        "code_n": "104",
        "txt_d": "多云",
        "txt_n": "阴"
      },
      "date": "2018-07-09",
      "hum": "84",
      "pcpn": "0.0",
      "pop": "1",
      "pres": "1009",
      "tmp\n": {
        "max": "29",
        "min": "21"
      },
      "uv": "7",
      "vis": "19",
      "wind": {
        "deg": "88",
        "dir": "东风",
        "sc": "1-2",
        "spd": "1"
      }
    },
    {
      "astro": {
        "mr": "02:09",
        "ms": "16:36",
        "sr": "04:55",
        "ss": "19\n:45"
      },
      "cond": {
        "code_d": "104",
        "code_n": "104",
        "txt_d": "阴",
        "txt_n": "阴"
      },
      "date": "2018-07-10",
      "hum": "72",
      "pcpn": "0.0",
      "pop": "25",
      "pres": "1011",
      "tmp": {
        "max": "30",
        "min": "22"
      },
      "uv": "6",
      "vis": "19",
      "wind": {
        "deg": "350",
        "dir": "北风",
        "sc": "1-2",
        "spd": "4"
      }
    }
  ],
  "hourly_forecast": [
    {
      "cond": {
        "code": "101",
        "txt": "多云"
      },
      "date": "2018-0\n7-04 22:00",
      "hum": "55",
      "pop": "0",
      "pres": "998",
      "tmp": "29",
      "wind": {
        "deg": "183",
        "dir": "南风",
        "sc": "1-2",
        "spd": "1"
      }
    },
    {
      "cond": {
        "code": "100",
        "txt": "晴"
      },
      "date": "201\n8-07-05 01:00",
      "hum": "60",
      "pop": "0",
      "pres": "999",
      "tmp": "27",
      "wind": {
        "deg": "86",
        "dir": "东风",
        "sc": "1-2",
        "spd": "5"
      }
    },
    {
      "cond": {
        "code": "100",
        "txt": "晴"
      },
      "date": "2\n018-07-05 04:00",
      "hum": "70",
      "pop": "0",
      "pres": "997",
      "tmp": "25",
      "wind": {
        "deg": "92",
        "dir": "东风",
        "sc": "1-2",
        "spd": "9"
      }
    },
    {
      "cond": {
        "code": "100",
        "txt": "晴"
      },
      "date": "2018-07-05 07:00",
      "hum": "66",
      "pop": "0",
      "pres": "998",
      "tmp": "27",
      "wind": {
        "deg": "84",
        "dir": "东风",
        "sc": "3-4",
        "spd": "16"
      }
    },
    {
      "cond": {
        "code": "100",
        "txt": "晴"
      },
      "dat\ne": "2018-07-05 10:00",
      "hum": "57",
      "pop": "0",
      "pres": "998",
      "tmp": "32",
      "wind": {
        "deg": "90",
        "dir": "东风",
        "sc": "1-2",
        "spd": "9"
      }
    },
    {
      "cond": {
        "code": "101",
        "txt": "多云"
      },
      "date": "2018-07-05 13:00",
      "hum": "46",
      "pop": "0",
      "pres": "997",
      "tmp": "35",
      "wind": {
        "deg": "105",
        "dir": "东南风",
        "sc": "1-2",
        "spd": "10"
      }
    },
    {
      "cond": {
        "code": "101",
        "txt": "多云"
      },
      "date": "2018-07-05 16:00",
      "hum": "43",
      "pop": "0",
      "pres": "995",
      "tmp": "36",
      "wind": {
        "deg": "89",
        "dir": "东风",
        "sc": "1-2",
        "spd": "5"
      }
    },
    {
      "cond": {
        "code": "101",
        "t\nxt": "多云"
      },
      "date": "2018-07-05 19:00",
      "hum": "41",
      "pop": "1",
      "pres": "996",
      "tmp": "34",
      "wind": {
        "deg": "87",
        "dir": "东风",
        "sc": "1-2",
        "spd": "5"
      }
    }
  ],
  "now": {
    "cond": {
      "cod\ne": "101",
      "txt": "多云"
    },
    "fl": "36",
    "hum": "43",
    "pcpn": "0.0",
    "pres": "995",
    "tmp": "34",
    "vis": "10",
    "wind": {
      "deg": "205",
      "dir": "西南风",
      "sc": "2",
      "spd": "7"
    }
  },
  "status": "\nok",
  "suggestion": {
    "air": {
      "brf": "较差",
      "txt": "气象条件较不利于空气污染物稀释、扩散和清除,请适当减少室外活动时间。"
    },
    "comf": {
      "brf": "很不舒适",
      "txt": "今天夜间天\n气晴好,但烈日炎炎您会感到很热,很不舒适。"
    },
    "cw": {
      "brf": "较适宜",
      "txt": "较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。"
    },
    "drsg": {
      "brf": "\n炎热",
      "txt": "天气炎热,建议着短衫、短裙、短裤、薄型T恤衫等清凉夏季服装。"
    },
    "flu": {
      "brf": "少发",
      "txt": "各项气象条件适宜,发生感冒机率较低。但请避免长期处于空调房间中,以防感冒。"
    },
    "sport": {
      "brf": "较不宜",
      "txt": "天气较好,无雨水困扰,但考虑气温很高,请注意适当减少运动时间并降低运动强度,运动后及时补充水分。"
    },
    "trav": {
      "brf": "较不宜",
      "txt": "天气较好,微风,但温度高,天气很热,请注意防暑降温,并注意防晒,若外出可选择水上娱乐等清凉项目。"
    },
    "uv": {
      "brf": "中等",
      "txt": "属中等强度\n紫外线辐射天气,外出时建议涂擦SPF高于15、PA+的防晒护肤品,戴帽子、太阳镜。"
    }
  }
}

话题中使用知识库路由消息

路由消息

faq 导入

[
  {
    "docId": "AXRZAH1f6FFxSwKKb3JN",
    "categories": [],
    "enabled": true,
    "post": "路由器有哪些种类",
    "replies": [
      {
        "rtype": "plain",
        "content": "routeDirectReply#[\"products\", \"$ctx.textMessage$\"]"
      }
    ],
    "similarQuestions": []
  },
  {
    "docId": "AXRW1PIA6FFxSwKKb3GZ",
    "categories": [],
    "enabled": true,
    "post": "有哪些产品",
    "replies": [
      {
        "rtype": "plain",
        "content": "routeDirectReply#[\"products\", \"__product_categories\",false]"
      }
    ],
    "similarQuestions": [
      "有哪些服务"
    ]
  }
]

脚本 话题 products

+ __product_categories
- 路由器,个人电脑,智能手机

+ (*) 路由器 (*) 种类 (*)
- A,B, C

使用定义的 gambit

image

使用访问消息作为 gambit

image

话题中使用函数举例: 设置用户画像

话题:ask_jiguan

脚本

+ __kickoff_ask_jiguan
- {@__ask_jiguan} ^listJiGuan()


    + (*)
    % {@__ask_jiguan} ^listJiGuan()
    - {CLEAR} ^saveUserJiGuan(<cap1>)

// Group Replies
+ __ask_jiguan
- 您来自于哪个地方?

函数

/**
 * Plugin
 */

exports.listJiGuan = async function() {
    return {
        text: "请从以下项目中选择",
        params: [{
                label: "北京",
                type: "button",
                text: "北京"
            },
            {
                label: "南京",
                type: "button",
                text: "南京"
            },
            {
                label: "其它",
                type: "button",
                text: "其它"
            }
        ]
    }

}


exports.saveUserJiGuan = async function(loc) {
    await this.maestro.profile(this.user.id, "jiguan", loc);
    return "收到";

}

image

优化项目结构和文档

描述

功能

环境

操作系统

  • macOS or Mac OSX
  • Windows
  • Linux(Debian, CentOS, Ubuntu, etc.)

代码版本

Git commit hash (git rev-parse HEAD)

OpenSource by Chatopera

chatoper banner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.