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

@coze/chat-sdk

v0.1.2-beta.1

Published

Coze chat components for taro

Downloads

61

Readme

Coze Chat Sdk

Official Chat SDK for Coze(or 扣子).(Taro and Web)

Quick Start

1. Installation

npm install @coze/chat-sdk
# or
pnpm install @coze/chat-sdk

2. Basic Usage For Taro

import { View } from "@tarojs/components";
import { ChatFramework, ChatSlot, ChatType, Language } from "@coze/chat-sdk";

export default function Index() {
  return (
    <View className="height-100">
      <ChatFramework
        chat={{
          appId: "7329529575539572743",
          type: ChatType.Bot,
        }}
        setting={{
          apiBaseUrl: "https://api.coze.cn",
          language: Language.EN,
          requestHeader: {},
          logLevel: "debug",
        }}
        auth={{
          token: "##############",
          onRefreshToken: (oldToken) => {
            return "##############";
          },
        }}
        user={{
          id: "UserId123",
          name: "Mr.XXX",
          avatar:
            "https://sf16-passport-sg.ibytedtos.com/obj/user-avatar-alisg/e0622b06d99df6ead022ca4533ca631f.png",
        }}
      >
        <ChatSlot className={"chat-slot"} />
      </ChatFramework>
    </View>
  );
}

2. Basic Usage For Web

import "@coze/chat-sdk/webCss";
import ChatSdk from "@coze/chat-sdk/webJs";
const { ChatFramework, ChatSlot, ChatType, Language } = ChatSdk;

export default function Index() {
  return (
    <div className="height-100">
      <ChatFramework
        chat={{
          appId: "7329529575539572743",
          type: ChatType.Bot,
        }}
        setting={{
          apiBaseUrl: "https://api.coze.cn",
          language: Language.EN,
          requestHeader: {},
          logLevel: "debug",
        }}
        auth={{
          token: "##############",
          onRefreshToken: (oldToken) => {
            return "##############";
          },
        }}
        user={{
          id: "UserId123",
          name: "Mr.XXX",
          avatar:
            "https://sf16-passport-sg.ibytedtos.com/obj/user-avatar-alisg/e0622b06d99df6ead022ca4533ca631f.png",
        }}
      >
        <ChatSlot className={"chat-slot"} />
      </ChatFramework>
    </div>
  );
}

3. Parameters Description

  • chat

    • appId - The app id of the bot or the conversation.
    • type - The type of the chat.
  • setting

    • apiBaseUrl - The base url of the api.
    • language - The language of the chat.
    • requestHeader - The request header of the api.
    • logLevel - The log level of the chat.
  • auth

    • token - The token of the user.
    • onRefreshToken - The callback function to refresh the token.
  • user

    • id - The id of the user.
    • name - The name of the user.
    • avatar - The avatar of the user.
  • ui

    • isMiniCustomHeader - Whether to use the mini custom header. It's just for mini program.

    • isReadonly - Whether to use the readonly mode.

    • header - The config of the header

      • isNeed - Whether to show the header, default is true
      • icon - The icon of the header
      • title - The title of the header
    • footer - The config of the footer

      • isNeed - Whether to show the footer, default is true
      • expressionText - The text of the expression
      • linkvars - The link vars for the expression
    • chatSlot - The config of the chat slot

      • input - The config of the input
        • isNeed - Whether to show the input, default is true
        • placeholder - The placeholder of the input
        • isNeedSendButton - Whether to show the send button, default is true
    • clearContext - The config of the clear context

      • isNeed - Whether to show the clear context, default is true
      • position - The position of the clear context, default is InputLeft.
    • clearMessage - The config of the clear message

      • isNeed - Whether to show the clear message, default is true
      • position - The position of the clear message, default is headerRight.
    • uploadBtn - The config of the upload button

      • isNeed - Whether to show the upload button, default is true