
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@chatopera/node-alchemist
Advanced tools
Chatopera Front Desk Service / Chatopera 前台服务
npm install @chatopera/node-alchemist
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 |
对话接口
resp = await client.chat({
message: {
channel: "node",
channel_id: "sdk",
user_id: "test002",
type: "textMessage",
payload: "老婆聊天轻浮"
}
})
key | value |
---|---|
channel | 渠道,比如 "gzh" 代表微信公众号 |
channel_id | 渠道 ID,比如 "gzh_xxx",对应渠道的标识 |
user_id | 用户唯一标识 |
type | textMessage 代表文本消息,imageMessage 图片消息, etc. |
payload | 传递消息内容,字符串 |
{
"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 | 是不是兜底 |
该client
在connect
成功后,建立与alchemist
服务端的长连接,如果需要结束连接,释放资源,使用close
接口。
client.close();
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.
FAQs
Node.js SDK for alchemist
We found that @chatopera/node-alchemist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.