Current collected state Current
Observed since 20 Oct, 22:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xbot/chat-react
A React component for building chat interfaces with streaming support
A React component for building chat interfaces with streaming support.
npm install @0xbot/chat-react
# or
yarn add @0xbot/chat-react
# or
pnpm add @0xbot/chat-react
import React from 'react'
import { ChatLibrary } from '@0xbot/chat-react'
import '@0xbot/chat-react/dist/index.css' // Import the CSS
const App = () => {
return (
<ChatLibrary
apiKey="your-api-key" // required
serverUrl="your-server-url" // not required
UserAvatar={<YourUserAvatar />} // required
AgentAvatar={<YourAgentAvatar />} // required
loadingText="AI is thinking..." // not required
emptyText="No messages yet" // not required
tradeApiKey="xxxx-xxxx-xx"
/>
)
}
export default App
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| apiKey | string | Yes | - | Your API key for authentication |
| serverUrl | string | Yes | - | The server URL for API requests |
| UserAvatar | ReactNode | Yes | - | The avatar component for user messages |
| AgentAvatar | ReactNode | Yes | - | The avatar component for agent messages |
| loadingText | string | No | 'AI is thinking...' | Text to display while loading |
| emptyText | string | No | 'No messages yet' | Text to display when there are no messages |
| theme | object | No | {} | Theme configuration object |
| tradeApiKey | string | No | '' | trade api key |
This library requires the following peer dependencies:
You can customize the appearance of the chat component by overriding the following CSS classes:
/* Main container */
.chat-library {
box-sizing: border-box;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 16px;
}
/* Bottom bar */
.chat-bar {
display: flex;
align-items: center;
gap: 16px;
}
/* Input field */
.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;
}
/* Send button */
.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;
}
/* Send button hover */
.chat-bar-send:hover {
background-color: var(--primary-color);
color: white !important;
}
/* Chat container (excluding bottom bar) */
.chat-container {
flex: 1;
overflow-y: scroll;
scrollbar-width: none;
-ms-overflow-style: none;
}
/* Hide scrollbar */
.chat-container::-webkit-scrollbar {
display: none;
}
/* Chat message list */
.chat-container-list {
display: flex;
flex-direction: column;
gap: 16px;
}
/* Message bubble */
.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;
}
}
/* Avatar */
.chat-avatar {
width: 44px;
height: 44px;
max-width:44px;
max-height:44px;
min-width: 44px;
min-height: 44px;
border-radius: 8px;
}
/* Message bubble background */
.chat-message {
background-color: rgba(255, 255, 255, 0.1)
}
/* Message container */
.message-container {
display: flex;
}
/* Delete button */
.chat-bar-trash {
width: 24px;
height: 24px;
min-width: 24px;
min-height: 24px;
color: #fff;
cursor: pointer;
}
/* Loading state */
.message-loading {
color: #fff;
font-style: italic;
}
/* Empty message state */
.message-empty {
color: #fff;
font-style: italic;
text-align: center;
}
/* Trade modal */
.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;
}
You can override these styles by adding your own CSS rules after importing the library's CSS. For example:
/* Import the library's CSS first */
@import '@0xbot/chat-react/dist/index.css';
/* Then add your custom styles */
.chat-bar-input {
border-color: #ff0000;
background-color: #f0f0f0;
color: #333;
}
.chat-bar-send {
background-color: #4CAF50;
color: white;
border: none;
}
MIT
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
axiosEnvironment{
"local_name": "axios",
"alias": false,
"peer_metadata": null
} | ^1.6.7 | runtime |
localforageEnvironment{
"local_name": "localforage",
"alias": false,
"peer_metadata": null
} | ^1.10.0 | runtime |
markdown-itEnvironment{
"local_name": "markdown-it",
"alias": false,
"peer_metadata": null
} | ^14.0.0 | runtime |
highlight.jsEnvironment{
"local_name": "highlight.js",
"alias": false,
"peer_metadata": null
} | ^11.9.0 | runtime |
@unocss/resetEnvironment{
"local_name": "@unocss/reset",
"alias": false,
"peer_metadata": null
} | ^0.63.3 | runtime |
@dodoex/widgetsEnvironment{
"local_name": "@dodoex/widgets",
"alias": false,
"peer_metadata": null
} | ^3.1.3 | runtime |
@fingerprintjs/fingerprintjsEnvironment{
"local_name": "@fingerprintjs/fingerprintjs",
"alias": false,
"peer_metadata": null
} | ^4.2.1 | runtime |
viteEnvironment{
"local_name": "vite",
"alias": false,
"peer_metadata": null
} | ^5.0.0 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.0.0 | development |
@types/reactEnvironment{
"local_name": "@types/react",
"alias": false,
"peer_metadata": null
} | ^18.2.0 | development |
vite-plugin-dtsEnvironment{
"local_name": "vite-plugin-dts",
"alias": false,
"peer_metadata": null
} | ^3.7.0 | development |
@types/react-domEnvironment{
"local_name": "@types/react-dom",
"alias": false,
"peer_metadata": null
} | ^18.2.0 | development |
@types/markdown-itEnvironment{
"local_name": "@types/markdown-it",
"alias": false,
"peer_metadata": null
} | ^14.1.2 | development |
@vitejs/plugin-reactEnvironment{
"local_name": "@vitejs/plugin-react",
"alias": false,
"peer_metadata": null
} | ^4.2.0 | development |
reactEnvironment{
"local_name": "react",
"alias": false,
"peer_metadata": null
} | ^18.0.0 | peer |
react-domEnvironment{
"local_name": "react-dom",
"alias": false,
"peer_metadata": null
} | ^18.0.0 | peer |
Source distribution
{
"shasum": "88617fa5b107372da58202366cca75ec175d350c",
"tarball": "https://registry.npmjs.org/@0xbot/chat-react/-/chat-react-1.0.15.tgz",
"fileCount": 192,
"integrity": "sha512-n7m5l2/7hYewwvxCZZopZNqbtJVcfjbZnpf0h+1tRdGYp9XbMIIG2iDT/3LQsYxNyNrdB5L5uUyNiPNLxUMq9Q==",
"signatures": [
{
"sig": "MEYCIQD/e22oStIeen0ev4PZsv/pbJinnwkQ5uEZeezU/1gBBQIhAMzHwnwEpH84ECX6DttObj7J9JxWV/AEdg18HzVKFsSw",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"unpackedSize": 12665002
}Observed since 20 Oct, 22:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:f68d434f72661b54bcc1ffcfdbbf3e0c9ea5aa6dd551f940da12dbd3b6a0adb7