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

diygw-chat-stream

v0.0.3

Published

由[https://www.diygw.com](https://www.diygw.com)维护

Readme

DIYGW Chat Stream

https://www.diygw.com维护

一个基于Vue 3的AI对话流式响应组件,支持多种大模型提供商(OpenAI、DeepSeek等),具有自定义机器人图标、Markdown渲染等功能。

特性

  • 支持多种大模型提供商
  • 流式响应显示
  • Markdown格式渲染
  • 代码高亮显示
  • 自定义机器人图标
  • 响应式设计

安装

npm install diygw-chat-stream
# 或
pnpm add diygw-chat-stream
# 或
 yarn add diygw-chat-stream

使用

注意:

  1. 在大多数Vue项目中,由于package.json中配置了"style"字段,样式文件会被自动导入,无需额外引入。
  2. 如果使用Vite等现代构建工具,可能需要确保CSS文件在package.json的exports字段中有正确配置。

如需手动引入样式,有两种方式:

方式一:在JavaScript/TypeScript中引入

<template>
  <div class="chat-container">
    <ChatWindow
      :provider="'openai'"
      :apiKey="apiKey"
      :model="'gpt-3.5-turbo'"
      :instruction="systemPrompt"
      :welcomeText="'欢迎使用AI助手'"
      :robotIcon="'https://example.com/robot.png'"
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { ChatWindow } from 'diygw-chat-stream';
// 引入样式文件
import 'diygw-chat-stream/dist/diygw-chat-stream.css';

const apiKey = ref('your-api-key');
const systemPrompt = ref('你是一个有用的AI助手');
</script>

方式二:在HTML中直接引入

<!-- 在HTML文件的head标签中添加 -->
<link rel="stylesheet" href="/node_modules/diygw-chat-stream/dist/diygw-chat-stream.css">

<!-- 然后在Vue组件中使用 -->
<template>
  <div class="chat-container">
    <ChatWindow
      :provider="'openai'"
      :apiKey="apiKey"
      :model="'gpt-3.5-turbo'"
      :instruction="systemPrompt"
      :welcomeText="'欢迎使用AI助手'"
      :robotIcon="'https://example.com/robot.png'"
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { ChatWindow } from 'diygw-chat-stream';

const apiKey = ref('your-api-key');
const systemPrompt = ref('你是一个有用的AI助手');
</script>

配置参数

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | ----------- | ------ | ---- | ---------------------- | ------------------------- | | provider | string | 是 | openai | 大模型提供商 | | apiKey | string | 是 | - | API密钥 | | model | string | 是 | gpt-3.5-turbo | 模型名称 | | instruction | string | 否 | - | 系统提示词 | | welcomeText | string | 否 | '欢迎使用 AI 流式对话' | 欢迎信息 | | robotIcon | string | 否 | - | 机器人图标URL或Base64编码 | | baseURL | string | 否 | - | API基础URL |

支持的提供商

  • OpenAI
  • DeepSeek

License

MIT