@yeaft/webchat-agent 0.0.43 → 0.0.45
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/history.js +5 -23
- package/package.json +1 -1
package/history.js
CHANGED
|
@@ -227,7 +227,7 @@ export async function handleListFolders(msg) {
|
|
|
227
227
|
// 从 session 文件读取真实的工作目录路径
|
|
228
228
|
const originalPath = getWorkDirFromProjectFolder(entryPath, entry);
|
|
229
229
|
|
|
230
|
-
//
|
|
230
|
+
// 快速计数:只数 .jsonl 文件数量,不读取文件内容
|
|
231
231
|
let sessionCount = 0;
|
|
232
232
|
let lastModified = stats.mtime.getTime();
|
|
233
233
|
|
|
@@ -236,29 +236,11 @@ export async function handleListFolders(msg) {
|
|
|
236
236
|
|
|
237
237
|
for (const file of files) {
|
|
238
238
|
if (file.endsWith('.jsonl')) {
|
|
239
|
-
|
|
240
|
-
const fileStats = statSync(filePath);
|
|
241
|
-
if (fileStats.mtime.getTime() > lastModified) {
|
|
242
|
-
lastModified = fileStats.mtime.getTime();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// 检查文件是否包含用户消息(与 getHistorySessions 保持一致)
|
|
239
|
+
sessionCount++;
|
|
246
240
|
try {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
try {
|
|
251
|
-
const data = JSON.parse(line);
|
|
252
|
-
if (data.type === 'user' && data.message?.content) {
|
|
253
|
-
const text = typeof data.message.content === 'string'
|
|
254
|
-
? data.message.content
|
|
255
|
-
: data.message.content[0]?.text || '';
|
|
256
|
-
if (text.trim()) {
|
|
257
|
-
sessionCount++;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
} catch {}
|
|
241
|
+
const fileStats = statSync(join(entryPath, file));
|
|
242
|
+
if (fileStats.mtime.getTime() > lastModified) {
|
|
243
|
+
lastModified = fileStats.mtime.getTime();
|
|
262
244
|
}
|
|
263
245
|
} catch {}
|
|
264
246
|
}
|