@leeoohoo/aichat 1.0.0 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -16
- package/dist/index.cjs.js +56 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.d.ts +543 -62
- package/dist/index.esm.js +17171 -14413
- package/dist/index.esm.js.map +1 -1
- package/package.json +10 -75
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @leeoohoo/aichat
|
|
2
2
|
|
|
3
3
|
一个功能完整的React AI聊天组件,支持会话管理、MCP集成和SQLite持久化存储。
|
|
4
4
|
|
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
### 安装
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npm
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
|
|
21
|
+
# 使用 npm
|
|
22
|
+
npm install @leeoohoo/aichat
|
|
23
|
+
|
|
24
|
+
# 或使用 yarn
|
|
25
|
+
yarn add @leeoohoo/aichat
|
|
26
|
+
|
|
27
|
+
# 或使用 pnpm
|
|
28
|
+
pnpm add @leeoohoo/aichat
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
### 启动后端服务
|
|
@@ -31,10 +34,10 @@ pnpm add @ai-chat/react-component
|
|
|
31
34
|
|
|
32
35
|
```bash
|
|
33
36
|
# 方式一:使用npm脚本启动
|
|
34
|
-
npx @
|
|
37
|
+
npx @leeoohoo/aichat start:server
|
|
35
38
|
|
|
36
39
|
# 方式二:直接运行服务器文件
|
|
37
|
-
node node_modules/@
|
|
40
|
+
node node_modules/@leeoohoo/aichat/server/index.js
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
后端服务默认运行在 `http://localhost:3001`,提供以下API:
|
|
@@ -50,8 +53,8 @@ node node_modules/@ai-chat/react-component/server/index.js
|
|
|
50
53
|
|
|
51
54
|
```tsx
|
|
52
55
|
import React from 'react';
|
|
53
|
-
import StandaloneChatInterface from '@
|
|
54
|
-
import '@
|
|
56
|
+
import StandaloneChatInterface from '@leeoohoo/aichat';
|
|
57
|
+
import '@leeoohoo/aichat/styles';
|
|
55
58
|
|
|
56
59
|
function App() {
|
|
57
60
|
return (
|
|
@@ -70,7 +73,7 @@ export default App;
|
|
|
70
73
|
|
|
71
74
|
```tsx
|
|
72
75
|
import React from 'react';
|
|
73
|
-
import { ChatInterface, type Message, type Attachment } from '@
|
|
76
|
+
import { ChatInterface, type Message, type Attachment } from '@leeoohoo/aichat';
|
|
74
77
|
|
|
75
78
|
function App() {
|
|
76
79
|
const handleMessageSend = (content: string, attachments?: Attachment[]) => {
|
|
@@ -94,7 +97,7 @@ function App() {
|
|
|
94
97
|
|
|
95
98
|
```tsx
|
|
96
99
|
import React from 'react';
|
|
97
|
-
import { ChatInterface, type Message, type Attachment } from '@
|
|
100
|
+
import { ChatInterface, type Message, type Attachment } from '@leeoohoo/aichat';
|
|
98
101
|
|
|
99
102
|
function App() {
|
|
100
103
|
const customRenderer = {
|
|
@@ -147,7 +150,7 @@ function App() {
|
|
|
147
150
|
聊天状态管理Hook。
|
|
148
151
|
|
|
149
152
|
```tsx
|
|
150
|
-
import { useChatStore } from '@
|
|
153
|
+
import { useChatStore } from '@leeoohoo/aichat';
|
|
151
154
|
|
|
152
155
|
function MyComponent() {
|
|
153
156
|
const {
|
|
@@ -168,7 +171,7 @@ function MyComponent() {
|
|
|
168
171
|
主题管理Hook。
|
|
169
172
|
|
|
170
173
|
```tsx
|
|
171
|
-
import { useTheme } from '@
|
|
174
|
+
import { useTheme } from '@leeoohoo/aichat';
|
|
172
175
|
|
|
173
176
|
function MyComponent() {
|
|
174
177
|
const { theme, setTheme, actualTheme } = useTheme();
|
|
@@ -199,7 +202,7 @@ VITE_API_BASE_URL=http://localhost:3001
|
|
|
199
202
|
### 数据库初始化
|
|
200
203
|
|
|
201
204
|
```tsx
|
|
202
|
-
import { initDatabase } from '@
|
|
205
|
+
import { initDatabase } from '@leeoohoo/aichat';
|
|
203
206
|
|
|
204
207
|
// 在应用启动时初始化数据库
|
|
205
208
|
initDatabase().then(() => {
|
|
@@ -258,7 +261,7 @@ import type {
|
|
|
258
261
|
MessageListProps,
|
|
259
262
|
InputAreaProps,
|
|
260
263
|
SessionListProps,
|
|
261
|
-
} from '@
|
|
264
|
+
} from '@leeoohoo/aichat';
|
|
262
265
|
```
|
|
263
266
|
|
|
264
267
|
## 许可证
|