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

@mindverse/accessor-open

v1.7.8

Published

mindverse accessor

Downloads

29

Readme

一、API 接口

  • 使用
npm i --save @mindverse/accessor-open
// 创建管理类
let manager = new SocketSessionManager({
  config: {
    baseURL: "https://mindos-test.us.mindverse.ai/gate",
    requestHeader: {
      platform: "web",
      appId: "os-internal",
      bizType: "mindos",
      merchantId: "c1e3x",
      "M-AuthType": "STATION_KEY",
    },
    refUserId: "216",
    APIVersion: "1.3.0",

    socketURLConfig: {
      socketPath: "/chat/rest/general/ws/create",
      socketCheckPath: "/chat/rest/general/ws/get",
    },
    sessionURLConfig: {
      openPath: "/chat/rest/general/session/create",
      closePath: "/chat/rest/general/session/close",
      checkPath: "/chat/rest/general/session/get",
    },
    sessionConnectConfig: {
      deviceId: "deviceId",
    },
  },
  showDebug: false,
});

// 开启会话
manager
  .createSession({
    mindId: "118803239461326848",
    mindType: WS_MIND_TYPE.shadow,
    mode: "NORMAL",
    callback: {
      onMsgUpdateListener: (msgList) => {
        console.log("onMsgUpdateListener: ", msgList);
        const content = document.getElementById("#sessionContent");
        content.textContent = msgList;
      },
      onHintUpdate: (msg) => {
        console.log("onHintUpdate: ", msg);
      },
      onErrorListener: (subCode) => {
        console.log("onErrorListener: ", subCode);
      },
    },
  })
  .then((res) => {
    sessionId = res.sessionId;
    document.getElementById("#sessionId").innerText = sessionId;
    console.log(res);
  });

二、内部设计

详见接口参数定义

三、接口参数定义

requestHeader 为后端接口定义,用于参数校验。

MindOS 内部统一使用

{
    "M-AuthType": "API_KEY", // 枚举类型:API_KEY,STATION_KEY。其中 API_KEY 会校验 merchantId 和 bizType 以及 appId。 API_KEY 不会做任何校验。现阶段 STATION_KEY 有 bug,需要后端 fix,修复完之后 下掉 STATION_KEY
    "platform": "web",  // 貌似就这一个
    "appId": "os-长度", // 用户在 Public 的时候,创建的 AppId,因为现在没有默认创建这个,所以可能有 bug
    "merchantId": "c1e3x",  // 商户 Id chat 服务会返回。
    "bizType": "mindos" // Mindos 内部使用 mindos,其他业务使用自己的 saas 比如说商务合作。
}

四、request

  • 每次新增函数均需要增加备注,减少后续人维护的理解成本。
  • console 不能在 SDK 当中出现,所有都通过回调函数的形式返回。
  • 所有 log 需要增加前缀的业务标识,例如 [session], [socket] 方便过滤