Catalog npm
Back to packageRELEASE DETAILS

1.0.11

npm

@0xbot/chat

0xBot Studio agent chat library

0xbot0xbot-chat0xbot-studio0xbot-studio-chat0xbot-studio-chat-librarychatcomponenttypescriptvuevue3
Published10 Jul 2025
Direct dependencies13
Transitive dependenciesNot calculated

README

Current package documentation

0xBot 聊天组件库

一个支持 API 密钥的 Vue 3 聊天组件库。

安装

npm install @0xbot/chat

使用方法

全局安装

import { createApp } from 'vue'
import ChatLibrary from '@0xbot/chat'
import "@0xbot/chat/dist/style.css"
import Avatar from "your-avatar-address"
const app = createApp(App)

app.use(ChatLibrary, {
  apiKey: 'your-api-key-here', // 必填
  serverUrl: 'http://localhost:3000', // 选填
  AgentAvatar: 'https://example.com/agent-avatar.png', // 必填,可以是本地图片
  UserAvatar: Avatar, // 必填
  loadingText: 'AI is thinking...', // 选填,自定义加载文本
  emptyText: 'No messages yet', // 选填,自定义空消息文本
  tradeApiKey: "xxxx-xxxx-xx"
})

app.mount('#app')

配置选项

选项类型是否必填默认值描述
apiKeystring是-聊天服务的 API 密钥
AgentAvatarstring是nullAI 助手的头像
UserAvatarstring是null用户的头像
serverUrlstring否-聊天服务的服务器地址
loadingTextstring否'AI is thinking...'AI 处理时的自定义文本
emptyTextstring否'No messages yet'空消息时的自定义文本
tradeApiKeystringNo''交易的apikey

功能特性

  • 实时 AI 聊天
  • 支持 Markdown 消息
  • 可自定义加载状态
  • 空消息状态处理
  • 响应式设计
  • 可自定义主题
  • 消息历史管理

样式

/* 主容器 */
.chat-library {
  box-sizing: border-box;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

/* 底部栏 */
.chat-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 输入框 */
.chat-bar-input {
  flex: 1;
  height: 44px;
  outline: none;
  border-radius: 99999px;
  border: 1px solid #ccc;
  background-color: transparent;
  color: #fff;
  padding: 0 16px;
  min-width: 0;
}

/* 发送按钮 */
.chat-bar-send {
  flex: none;
  width: auto;
  border: 1px solid;
  height: 48px;
  padding: 0 32px;
  border-radius: 99999px;
  cursor: pointer;
  background-color: transparent;
  transition: all 0.2s ease-in-out;
}

/* 发送按钮悬停效果 */
.chat-bar-send:hover {
  background-color: var(--primary-color);
  color: white !important;
}

/* 聊天容器(不包含底部栏) */
.chat-container {
  flex: 1;
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 隐藏滚动条 */
.chat-container::-webkit-scrollbar {
  display: none;
}

/* 聊天消息列表 */
.chat-container-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 消息气泡 */
.message-bubble {
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 90%;
  font-size: 14px;
  word-break: break-all;
  line-height: 24px;
}

@media (min-width: 768px) {
  .message-bubble {
    max-width: 70%;
    font-size: 13px;
  }
}

/* 头像 */
.chat-avatar {
  width: 44px;
  height: 44px;
  max-width:44px;
  max-height:44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
}

/* 消息气泡背景 */
.chat-message {
  background-color: rgba(255, 255, 255, 0.1)
}

/* 消息容器 */
.message-container {
  display: flex;
}

/* 删除按钮 */
.chat-bar-trash {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  color: #fff;
  cursor: pointer;
}

/* 加载状态 */
.message-loading {
  color: #fff;
  font-style: italic;
}

/* 空消息状态 */
.message-empty {
  color: #fff;
  font-style: italic;
  text-align: center;
}

/* 交易弹窗 */
.dodo-swap {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

许可证

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 14

Native requirements
13 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@dodoex/widgets
Environment
{
  "local_name": "@dodoex/widgets",
  "alias": false,
  "peer_metadata": null
}
^3.1.6runtime
@fingerprintjs/fingerprintjs
Environment
{
  "local_name": "@fingerprintjs/fingerprintjs",
  "alias": false,
  "peer_metadata": null
}
3runtime
@types/markdown-it
Environment
{
  "local_name": "@types/markdown-it",
  "alias": false,
  "peer_metadata": null
}
^14.1.2runtime
@unocss/reset
Environment
{
  "local_name": "@unocss/reset",
  "alias": false,
  "peer_metadata": null
}
0.63.3runtime
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^1.8.4runtime
highlight.js
Environment
{
  "local_name": "highlight.js",
  "alias": false,
  "peer_metadata": null
}
^11.11.1runtime
localforage
Environment
{
  "local_name": "localforage",
  "alias": false,
  "peer_metadata": null
}
^1.10.0runtime
markdown-it
Environment
{
  "local_name": "markdown-it",
  "alias": false,
  "peer_metadata": null
}
^14.1.0runtime
@vitejs/plugin-vue
Environment
{
  "local_name": "@vitejs/plugin-vue",
  "alias": false,
  "peer_metadata": null
}
^4.0.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^4.9.3development
vite
Environment
{
  "local_name": "vite",
  "alias": false,
  "peer_metadata": null
}
^4.0.0development
vue
Environment
{
  "local_name": "vue",
  "alias": false,
  "peer_metadata": null
}
^3.2.45development
vue-tsc
Environment
{
  "local_name": "vue-tsc",
  "alias": false,
  "peer_metadata": null
}
^1.0.11development
vue
Environment
{
  "local_name": "vue",
  "alias": false,
  "peer_metadata": null
}
^3.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-qIOD62jIs3QYN7ds6wGEUjfD6HRM6QJOKyIXFrBocN6SSCtuTcw1hK1ZBdW8JKCj4BKHVMbcY2UcCOmBbHgTaw==",
  "shasum": "bce44cb09961c4a9a04b204b4ec97aa08acd34b8",
  "tarball": "https://registry.npmjs.org/@0xbot/chat/-/chat-1.0.11.tgz",
  "fileCount": 179,
  "unpackedSize": 16880905,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEQCIGjqh1vh6qEoWJCEsgn3KATuTyBeMrscSrNWXbLQqErbAiAV0WQ53xxRmoYYVOrA6DQsxIE5jzXDyTyhIEeyyOWV6g=="
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:43 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ee467d5483fb1e67b36ff2b707df8a95ec4c8d378188ad8b57ffeddd1d250731

Other collected versions

1.0.103 Jul1.0.819 Apr1.0.718 Apr1.0.618 AprView all collected versions →