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

@laiye-ai/sdk-core

v1.1.3

Published

WuLai OpenAPI SDK

Downloads

20

Readme

@laiye-ai/sdk-core

NPM version build status codecov

安装

npm 安装

npm install @laiye-ai/sdk-core -S

yarn 安装

yarn add @laiye-ai/sdk-core -S

使用环境

Node.js >= 8.x

如何使用

"use strict";
const WuLaiClient = require("@laiye-ai/sdk-core");
// 初始化 client,pubkey 和 secret 必传
const client = new WuLaiClient({
  pubkey: "your pubkey",
  secret: "your secret"
});

client
  .getBotResponse({
    msg_body: {
      text: {
        content: "谢谢"
      }
    },
    user_id: "created user_id",
    extra: "extra info"
  })
  .then(res => {
    console.log(res);
  });

SDK初始化配置

new WulaiClient([, options])

new WulaiClient({
    pubkey: "string", // 机器人 pubkey,required
    secret: "string", // 机器人 secret,required
    endpoint: "string", // base url,optional
    apiVersion: "v2", // 版本,optional
    debug: "boolean", // 是否开启调试模式,开启后 sdk 将对所有请求进行日志输出,默认为 stdout 输出模式
    options: { // optional
        timeout: 6000, // 超时时间,单位ms,默认 6000ms,optional
        agent: "<Http Agent>", // http or https 连接池,optional
        compression: "boolean", // 服务端返回数据是否压缩,optional
        maxRetry: "number", // 网络请求异常,重试次数,默认 3 次,设置 1 为取消,optional
        headers: "object" // 请求头,optional
    }
});

常见场景及调用示例

一、基础对话

二、个性化对话

三、异步基础对话

四、异步定制对话

SDK 相关说明文档

SDK-CommonRequest

SDK-日志配置

SDK-设置请求超时时间

SDK-已实现API

SDK-待实现API

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.