xiaozhi-client 1.6.3-beta.4 → 1.6.3
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/dist/WebServerStandalone.js +0 -0
- package/dist/mcpServerProxy.js +0 -0
- package/dist/package.json +1 -1
- package/package.json +30 -22
- package/web/README.md +169 -0
|
File without changes
|
package/dist/mcpServerProxy.js
CHANGED
|
File without changes
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xiaozhi-client",
|
|
3
|
-
"version": "1.6.3
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "小智 AI 客户端 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cli.js",
|
|
@@ -20,6 +20,28 @@
|
|
|
20
20
|
"xiaozhi": "./dist/cli.js",
|
|
21
21
|
"xiaozhi-client": "./dist/cli.js"
|
|
22
22
|
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "pnpm run build:web && tsup",
|
|
25
|
+
"build:web": "cd web && pnpm install && pnpm run build",
|
|
26
|
+
"dev": "tsup --watch",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"test:ui": "vitest --ui",
|
|
31
|
+
"format": "biome format --write .",
|
|
32
|
+
"lint": "biome lint --write .",
|
|
33
|
+
"type:check": "tsc --project tsconfig.typecheck.json",
|
|
34
|
+
"check": "biome check .",
|
|
35
|
+
"check:fix": "biome check --write --unsafe .",
|
|
36
|
+
"check:all": "pnpm check && pnpm type:check && pnpm spell:check && pnpm duplicate:check",
|
|
37
|
+
"spell:check": "cspell \"src/**/*.ts\" \"*.md\" \"*.json\"",
|
|
38
|
+
"duplicate:check": "jscpd src/",
|
|
39
|
+
"docker:update-version": "node scripts/update-dockerfile-version.js",
|
|
40
|
+
"release": "npx tsx scripts/release.ts",
|
|
41
|
+
"publish": "npm publish",
|
|
42
|
+
"publish:beta": "npx tsx scripts/publish-beta.ts",
|
|
43
|
+
"example": "node --loader ts-node/esm"
|
|
44
|
+
},
|
|
23
45
|
"keywords": [
|
|
24
46
|
"xiaozhi",
|
|
25
47
|
"mcp",
|
|
@@ -76,25 +98,11 @@
|
|
|
76
98
|
"typescript": "^5.8.3",
|
|
77
99
|
"vitest": "^3.2.3"
|
|
78
100
|
},
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"test:coverage": "vitest run --coverage",
|
|
86
|
-
"test:ui": "vitest --ui",
|
|
87
|
-
"format": "biome format --write .",
|
|
88
|
-
"lint": "biome lint --write .",
|
|
89
|
-
"type:check": "tsc --project tsconfig.typecheck.json",
|
|
90
|
-
"check": "biome check .",
|
|
91
|
-
"check:fix": "biome check --write --unsafe .",
|
|
92
|
-
"check:all": "pnpm check && pnpm type:check && pnpm spell:check && pnpm duplicate:check",
|
|
93
|
-
"spell:check": "cspell \"src/**/*.ts\" \"*.md\" \"*.json\"",
|
|
94
|
-
"duplicate:check": "jscpd src/",
|
|
95
|
-
"docker:update-version": "node scripts/update-dockerfile-version.js",
|
|
96
|
-
"release": "npx tsx scripts/release.ts",
|
|
97
|
-
"publish:beta": "npx tsx scripts/publish-beta.ts",
|
|
98
|
-
"example": "node --loader ts-node/esm"
|
|
101
|
+
"pnpm": {
|
|
102
|
+
"overrides": {
|
|
103
|
+
"form-data": "^4.0.4",
|
|
104
|
+
"braces": ">=3.0.3",
|
|
105
|
+
"micromatch": ">=4.0.8"
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
|
-
}
|
|
108
|
+
}
|
package/web/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# 小智客户端 Web UI
|
|
2
|
+
|
|
3
|
+
这是小智客户端的 Web 配置界面,提供了一个现代化、直观的界面来管理 MCP 服务配置。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 🎨 **现代化设计**:基于 shadcn/ui 组件库,提供优雅的用户界面
|
|
8
|
+
- 🔧 **可视化配置**:无需手动编辑 JSON 文件,通过界面即可完成所有配置
|
|
9
|
+
- 🚀 **实时状态监控**:实时显示与小智服务器的连接状态
|
|
10
|
+
- 📦 **MCP 服务管理**:支持添加、编辑、删除 MCP 服务,支持本地和 SSE 类型
|
|
11
|
+
- ⚙️ **灵活的配置选项**:可调整心跳间隔、超时时间等连接参数
|
|
12
|
+
- 🎯 **优秀的用户体验**:Toast 通知、确认对话框、平滑动画等
|
|
13
|
+
|
|
14
|
+
## 技术栈
|
|
15
|
+
|
|
16
|
+
- **框架**: React 18 + TypeScript
|
|
17
|
+
- **构建工具**: Vite
|
|
18
|
+
- **样式**: Tailwind CSS
|
|
19
|
+
- **UI 组件**: shadcn/ui
|
|
20
|
+
- **状态管理**: React Hooks
|
|
21
|
+
- **通知系统**: Sonner
|
|
22
|
+
- **图标**: Lucide React
|
|
23
|
+
- **代码质量**: Biome (代码格式化和 linting)
|
|
24
|
+
- **测试**: Vitest + React Testing Library
|
|
25
|
+
|
|
26
|
+
## 开发指南
|
|
27
|
+
|
|
28
|
+
### 安装依赖
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 开发命令
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 启动开发服务器
|
|
38
|
+
pnpm dev
|
|
39
|
+
|
|
40
|
+
# 构建生产版本
|
|
41
|
+
pnpm build
|
|
42
|
+
|
|
43
|
+
# 预览生产构建
|
|
44
|
+
pnpm preview
|
|
45
|
+
|
|
46
|
+
# 运行测试
|
|
47
|
+
pnpm test
|
|
48
|
+
|
|
49
|
+
# 运行测试(watch 模式)
|
|
50
|
+
pnpm test:watch
|
|
51
|
+
|
|
52
|
+
# 生成测试覆盖率报告
|
|
53
|
+
pnpm test:coverage
|
|
54
|
+
|
|
55
|
+
# 代码格式化
|
|
56
|
+
pnpm format
|
|
57
|
+
|
|
58
|
+
# 代码检查
|
|
59
|
+
pnpm lint
|
|
60
|
+
|
|
61
|
+
# 类型检查
|
|
62
|
+
pnpm type:check
|
|
63
|
+
|
|
64
|
+
# 运行所有检查并修复
|
|
65
|
+
pnpm check:write
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 项目结构
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
web/
|
|
72
|
+
├── src/
|
|
73
|
+
│ ├── components/
|
|
74
|
+
│ │ ├── ui/ # shadcn/ui 组件
|
|
75
|
+
│ │ ├── ConfigEditor.tsx # 配置编辑器
|
|
76
|
+
│ │ ├── MCPServerList.tsx # MCP 服务列表
|
|
77
|
+
│ │ └── StatusCard.tsx # 状态卡片
|
|
78
|
+
│ ├── hooks/ # 自定义 React Hooks
|
|
79
|
+
│ │ └── useWebSocket.ts # WebSocket 连接管理
|
|
80
|
+
│ ├── pages/ # 页面组件
|
|
81
|
+
│ │ └── Dashboard.tsx # 主控制台页面
|
|
82
|
+
│ ├── types/ # TypeScript 类型定义
|
|
83
|
+
│ ├── utils/ # 工具函数
|
|
84
|
+
│ ├── App.tsx # 应用主组件
|
|
85
|
+
│ ├── main.tsx # 应用入口
|
|
86
|
+
│ └── index.css # 全局样式
|
|
87
|
+
├── public/ # 静态资源
|
|
88
|
+
├── tests/ # 测试文件
|
|
89
|
+
└── package.json # 项目配置
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### UI 组件说明
|
|
93
|
+
|
|
94
|
+
#### StatusCard
|
|
95
|
+
显示与小智服务器的连接状态,包括:
|
|
96
|
+
- 连接状态指示器(连接中/已连接/已断开)
|
|
97
|
+
- 最后活动时间
|
|
98
|
+
- 重连按钮
|
|
99
|
+
|
|
100
|
+
#### ConfigEditor
|
|
101
|
+
配置编辑器,用于:
|
|
102
|
+
- 编辑 MCP 接入点 URL
|
|
103
|
+
- 调整连接参数(心跳间隔、超时时间等)
|
|
104
|
+
- 管理 ModelScope API Key
|
|
105
|
+
|
|
106
|
+
#### MCPServerList
|
|
107
|
+
MCP 服务管理界面,支持:
|
|
108
|
+
- 查看所有已配置的 MCP 服务
|
|
109
|
+
- 添加新服务(支持 JSON 批量导入)
|
|
110
|
+
- 编辑现有服务配置
|
|
111
|
+
- 删除服务(带确认对话框)
|
|
112
|
+
|
|
113
|
+
### 样式定制
|
|
114
|
+
|
|
115
|
+
项目使用 Tailwind CSS 和 CSS 变量进行样式管理。主题颜色定义在 `src/index.css` 中:
|
|
116
|
+
|
|
117
|
+
```css
|
|
118
|
+
:root {
|
|
119
|
+
--background: 0 0% 100%;
|
|
120
|
+
--foreground: 222.2 84% 4.9%;
|
|
121
|
+
--primary: 222.2 47.4% 11.2%;
|
|
122
|
+
--destructive: 0 84.2% 60.2%;
|
|
123
|
+
/* ... 其他颜色变量 */
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 添加新的 UI 组件
|
|
128
|
+
|
|
129
|
+
如果需要添加新的 shadcn/ui 组件:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# 查看可用组件
|
|
133
|
+
npx shadcn@latest add
|
|
134
|
+
|
|
135
|
+
# 添加特定组件(例如 dialog)
|
|
136
|
+
npx shadcn@latest add dialog
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 测试
|
|
140
|
+
|
|
141
|
+
项目使用 Vitest 进行单元测试:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# 运行所有测试
|
|
145
|
+
pnpm test
|
|
146
|
+
|
|
147
|
+
# 运行特定测试文件
|
|
148
|
+
pnpm test ConfigEditor
|
|
149
|
+
|
|
150
|
+
# 生成覆盖率报告
|
|
151
|
+
pnpm test:coverage
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 贡献指南
|
|
155
|
+
|
|
156
|
+
1. Fork 项目
|
|
157
|
+
2. 创建功能分支 (`git checkout -b feature/amazing-feature`)
|
|
158
|
+
3. 提交更改 (`git commit -m 'feat: 添加某个很棒的功能'`)
|
|
159
|
+
4. 推送到分支 (`git push origin feature/amazing-feature`)
|
|
160
|
+
5. 创建 Pull Request
|
|
161
|
+
|
|
162
|
+
提交前请确保:
|
|
163
|
+
- 所有测试通过 (`pnpm test`)
|
|
164
|
+
- 代码通过格式检查 (`pnpm check:write`)
|
|
165
|
+
- 类型检查通过 (`pnpm type:check`)
|
|
166
|
+
|
|
167
|
+
## 许可证
|
|
168
|
+
|
|
169
|
+
MIT License
|