@lobehub/lobehub 2.0.0-next.168 → 2.0.0-next.169
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/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/changelog/v1.json +9 -0
- package/package.json +4 -4
- package/packages/file-loaders/src/loaders/text/index.ts +7 -7
- package/packages/file-loaders/src/types.ts +47 -47
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.169](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.168...v2.0.0-next.169)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-12-12**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix CVE errors.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix CVE errors, closes [#10748](https://github.com/lobehub/lobe-chat/issues/10748) ([6591f3c](https://github.com/lobehub/lobe-chat/commit/6591f3c))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 2.0.0-next.168](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.167...v2.0.0-next.168)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2025-12-12**</sup>
|
package/README.md
CHANGED
|
@@ -352,7 +352,7 @@ In addition, these plugins are not limited to news aggregation, but can also ext
|
|
|
352
352
|
| [SEO](https://lobechat.com/discover/plugin/SEO)<br/><sup>By **orrenprunckun** on **2025-11-14**</sup> | Enter any URL and keyword and get an On-Page SEO analysis & insights!<br/>`seo` |
|
|
353
353
|
| [Shopping tools](https://lobechat.com/discover/plugin/ShoppingTools)<br/><sup>By **shoppingtools** on **2025-10-27**</sup> | Search for products on eBay & AliExpress, find eBay events & coupons. Get prompt examples.<br/>`shopping` `e-bay` `ali-express` `coupons` |
|
|
354
354
|
|
|
355
|
-
> 📊 Total plugins: [<kbd>**
|
|
355
|
+
> 📊 Total plugins: [<kbd>**37**</kbd>](https://lobechat.com/discover/plugins)
|
|
356
356
|
|
|
357
357
|
<!-- PLUGIN LIST -->
|
|
358
358
|
|
package/README.zh-CN.md
CHANGED
|
@@ -345,7 +345,7 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
|
345
345
|
| [SEO](https://lobechat.com/discover/plugin/SEO)<br/><sup>By **orrenprunckun** on **2025-11-14**</sup> | 输入任何 URL 和关键词,获取页面 SEO 分析和见解!<br/>`seo` |
|
|
346
346
|
| [购物工具](https://lobechat.com/discover/plugin/ShoppingTools)<br/><sup>By **shoppingtools** on **2025-10-27**</sup> | 在 eBay 和 AliExpress 上搜索产品,查找 eBay 活动和优惠券。获取快速示例。<br/>`购物` `e-bay` `ali-express` `优惠券` |
|
|
347
347
|
|
|
348
|
-
> 📊 Total plugins: [<kbd>**
|
|
348
|
+
> 📊 Total plugins: [<kbd>**37**</kbd>](https://lobechat.com/discover/plugins)
|
|
349
349
|
|
|
350
350
|
<!-- PLUGIN LIST -->
|
|
351
351
|
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.169",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent 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",
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
"mdast-util-to-markdown": "^2.1.2",
|
|
244
244
|
"model-bank": "workspace:*",
|
|
245
245
|
"nanoid": "^5.1.6",
|
|
246
|
-
"next": "^16.0.
|
|
246
|
+
"next": "^16.0.10",
|
|
247
247
|
"next-auth": "5.0.0-beta.30",
|
|
248
248
|
"next-mdx-remote": "^5.0.0",
|
|
249
249
|
"nextjs-toploader": "^3.9.17",
|
|
@@ -271,10 +271,10 @@
|
|
|
271
271
|
"query-string": "^9.3.1",
|
|
272
272
|
"random-words": "^2.0.1",
|
|
273
273
|
"rc-util": "^5.44.4",
|
|
274
|
-
"react": "^19.2.
|
|
274
|
+
"react": "^19.2.3",
|
|
275
275
|
"react-confetti": "^6.4.0",
|
|
276
276
|
"react-diff-view": "^3.3.2",
|
|
277
|
-
"react-dom": "^19.2.
|
|
277
|
+
"react-dom": "^19.2.3",
|
|
278
278
|
"react-fast-marquee": "^1.6.5",
|
|
279
279
|
"react-hotkeys-hook": "^5.2.1",
|
|
280
280
|
"react-i18next": "^15.7.4",
|
|
@@ -6,7 +6,7 @@ import type { DocumentPage, FileLoaderInterface } from '../../types';
|
|
|
6
6
|
const log = debug('file-loaders:text');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Loader for loading plain text files.
|
|
10
10
|
*/
|
|
11
11
|
export class TextLoader implements FileLoaderInterface {
|
|
12
12
|
async loadPages(filePath: string): Promise<DocumentPage[]> {
|
|
@@ -35,7 +35,7 @@ export class TextLoader implements FileLoaderInterface {
|
|
|
35
35
|
const error = e as Error;
|
|
36
36
|
log('Error encountered while loading text file');
|
|
37
37
|
console.error(`Error loading text file ${filePath}: ${error.message}`);
|
|
38
|
-
//
|
|
38
|
+
// If reading fails, return a Page containing error information
|
|
39
39
|
const errorPage: DocumentPage = {
|
|
40
40
|
charCount: 0,
|
|
41
41
|
lineCount: 0,
|
|
@@ -50,14 +50,14 @@ export class TextLoader implements FileLoaderInterface {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @param pages
|
|
56
|
-
* @returns
|
|
53
|
+
* For plain text, simply concatenate the content of all pages.
|
|
54
|
+
* (Although TextLoader typically has only one page, this maintains interface consistency)
|
|
55
|
+
* @param pages Array of pages
|
|
56
|
+
* @returns Aggregated content
|
|
57
57
|
*/
|
|
58
58
|
async aggregateContent(pages: DocumentPage[]): Promise<string> {
|
|
59
59
|
log('Aggregating content from', pages.length, 'text pages');
|
|
60
|
-
//
|
|
60
|
+
// By default, join with newline separator, can be adjusted or made configurable as needed
|
|
61
61
|
const result = pages.map((page) => page.pageContent).join('\n');
|
|
62
62
|
log('Content aggregated successfully, length:', result.length);
|
|
63
63
|
return result;
|
|
@@ -2,199 +2,199 @@
|
|
|
2
2
|
export type SupportedFileType = 'pdf' | 'doc' | 'docx' | 'txt' | 'excel' | 'pptx'; // | 'pptx' | 'latex' | 'epub' | 'code' | 'markdown';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Represents a complete loaded file, including file-level information and all its pages/chunks.
|
|
6
6
|
*/
|
|
7
7
|
export interface FileDocument {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* File content
|
|
10
10
|
*/
|
|
11
11
|
content: string;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* File creation timestamp.
|
|
15
15
|
*/
|
|
16
16
|
createdTime: Date;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* File type or extension.
|
|
20
20
|
*/
|
|
21
21
|
fileType: string;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Original filename.
|
|
25
25
|
*/
|
|
26
26
|
filename: string;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* File-level metadata.
|
|
30
|
+
* For example, title and author extracted from file properties, or errors when the entire file loading fails.
|
|
31
31
|
*/
|
|
32
32
|
metadata: {
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Allows adding other file-level metadata.
|
|
35
35
|
*/
|
|
36
36
|
[key: string]: any;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Document author (if available).
|
|
39
39
|
*/
|
|
40
40
|
author?: string;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* If the entire file loading fails, record error information.
|
|
43
43
|
*/
|
|
44
44
|
error?: string;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Document title (if available).
|
|
47
47
|
*/
|
|
48
48
|
title?: string;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* File last modified timestamp.
|
|
53
53
|
*/
|
|
54
54
|
modifiedTime: Date;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* Array containing all logical pages/chunks in the document.
|
|
58
|
+
* The order typically corresponds to the natural order in the file.
|
|
59
59
|
*/
|
|
60
60
|
pages?: DocumentPage[];
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Full path of the original file.
|
|
64
64
|
*/
|
|
65
65
|
source: string;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* Total character count of the entire document (sum of all Page charCounts).
|
|
69
|
+
* Needs to be calculated after all Pages are loaded and computed.
|
|
70
70
|
*/
|
|
71
71
|
totalCharCount: number;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* Total line count of the entire document (sum of all Page lineCounts).
|
|
75
|
+
* Needs to be calculated after all Pages are loaded and computed.
|
|
76
76
|
*/
|
|
77
77
|
totalLineCount: number;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Represents a logical unit/page/chunk in a file.
|
|
82
82
|
*/
|
|
83
83
|
export interface DocumentPage {
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* Character count of this page/chunk content.
|
|
86
86
|
*/
|
|
87
87
|
charCount: number;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Line count of this page/chunk content.
|
|
91
91
|
*/
|
|
92
92
|
lineCount: number;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
95
|
+
* Metadata related to this page/chunk.
|
|
96
96
|
*/
|
|
97
97
|
metadata: {
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* Allows adding other page/chunk-specific metadata.
|
|
100
100
|
*/
|
|
101
101
|
[key: string]: any;
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* If the original file unit is further divided into chunks, this is the index of the current chunk.
|
|
105
105
|
*/
|
|
106
106
|
chunkIndex?: number;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
109
|
+
* Error that occurred when processing this page/chunk.
|
|
110
110
|
*/
|
|
111
111
|
error?: string;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Ending line number of this page/chunk in the original file.
|
|
115
115
|
*/
|
|
116
116
|
lineNumberEnd?: number;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* Starting line number of this page/chunk in the original file.
|
|
120
120
|
*/
|
|
121
121
|
lineNumberStart?: number;
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* Page number (applicable for PDF, DOCX).
|
|
125
125
|
*/
|
|
126
126
|
pageNumber?: number;
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
129
|
+
* Section title related to this page/chunk.
|
|
130
130
|
*/
|
|
131
131
|
sectionTitle?: string;
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* Sheet name (applicable for XLSX).
|
|
135
135
|
*/
|
|
136
136
|
sheetName?: string;
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* Slide number (applicable for PPTX).
|
|
140
140
|
*/
|
|
141
141
|
slideNumber?: number;
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* If the original file unit is further divided into chunks, this is the total number of chunks for that unit.
|
|
145
145
|
*/
|
|
146
146
|
totalChunks?: number;
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
150
|
+
* Core text content of this page/chunk.
|
|
151
151
|
*/
|
|
152
152
|
pageContent: string;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
*
|
|
156
|
+
* Optional file metadata used to override information read from the filesystem.
|
|
157
157
|
*/
|
|
158
158
|
export interface FileMetadata {
|
|
159
159
|
/**
|
|
160
|
-
*
|
|
160
|
+
* File creation timestamp.
|
|
161
161
|
*/
|
|
162
162
|
createdTime?: Date;
|
|
163
163
|
/**
|
|
164
|
-
*
|
|
164
|
+
* File type or extension.
|
|
165
165
|
*/
|
|
166
166
|
fileType?: string;
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* Filename.
|
|
169
169
|
*/
|
|
170
170
|
filename?: string;
|
|
171
171
|
/**
|
|
172
|
-
*
|
|
172
|
+
* File last modified timestamp.
|
|
173
173
|
*/
|
|
174
174
|
modifiedTime?: Date;
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
176
|
+
* File source identifier (e.g., S3 URL or original path).
|
|
177
177
|
*/
|
|
178
178
|
source?: string;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* Defines the interface that all file loader classes must implement.
|
|
183
183
|
*/
|
|
184
184
|
export interface FileLoaderInterface {
|
|
185
185
|
/**
|
|
186
|
-
*
|
|
187
|
-
* @param pages DocumentPage
|
|
188
|
-
* @returns
|
|
186
|
+
* Aggregates the page content obtained from loadPages into a single string.
|
|
187
|
+
* @param pages Array of DocumentPage objects.
|
|
188
|
+
* @returns Promise that returns the aggregated text content.
|
|
189
189
|
*/
|
|
190
190
|
aggregateContent(pages: DocumentPage[]): Promise<string>;
|
|
191
191
|
|
|
192
192
|
attachDocumentMetadata?(filePath: string): Promise<Record<string, any>>;
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
196
|
-
* @param filePath
|
|
197
|
-
* @returns
|
|
195
|
+
* Loads file content based on the file path and splits it into logical pages/chunks.
|
|
196
|
+
* @param filePath Full path of the file.
|
|
197
|
+
* @returns Promise that returns an array containing DocumentPage objects.
|
|
198
198
|
*/
|
|
199
199
|
loadPages(filePath: string): Promise<DocumentPage[]>;
|
|
200
200
|
}
|