@lobehub/chat 1.96.2 → 1.96.4
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/.cursor/rules/debug-usage.mdc +84 -0
- package/.cursor/rules/desktop-controller-tests.mdc +188 -0
- package/.cursor/rules/desktop-feature-implementation.mdc +1 -1
- package/CHANGELOG.md +34 -0
- package/README.md +1 -1
- package/changelog/v1.json +10 -0
- package/package.json +6 -13
- package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +7 -7
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files/FileItem/File.tsx +2 -3
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/ChatItem/Thread.tsx +3 -3
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/TopicListContent/SearchResult/index.tsx +2 -2
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/TopicListContent/ThreadItem/Content.tsx +5 -5
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/TopicListContent/TopicItem/DefaultContent.tsx +3 -6
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/TopicListContent/TopicItem/TopicContent.tsx +4 -5
- package/src/app/[variants]/(main)/chat/@session/features/SessionSearchBar.tsx +11 -5
- package/src/app/[variants]/(main)/files/(content)/@menu/features/KnowledgeBase/Item/Content.tsx +4 -6
- package/src/app/[variants]/(main)/files/(content)/NotSupportClient.tsx +6 -5
- package/src/app/[variants]/(main)/files/[id]/Header.tsx +5 -5
- package/src/app/[variants]/(main)/repos/[id]/evals/dataset/DatasetDetail/index.tsx +3 -3
- package/src/app/[variants]/(main)/repos/[id]/evals/evaluation/EvaluationList/index.tsx +4 -3
- package/src/app/[variants]/(main)/repos/[id]/features/Menu/Head/index.tsx +4 -2
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/CustomModelOption.tsx +5 -5
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx +3 -4
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/Option.tsx +3 -4
- package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +5 -12
- package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/index.tsx +7 -8
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/List.tsx +5 -6
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/DisabledModels.tsx +3 -4
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/EnabledModelList/index.tsx +5 -6
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx +4 -6
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx +6 -6
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/SearchResult.tsx +3 -4
- package/src/app/[variants]/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +2 -3
- package/src/app/[variants]/(main)/settings/sync/features/DeviceInfo/index.tsx +3 -3
- package/src/app/[variants]/(main)/settings/sync/features/WebRTC/index.tsx +4 -4
- package/src/app/[variants]/oauth/consent/[uid]/ClientError.tsx +4 -6
- package/src/app/[variants]/oauth/consent/[uid]/Consent.tsx +7 -8
- package/src/app/[variants]/oauth/consent/[uid]/Login.tsx +4 -6
- package/src/app/[variants]/oauth/handoff/Client.tsx +6 -6
- package/src/components/InitProgress/index.tsx +3 -3
- package/src/components/Loading/CircleLoading/index.tsx +3 -4
- package/src/components/ModelSelect/index.tsx +3 -6
- package/src/components/StatisticCard/TitleWithPercentage.tsx +4 -7
- package/src/components/StatisticCard/index.tsx +6 -7
- package/src/config/modelProviders/index.ts +0 -1
- package/src/features/AgentSetting/AgentPlugin/index.tsx +4 -3
- package/src/features/ChatInput/Desktop/FilePreview/FileItem/index.tsx +3 -4
- package/src/features/ChatInput/components/UploadDetail/UploadStatus.tsx +10 -10
- package/src/features/ChatInput/components/UploadDetail/index.tsx +3 -3
- package/src/features/Conversation/Messages/Assistant/FileChunks/Item/index.tsx +2 -3
- package/src/features/Conversation/Messages/User/BelowMessage.tsx +3 -4
- package/src/features/Conversation/Messages/User/FileListViewer/Item.tsx +3 -3
- package/src/features/Conversation/components/History/index.tsx +2 -3
- package/src/features/DataImporter/ImportDetail.tsx +2 -4
- package/src/features/ElectronTitlebar/Connection/Waiting.tsx +3 -6
- package/src/features/FileManager/FileList/EmptyStatus.tsx +4 -4
- package/src/features/FileManager/FileList/index.tsx +3 -3
- package/src/features/FileManager/UploadDock/Item.tsx +11 -11
- package/src/features/FileManager/UploadDock/index.tsx +3 -4
- package/src/features/FileManager/index.tsx +3 -5
- package/src/features/InitClientDB/features/DatabaseRepair/Backup.tsx +3 -5
- package/src/features/InitClientDB/features/DatabaseRepair/Repair.tsx +2 -4
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/index.tsx +5 -7
- package/src/features/Portal/Artifacts/Header.tsx +4 -4
- package/src/features/Portal/FilePreview/Header.tsx +4 -4
- package/src/features/Portal/Home/Body/Files/FileList/Item.tsx +3 -3
- package/src/features/Portal/Home/Body/Files/FileList/index.tsx +2 -3
- package/src/features/Portal/Home/Body/Files/index.tsx +3 -3
- package/src/features/Portal/Home/Body/Plugins/ArtifactList/Item/index.tsx +3 -4
- package/src/features/Portal/Home/Body/Plugins/ArtifactList/index.tsx +3 -3
- package/src/features/Portal/Home/Body/Plugins/index.tsx +3 -3
- package/src/features/Portal/Home/Title.tsx +3 -3
- package/src/features/Portal/MessageDetail/Header.tsx +3 -3
- package/src/features/Portal/Plugins/Header.tsx +5 -6
- package/src/features/Portal/Thread/Header/Active.tsx +3 -4
- package/src/features/Portal/Thread/Header/New.tsx +4 -4
- package/src/features/SyncStatusInspector/EnableSync.tsx +5 -9
- package/src/tools/local-system/Render/ReadLocalFile/ReadFileView.tsx +5 -6
- package/src/tools/web-browsing/Portal/PageContent/index.tsx +4 -7
- package/src/tools/web-browsing/Portal/Search/ResultList/SearchItem/TitleExtra.tsx +3 -4
- package/src/tools/web-browsing/Portal/Search/ResultList/SearchItem/Video.tsx +4 -3
- package/src/tools/web-browsing/Portal/Search/ResultList/SearchItem/index.tsx +3 -3
- package/src/tools/web-browsing/Render/PageContent/Result.tsx +4 -6
- package/src/tools/web-browsing/Render/Search/SearchResult/SearchResultItem.tsx +3 -3
- package/src/tools/web-browsing/components/SearchBar.tsx +7 -7
@@ -0,0 +1,84 @@
|
|
1
|
+
---
|
2
|
+
description: 包含添加 debug 日志请求时
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Debug 包使用指南
|
7
|
+
|
8
|
+
本项目使用 [debug](mdc:https:/github.com/debug-js/debug) 包进行调试日志记录。使用此规则来确保团队成员统一调试日志格式。
|
9
|
+
|
10
|
+
## 基本用法
|
11
|
+
|
12
|
+
1. 导入 debug 包:
|
13
|
+
|
14
|
+
```typescript
|
15
|
+
import debug from 'debug';
|
16
|
+
```
|
17
|
+
|
18
|
+
2. 创建一个命名空间的日志记录器:
|
19
|
+
|
20
|
+
```typescript
|
21
|
+
// 格式: lobe:[模块]:[子模块]
|
22
|
+
const log = debug('lobe-[模块名]:[子模块名]');
|
23
|
+
```
|
24
|
+
|
25
|
+
3. 使用日志记录器:
|
26
|
+
|
27
|
+
```typescript
|
28
|
+
log('简单消息');
|
29
|
+
log('带变量的消息: %O', object);
|
30
|
+
log('格式化数字: %d', number);
|
31
|
+
```
|
32
|
+
|
33
|
+
## 命名空间约定
|
34
|
+
|
35
|
+
- 桌面应用相关: `lobe-desktop:[模块]`
|
36
|
+
- 服务端相关: `lobe-server:[模块]`
|
37
|
+
- 客户端相关: `lobe-client:[模块]`
|
38
|
+
- 路由相关: `lobe-[类型]-router:[模块]`
|
39
|
+
|
40
|
+
## 格式说明符
|
41
|
+
|
42
|
+
- `%O` - 对象展开(推荐用于复杂对象)
|
43
|
+
- `%o` - 对象
|
44
|
+
- `%s` - 字符串
|
45
|
+
- `%d` - 数字
|
46
|
+
|
47
|
+
## 示例
|
48
|
+
|
49
|
+
查看 [market/index.ts](mdc:src/server/routers/edge/market/index.ts) 中的使用示例:
|
50
|
+
|
51
|
+
```typescript
|
52
|
+
import debug from 'debug';
|
53
|
+
|
54
|
+
const log = debug('lobe-edge-router:market');
|
55
|
+
|
56
|
+
log('getAgent input: %O', input);
|
57
|
+
```
|
58
|
+
|
59
|
+
## 启用调试
|
60
|
+
|
61
|
+
要在开发时启用调试输出,需设置环境变量:
|
62
|
+
|
63
|
+
### 在浏览器中
|
64
|
+
|
65
|
+
在控制台执行:
|
66
|
+
```javascript
|
67
|
+
localStorage.debug = 'lobe-*'
|
68
|
+
```
|
69
|
+
|
70
|
+
### 在 Node.js 环境中
|
71
|
+
|
72
|
+
```bash
|
73
|
+
DEBUG=lobe-* npm run dev
|
74
|
+
# 或者
|
75
|
+
DEBUG=lobe-* pnpm dev
|
76
|
+
```
|
77
|
+
|
78
|
+
### 在 Electron 应用中
|
79
|
+
|
80
|
+
可以在主进程和渲染进程启动前设置环境变量:
|
81
|
+
|
82
|
+
```typescript
|
83
|
+
process.env.DEBUG = 'lobe-*';
|
84
|
+
```
|
@@ -0,0 +1,188 @@
|
|
1
|
+
---
|
2
|
+
description: 桌面端测试
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# 桌面端控制器单元测试指南
|
7
|
+
|
8
|
+
## 测试框架与目录结构
|
9
|
+
|
10
|
+
LobeChat 桌面端使用 Vitest 作为测试框架。控制器的单元测试应放置在对应控制器文件同级的 `__tests__` 目录下,并以原控制器文件名加 `.test.ts` 作为文件名。
|
11
|
+
|
12
|
+
```
|
13
|
+
apps/desktop/src/main/controllers/
|
14
|
+
├── __tests__/
|
15
|
+
│ ├── index.test.ts
|
16
|
+
│ ├── MenuCtr.test.ts
|
17
|
+
│ └── ...
|
18
|
+
├── McpCtr.ts
|
19
|
+
├── MenuCtr.ts
|
20
|
+
└── ...
|
21
|
+
```
|
22
|
+
|
23
|
+
## 测试文件基本结构
|
24
|
+
|
25
|
+
```typescript
|
26
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
27
|
+
|
28
|
+
import type { App } from '@/core/App';
|
29
|
+
|
30
|
+
import YourController from '../YourControllerName';
|
31
|
+
|
32
|
+
// 模拟依赖
|
33
|
+
vi.mock('依赖模块', () => ({
|
34
|
+
依赖函数: vi.fn(),
|
35
|
+
}));
|
36
|
+
|
37
|
+
// 模拟 App 实例
|
38
|
+
const mockApp = {
|
39
|
+
// 按需模拟必要的 App 属性和方法
|
40
|
+
} as unknown as App;
|
41
|
+
|
42
|
+
describe('YourController', () => {
|
43
|
+
let controller: YourController;
|
44
|
+
|
45
|
+
beforeEach(() => {
|
46
|
+
vi.clearAllMocks();
|
47
|
+
controller = new YourController(mockApp);
|
48
|
+
});
|
49
|
+
|
50
|
+
describe('方法名', () => {
|
51
|
+
it('测试场景描述', async () => {
|
52
|
+
// 准备测试数据
|
53
|
+
|
54
|
+
// 执行被测方法
|
55
|
+
const result = await controller.方法名(参数);
|
56
|
+
|
57
|
+
// 验证结果
|
58
|
+
expect(result).toMatchObject(预期结果);
|
59
|
+
});
|
60
|
+
});
|
61
|
+
});
|
62
|
+
```
|
63
|
+
|
64
|
+
## 模拟外部依赖
|
65
|
+
|
66
|
+
### 模拟模块函数
|
67
|
+
|
68
|
+
```typescript
|
69
|
+
const mockFunction = vi.fn();
|
70
|
+
|
71
|
+
vi.mock('module-name', () => ({
|
72
|
+
functionName: mockFunction,
|
73
|
+
}));
|
74
|
+
```
|
75
|
+
|
76
|
+
### 模拟 Node.js 核心模块
|
77
|
+
|
78
|
+
例如模拟 `child_process.exec` 和 `util.promisify`:
|
79
|
+
|
80
|
+
```typescript
|
81
|
+
// 存储模拟的 exec 实现
|
82
|
+
const mockExecImpl = vi.fn();
|
83
|
+
|
84
|
+
// 模拟 child_process.exec
|
85
|
+
vi.mock('child_process', () => ({
|
86
|
+
exec: vi.fn((cmd, callback) => {
|
87
|
+
return mockExecImpl(cmd, callback);
|
88
|
+
}),
|
89
|
+
}));
|
90
|
+
|
91
|
+
// 模拟 util.promisify
|
92
|
+
vi.mock('util', () => ({
|
93
|
+
promisify: vi.fn((fn) => {
|
94
|
+
return async (cmd: string) => {
|
95
|
+
return new Promise((resolve, reject) => {
|
96
|
+
mockExecImpl(cmd, (error: Error | null, result: any) => {
|
97
|
+
if (error) reject(error);
|
98
|
+
else resolve(result);
|
99
|
+
});
|
100
|
+
});
|
101
|
+
};
|
102
|
+
}),
|
103
|
+
}));
|
104
|
+
```
|
105
|
+
|
106
|
+
## 编写有效的测试用例
|
107
|
+
|
108
|
+
### 测试分类
|
109
|
+
|
110
|
+
将测试用例分为不同类别,每个类别测试一个特定场景:
|
111
|
+
|
112
|
+
```typescript
|
113
|
+
// 成功场景
|
114
|
+
it('应该成功完成操作', async () => {});
|
115
|
+
|
116
|
+
// 边界条件
|
117
|
+
it('应该处理边界情况', async () => {});
|
118
|
+
|
119
|
+
// 错误处理
|
120
|
+
it('应该优雅地处理错误', async () => {});
|
121
|
+
```
|
122
|
+
|
123
|
+
### 设置测试数据
|
124
|
+
|
125
|
+
```typescript
|
126
|
+
// 模拟返回值
|
127
|
+
mockExecImpl.mockImplementation((cmd: string, callback: any) => {
|
128
|
+
if (cmd === '命令') {
|
129
|
+
callback(null, { stdout: '成功输出' });
|
130
|
+
} else {
|
131
|
+
callback(new Error('错误信息'), null);
|
132
|
+
}
|
133
|
+
});
|
134
|
+
```
|
135
|
+
|
136
|
+
### 断言
|
137
|
+
|
138
|
+
使用 Vitest 的断言函数验证结果:
|
139
|
+
|
140
|
+
```typescript
|
141
|
+
// 检查基本值
|
142
|
+
expect(result.success).toBe(true);
|
143
|
+
|
144
|
+
// 检查对象部分匹配
|
145
|
+
expect(result.data).toMatchObject({
|
146
|
+
key: 'value',
|
147
|
+
});
|
148
|
+
|
149
|
+
// 检查数组
|
150
|
+
expect(result.items).toHaveLength(2);
|
151
|
+
expect(result.items[0].name).toBe('expectedName');
|
152
|
+
|
153
|
+
// 检查函数调用
|
154
|
+
expect(mockFunction).toHaveBeenCalledWith(expectedArgs);
|
155
|
+
expect(mockFunction).toHaveBeenCalledTimes(1);
|
156
|
+
```
|
157
|
+
|
158
|
+
## 最佳实践
|
159
|
+
|
160
|
+
1. **隔离测试**:确保每个测试互不影响,使用 `beforeEach` 重置模拟和状态
|
161
|
+
2. **全面覆盖**:测试正常流程、边界条件和错误处理
|
162
|
+
3. **清晰命名**:测试名称应清晰描述测试内容和预期结果
|
163
|
+
4. **避免测试实现细节**:测试应该关注行为而非实现细节,使代码重构不会破坏测试
|
164
|
+
5. **模拟外部依赖**:使用 `vi.mock()` 模拟所有外部依赖,减少测试的不确定性
|
165
|
+
|
166
|
+
## 示例:测试 IPC 事件处理方法
|
167
|
+
|
168
|
+
```typescript
|
169
|
+
it('应该正确处理 IPC 事件', async () => {
|
170
|
+
// 模拟依赖
|
171
|
+
mockSomething.mockReturnValue({ result: 'success' });
|
172
|
+
|
173
|
+
// 调用 IPC 方法
|
174
|
+
const result = await controller.ipcMethodName({
|
175
|
+
param1: 'value1',
|
176
|
+
param2: 'value2',
|
177
|
+
});
|
178
|
+
|
179
|
+
// 验证结果
|
180
|
+
expect(result).toEqual({
|
181
|
+
success: true,
|
182
|
+
data: { result: 'success' },
|
183
|
+
});
|
184
|
+
|
185
|
+
// 验证依赖调用
|
186
|
+
expect(mockSomething).toHaveBeenCalledWith('value1', 'value2');
|
187
|
+
});
|
188
|
+
```
|
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,40 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.96.4](https://github.com/lobehub/lobe-chat/compare/v1.96.3...v1.96.4)
|
6
|
+
|
7
|
+
<sup>Released on **2025-06-22**</sup>
|
8
|
+
|
9
|
+
<br/>
|
10
|
+
|
11
|
+
<details>
|
12
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
13
|
+
|
14
|
+
</details>
|
15
|
+
|
16
|
+
<div align="right">
|
17
|
+
|
18
|
+
[](#readme-top)
|
19
|
+
|
20
|
+
</div>
|
21
|
+
|
22
|
+
### [Version 1.96.3](https://github.com/lobehub/lobe-chat/compare/v1.96.2...v1.96.3)
|
23
|
+
|
24
|
+
<sup>Released on **2025-06-22**</sup>
|
25
|
+
|
26
|
+
<br/>
|
27
|
+
|
28
|
+
<details>
|
29
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
30
|
+
|
31
|
+
</details>
|
32
|
+
|
33
|
+
<div align="right">
|
34
|
+
|
35
|
+
[](#readme-top)
|
36
|
+
|
37
|
+
</div>
|
38
|
+
|
5
39
|
### [Version 1.96.2](https://github.com/lobehub/lobe-chat/compare/v1.96.1...v1.96.2)
|
6
40
|
|
7
41
|
<sup>Released on **2025-06-22**</sup>
|
package/README.md
CHANGED
@@ -39,7 +39,7 @@ One-click **FREE** deployment of your private OpenAI ChatGPT/Claude/Gemini/Groq/
|
|
39
39
|
|
40
40
|
<sup>Pioneering the new age of thinking and creating. Built for you, the Super Individual.</sup>
|
41
41
|
|
42
|
-
[![][github-trending-shield]][github-trending-url]
|
42
|
+
[![][github-trending-shield]][github-trending-url] <br /> <br /> <a href="https://vercel.com/oss"> <img alt="Vercel OSS Program" src="https://vercel.com/oss/program-badge.svg" /> </a>
|
43
43
|
|
44
44
|
![][image-overview]
|
45
45
|
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.96.
|
3
|
+
"version": "1.96.4",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
@@ -150,7 +150,7 @@
|
|
150
150
|
"@lobehub/chat-plugins-gateway": "^1.9.0",
|
151
151
|
"@lobehub/icons": "^2.2.0",
|
152
152
|
"@lobehub/tts": "^2.0.1",
|
153
|
-
"@lobehub/ui": "^2.
|
153
|
+
"@lobehub/ui": "^2.5.6",
|
154
154
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
155
155
|
"@neondatabase/serverless": "^1.0.0",
|
156
156
|
"@next/third-parties": "^15.3.3",
|
@@ -186,6 +186,7 @@
|
|
186
186
|
"file-type": "^20.5.0",
|
187
187
|
"framer-motion": "^12.15.0",
|
188
188
|
"gpt-tokenizer": "^2.9.0",
|
189
|
+
"gray-matter": "^4.0.3",
|
189
190
|
"html-to-text": "^9.0.5",
|
190
191
|
"i18next": "^24.2.3",
|
191
192
|
"i18next-browser-languagedetector": "^8.1.0",
|
@@ -202,6 +203,7 @@
|
|
202
203
|
"lodash-es": "^4.17.21",
|
203
204
|
"lucide-react": "^0.522.0",
|
204
205
|
"mammoth": "^1.9.1",
|
206
|
+
"markdown-to-txt": "^2.0.1",
|
205
207
|
"mdast-util-to-markdown": "^2.1.2",
|
206
208
|
"modern-screenshot": "^4.6.0",
|
207
209
|
"nanoid": "^5.1.5",
|
@@ -232,7 +234,7 @@
|
|
232
234
|
"react-confetti": "^6.4.0",
|
233
235
|
"react-dom": "^19.1.0",
|
234
236
|
"react-fast-marquee": "^1.6.5",
|
235
|
-
"react-hotkeys-hook": "^
|
237
|
+
"react-hotkeys-hook": "^5.1.0",
|
236
238
|
"react-i18next": "^15.5.2",
|
237
239
|
"react-layout-kit": "^1.9.1",
|
238
240
|
"react-lazy-load": "^4.0.1",
|
@@ -276,7 +278,7 @@
|
|
276
278
|
"@commitlint/cli": "^19.8.1",
|
277
279
|
"@edge-runtime/vm": "^5.0.0",
|
278
280
|
"@huggingface/tasks": "^0.15.9",
|
279
|
-
"@lobehub/i18n-cli": "^1.
|
281
|
+
"@lobehub/i18n-cli": "^1.23.0",
|
280
282
|
"@lobehub/lint": "^1.26.2",
|
281
283
|
"@lobehub/seo-cli": "^1.6.0",
|
282
284
|
"@next/bundle-analyzer": "^15.3.3",
|
@@ -325,14 +327,12 @@
|
|
325
327
|
"fake-indexeddb": "^6.0.1",
|
326
328
|
"fs-extra": "^11.3.0",
|
327
329
|
"glob": "^11.0.2",
|
328
|
-
"gray-matter": "^4.0.3",
|
329
330
|
"happy-dom": "^17.5.6",
|
330
331
|
"husky": "^9.1.7",
|
331
332
|
"just-diff": "^6.0.2",
|
332
333
|
"lint-staged": "^15.5.2",
|
333
334
|
"lodash": "^4.17.21",
|
334
335
|
"markdown-table": "^3.0.4",
|
335
|
-
"markdown-to-txt": "^2.0.1",
|
336
336
|
"mcp-hello-world": "^1.1.2",
|
337
337
|
"mime": "^4.0.7",
|
338
338
|
"node-fetch": "^3.3.2",
|
@@ -366,13 +366,6 @@
|
|
366
366
|
],
|
367
367
|
"overrides": {
|
368
368
|
"mdast-util-gfm-autolink-literal": "2.0.0"
|
369
|
-
},
|
370
|
-
"packageExtensions": {
|
371
|
-
"@inkjs/ui": {
|
372
|
-
"dependencies": {
|
373
|
-
"react": "^18"
|
374
|
-
}
|
375
|
-
}
|
376
369
|
}
|
377
370
|
}
|
378
371
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
-
import { Button } from '@lobehub/ui';
|
3
|
+
import { Button, Text } from '@lobehub/ui';
|
4
4
|
import { LobeChat } from '@lobehub/ui/brand';
|
5
|
-
import { Col, Flex, Row, Skeleton
|
5
|
+
import { Col, Flex, Row, Skeleton } from 'antd';
|
6
6
|
import { createStyles } from 'antd-style';
|
7
7
|
import { AuthError } from 'next-auth';
|
8
8
|
import { signIn } from 'next-auth/react';
|
@@ -15,8 +15,6 @@ import AuthIcons from '@/components/NextAuth/AuthIcons';
|
|
15
15
|
import { DOCUMENTS_REFER_URL, PRIVACY_URL, TERMS_URL } from '@/const/url';
|
16
16
|
import { useUserStore } from '@/store/user';
|
17
17
|
|
18
|
-
const { Title, Paragraph } = Typography;
|
19
|
-
|
20
18
|
const useStyles = createStyles(({ css, token }) => ({
|
21
19
|
button: css`
|
22
20
|
text-transform: capitalize;
|
@@ -111,13 +109,15 @@ export default memo(() => {
|
|
111
109
|
<Flex gap="large" vertical>
|
112
110
|
{/* Header */}
|
113
111
|
<div className={styles.text}>
|
114
|
-
<
|
112
|
+
<Text as={'h4'} className={styles.title}>
|
115
113
|
<div>
|
116
114
|
<LobeChat size={48} />
|
117
115
|
</div>
|
118
116
|
{t('signIn.start.title', { applicationName: 'LobeChat' })}
|
119
|
-
</
|
120
|
-
<
|
117
|
+
</Text>
|
118
|
+
<Text as={'p'} className={styles.description}>
|
119
|
+
{t('signIn.start.subtitle')}
|
120
|
+
</Text>
|
121
121
|
</div>
|
122
122
|
{/* Content */}
|
123
123
|
<Flex gap="small" vertical>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { ActionIcon } from '@lobehub/ui';
|
2
|
-
import { Typography } from 'antd';
|
1
|
+
import { ActionIcon, Text } from '@lobehub/ui';
|
3
2
|
import { createStyles } from 'antd-style';
|
4
3
|
import { Trash } from 'lucide-react';
|
5
4
|
import { memo } from 'react';
|
@@ -53,7 +52,7 @@ const FileItem = memo<FileItemProps>(({ id, onRemove, file, status, uploadState,
|
|
53
52
|
<Flexbox align={'center'} className={styles.container} gap={12} horizontal key={id}>
|
54
53
|
<FileIcon fileName={file.name} fileType={file.type} />
|
55
54
|
<Flexbox style={{ overflow: 'hidden' }}>
|
56
|
-
<
|
55
|
+
<Text ellipsis>{file.name}</Text>
|
57
56
|
<UploadDetail size={file.size} status={status} tasks={tasks} uploadState={uploadState} />
|
58
57
|
</Flexbox>
|
59
58
|
<ActionIcon
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { Text } from '@lobehub/ui';
|
2
2
|
import { createStyles } from 'antd-style';
|
3
3
|
import isEqual from 'fast-deep-equal';
|
4
4
|
import { CSSProperties, memo } from 'react';
|
@@ -44,10 +44,10 @@ const Thread = memo<ThreadProps>(({ id, placement, style }) => {
|
|
44
44
|
<div style={{ width: 40 }} />
|
45
45
|
<Flexbox className={styles.container} gap={4} padding={4} style={{ width: 'fit-content' }}>
|
46
46
|
<Flexbox gap={8} horizontal paddingInline={6}>
|
47
|
-
<
|
47
|
+
<Text style={{ fontSize: 12 }} type={'secondary'}>
|
48
48
|
{t('thread.title')}
|
49
49
|
{threads.length}
|
50
|
-
</
|
50
|
+
</Text>
|
51
51
|
</Flexbox>
|
52
52
|
<Flexbox>
|
53
53
|
{threads.map((thread) => (
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { Text } from '@lobehub/ui';
|
4
4
|
import isEqual from 'fast-deep-equal';
|
5
5
|
import React, { memo, useCallback, useRef } from 'react';
|
6
6
|
import { useTranslation } from 'react-i18next';
|
@@ -37,7 +37,7 @@ const SearchResult = memo(() => {
|
|
37
37
|
if (topics.length === 0)
|
38
38
|
return (
|
39
39
|
<Center paddingBlock={12}>
|
40
|
-
<
|
40
|
+
<Text type={'secondary'}>{t('searchResultEmpty')}</Text>
|
41
41
|
</Center>
|
42
42
|
);
|
43
43
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ActionIcon, Dropdown, EditableText, Icon, type MenuProps } from '@lobehub/ui';
|
2
|
-
import { App
|
1
|
+
import { ActionIcon, Dropdown, EditableText, Icon, type MenuProps, Text } from '@lobehub/ui';
|
2
|
+
import { App } from 'antd';
|
3
3
|
import { createStyles } from 'antd-style';
|
4
4
|
import { MoreVertical, PencilLine, Trash } from 'lucide-react';
|
5
5
|
import { memo, useMemo } from 'react';
|
@@ -30,7 +30,6 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
30
30
|
text-align: start;
|
31
31
|
`,
|
32
32
|
}));
|
33
|
-
const { Paragraph } = Typography;
|
34
33
|
|
35
34
|
interface TopicContentProps {
|
36
35
|
active?: boolean;
|
@@ -109,13 +108,14 @@ const Content = memo<TopicContentProps>(({ id, title, active, showMore }) => {
|
|
109
108
|
<BubblesLoading />
|
110
109
|
</Flexbox>
|
111
110
|
) : (
|
112
|
-
<
|
111
|
+
<Text
|
112
|
+
as={'p'}
|
113
113
|
className={cx(styles.title, active && styles.active)}
|
114
114
|
ellipsis={{ rows: 1, tooltip: { placement: 'left', title } }}
|
115
115
|
style={{ margin: 0 }}
|
116
116
|
>
|
117
117
|
{title}
|
118
|
-
</
|
118
|
+
</Text>
|
119
119
|
)
|
120
120
|
) : (
|
121
121
|
<EditableText
|
@@ -1,13 +1,10 @@
|
|
1
|
-
import { Icon, Tag } from '@lobehub/ui';
|
2
|
-
import { Typography } from 'antd';
|
1
|
+
import { Icon, Tag, Text } from '@lobehub/ui';
|
3
2
|
import { useTheme } from 'antd-style';
|
4
3
|
import { MessageSquareDashed } from 'lucide-react';
|
5
4
|
import { memo } from 'react';
|
6
5
|
import { useTranslation } from 'react-i18next';
|
7
6
|
import { Flexbox } from 'react-layout-kit';
|
8
7
|
|
9
|
-
const { Paragraph } = Typography;
|
10
|
-
|
11
8
|
const DefaultContent = memo(() => {
|
12
9
|
const { t } = useTranslation('topic');
|
13
10
|
|
@@ -18,9 +15,9 @@ const DefaultContent = memo(() => {
|
|
18
15
|
<Flexbox align={'center'} height={24} justify={'center'} width={24}>
|
19
16
|
<Icon color={theme.colorTextDescription} icon={MessageSquareDashed} />
|
20
17
|
</Flexbox>
|
21
|
-
<
|
18
|
+
<Text ellipsis={{ rows: 1 }} style={{ margin: 0 }}>
|
22
19
|
{t('defaultTitle')}
|
23
|
-
</
|
20
|
+
</Text>
|
24
21
|
<Tag>{t('temp')}</Tag>
|
25
22
|
</Flexbox>
|
26
23
|
);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ActionIcon, Dropdown, EditableText, Icon, type MenuProps } from '@lobehub/ui';
|
2
|
-
import { App
|
1
|
+
import { ActionIcon, Dropdown, EditableText, Icon, type MenuProps, Text } from '@lobehub/ui';
|
2
|
+
import { App } from 'antd';
|
3
3
|
import { createStyles } from 'antd-style';
|
4
4
|
import {
|
5
5
|
LucideCopy,
|
@@ -32,7 +32,6 @@ const useStyles = createStyles(({ css }) => ({
|
|
32
32
|
text-align: start;
|
33
33
|
`,
|
34
34
|
}));
|
35
|
-
const { Paragraph } = Typography;
|
36
35
|
|
37
36
|
interface TopicContentProps {
|
38
37
|
fav?: boolean;
|
@@ -167,13 +166,13 @@ const TopicContent = memo<TopicContentProps>(({ id, title, fav, showMore }) => {
|
|
167
166
|
<BubblesLoading />
|
168
167
|
</Flexbox>
|
169
168
|
) : (
|
170
|
-
<
|
169
|
+
<Text
|
171
170
|
className={styles.title}
|
172
171
|
ellipsis={{ rows: 1, tooltip: { placement: 'left', title } }}
|
173
172
|
style={{ margin: 0 }}
|
174
173
|
>
|
175
174
|
{title}
|
176
|
-
</
|
175
|
+
</Text>
|
177
176
|
)
|
178
177
|
) : (
|
179
178
|
<EditableText
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { SearchBar } from '@lobehub/ui';
|
4
|
-
import { memo } from 'react';
|
4
|
+
import { type ChangeEvent, memo, useCallback } from 'react';
|
5
5
|
import { useTranslation } from 'react-i18next';
|
6
6
|
|
7
7
|
import { useSessionStore } from '@/store/session';
|
@@ -11,6 +11,7 @@ import { HotkeyEnum } from '@/types/hotkey';
|
|
11
11
|
|
12
12
|
const SessionSearchBar = memo<{ mobile?: boolean }>(({ mobile }) => {
|
13
13
|
const { t } = useTranslation('chat');
|
14
|
+
const isLoaded = useUserStore((s) => s.isLoaded);
|
14
15
|
const hotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.Search));
|
15
16
|
|
16
17
|
const [keywords, useSearchSessions, updateSearchKeywords] = useSessionStore((s) => [
|
@@ -21,14 +22,19 @@ const SessionSearchBar = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
21
22
|
|
22
23
|
const { isValidating } = useSearchSessions(keywords);
|
23
24
|
|
25
|
+
const handleChange = useCallback(
|
26
|
+
(e: ChangeEvent<HTMLInputElement>) => {
|
27
|
+
updateSearchKeywords(e.target.value);
|
28
|
+
},
|
29
|
+
[updateSearchKeywords],
|
30
|
+
);
|
31
|
+
|
24
32
|
return (
|
25
33
|
<SearchBar
|
26
34
|
allowClear
|
27
35
|
enableShortKey={!mobile}
|
28
|
-
loading={isValidating}
|
29
|
-
onChange={
|
30
|
-
updateSearchKeywords(e.target.value);
|
31
|
-
}}
|
36
|
+
loading={!isLoaded || isValidating}
|
37
|
+
onChange={handleChange}
|
32
38
|
placeholder={t('searchAgentPlaceholder')}
|
33
39
|
shortKey={hotkey}
|
34
40
|
spotlight={!mobile}
|
package/src/app/[variants]/(main)/files/(content)/@menu/features/KnowledgeBase/Item/Content.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ActionIcon, Dropdown, EditableText, Icon, type MenuProps } from '@lobehub/ui';
|
2
|
-
import { App
|
1
|
+
import { ActionIcon, Dropdown, EditableText, Icon, type MenuProps, Text } from '@lobehub/ui';
|
2
|
+
import { App } from 'antd';
|
3
3
|
import { createStyles } from 'antd-style';
|
4
4
|
import { LucideLoader2, MoreVertical, PencilLine, Trash } from 'lucide-react';
|
5
5
|
import { memo, useMemo } from 'react';
|
@@ -31,8 +31,6 @@ const useStyles = createStyles(({ css }) => ({
|
|
31
31
|
`,
|
32
32
|
}));
|
33
33
|
|
34
|
-
const { Paragraph } = Typography;
|
35
|
-
|
36
34
|
interface KnowledgeBaseItemProps {
|
37
35
|
id: string;
|
38
36
|
name: string;
|
@@ -118,13 +116,13 @@ const Content = memo<KnowledgeBaseItemProps>(({ id, name, showMore }) => {
|
|
118
116
|
<BubblesLoading />
|
119
117
|
</Flexbox>
|
120
118
|
) : (
|
121
|
-
<
|
119
|
+
<Text
|
122
120
|
className={styles.title}
|
123
121
|
ellipsis={{ rows: 1, tooltip: { placement: 'left', title: name } }}
|
124
122
|
style={{ margin: 0, opacity: isLoading ? 0.6 : undefined }}
|
125
123
|
>
|
126
124
|
{name}
|
127
|
-
</
|
125
|
+
</Text>
|
128
126
|
)
|
129
127
|
) : (
|
130
128
|
<EditableText
|