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 🙏

© 2026 – Pkg Stats / Ryan Hefner

spark-desk

v2.0.1

Published

使用WebSocket调用 讯飞星火认知大模型 的js库

Downloads

33

Readme

spark-desk

这是一个使用HTTP/WebSocket调用 讯飞星火认知大模型 的js库。

  1. 使用 typescript
  2. 支持 cjs 和 esm
  3. 面向对象
  4. 支持所有版本接口
  5. 支持在浏览器、nodejs里运行
  6. 支持 Http 和 Websocket 方式使用

简单尝试

前往 在线样例

在您的项目里使用

使用 Websocket

import {Version, WebsocketSparkDesk} from 'spark-desk'

const sparkDesk = new WebsocketSparkDesk({
    APPID: "a5fxxxxxx",
    APISecret: "MGIxNTcwNDI4MGY1YjUxM2Mxxxxxxx",
    APIKey: "aa5fbf57f7818bd1cec61dexxxxxxxx",
    version: Version.Ultra
});

const user = sparkDesk.createUser("张三");

user.speak("你好!很高兴认识你。").then(answer => console.log(answer.content))

使用 HTTP

import {Version, HttpSparkDesk} from 'spark-desk'

const sparkDesk = new HttpSparkDesk({
    APIPassword: "qNuVTubjjhxxxxxxx:lPktJLLhrxxxxxxxx",
    version: Version.Ultra
});

const user = sparkDesk.createUser("张三");

user.speak("你好!很高兴认识你。").then(answer => console.log(answer.content))

更多参数

import {WebsocketSparkDesk} from "./WebsocketSparkDesk";
import {HttpSparkDesk} from "./HttpSparkDesk";

const websocketSparkDesk = new WebsocketSparkDesk(/*配置*/);

websocketSparkDesk.request({
    // websocket 参数 
    // https://www.xfyun.cn/doc/spark/Web.html#_1-%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E
}) // 返回 WebsocketResponseImpl 对象

const httpSparkDesk = new HttpSparkDesk(/*配置*/);

httpSparkDesk.request({
    // http 参数
    // https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html#_3-%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E
}) // 返回 AxiosResponse

底层实现

| 环境 | HTTP模式 | websocket模式 | |---------|--------|-------------| | node | axios | ws库 | | browser | axios | 原生Websocket |

本项目开发环境

| 名称 | 版本 | |----------|-----------------| | nodejs | v18.19.1 | | npm | 10.2.4 | | OS | Windows 11 专业版 | | webstorm | WebStorm 2023.2 |