npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chatopera/node-alchemist

v1.0.6

Published

Node.js SDK for alchemist

Downloads

10

Readme

Chatopera Alchemist SDK for Node.js

Chatopera Front Desk Service / Chatopera 前台服务

Welcome

npm install @chatopera/node-alchemist

Usage

var Alchemist = require("@chatopera/node-alchemist");
const client = new Alchemist(YOUR_SERVER_IP, YOUR_SERVER_PORT);
await client.connect(); // 建立连接

| key | value | | ------------------ | ------------------------------------- | | YOUR_SERVER_IP | alchemist 服务 IP,比如 "localhost" | | YOUR_SERVER_PORT | alchemist 服务端口,比如 9000 |

chat

对话接口

resp = await client.chat({
    message: {
      channel: "node",
      channel_id: "sdk",
      user_id: "test002",
      type: "textMessage",
      payload: "老婆聊天轻浮"
    }
  })
  • request

| key | value | | ---------- | -------------------------------------------------------- | | channel | 渠道,比如 "gzh" 代表微信公众号 | | channel_id | 渠道 ID,比如 "gzh_xxx",对应渠道的标识 | | user_id | 用户唯一标识 | | type | textMessage 代表文本消息,imageMessage图片消息, etc. | | payload | 传递消息内容,字符串 |

  • response[Promise]
{
  "rc": 0,
  "message": {
    "channel": "node",
    "channel_id": "sdk",
    "user_id": "test002",
    "createdate": "1585195702.748119",
    "type": "textMessage",
    "payload": "你和老婆的感情怎样呢?",
    "is_question": true,
    "is_knowledge": false,
    "is_fallback": false
  },
  "error": null
}

返回值为 json 格式,其中rc为 0 代表正常返回;rc不为 0 为异常返回,异常原因见error。 正常返回下, message代表机器人回复。

| key | value | | ------------ | ------------------ | | channel | 请求的渠道 | | channel_id | 渠道标识 | | user_id | 用户标识 | | createdate | 消息创建 timestamp | | type | 返回的消息类型 | | payload | 消息内容 | | is_question | 是不是追问 | | is_knowledge | 有没有知识性 | | is_fallback | 是不是兜底 |

close

clientconnect成功后,建立与alchemist服务端的长连接,如果需要结束连接,释放资源,使用close接口。

client.close();

Copyright

Copyright 2020 Chatopera Inc. https://www.chatopera.com. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.