@lobehub/chat 0.161.20 → 0.161.21

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 CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.161.21](https://github.com/lobehub/lobe-chat/compare/v0.161.20...v0.161.21)
6
+
7
+ <sup>Released on **2024-05-26**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix the batch import error.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix the batch import error, closes [#2671](https://github.com/lobehub/lobe-chat/issues/2671) ([db8f2c6](https://github.com/lobehub/lobe-chat/commit/db8f2c6))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 0.161.20](https://github.com/lobehub/lobe-chat/compare/v0.161.19...v0.161.20)
6
31
 
7
32
  <sup>Released on **2024-05-26**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.161.20",
3
+ "version": "0.161.21",
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",
@@ -215,7 +215,7 @@
215
215
  "dpdm": "^3.14.0",
216
216
  "eslint": "^8.57.0",
217
217
  "eslint-plugin-mdx": "^2.3.4",
218
- "fake-indexeddb": "^5.0.2",
218
+ "fake-indexeddb": "^6.0.0",
219
219
  "glob": "^10.4.1",
220
220
  "gray-matter": "^4.0.3",
221
221
  "happy-dom": "^14.11.0",
@@ -110,11 +110,18 @@ export class BaseModel<N extends keyof BrowserDBSchema = any, T = BrowserDBSchem
110
110
  continue;
111
111
  }
112
112
 
113
+ const getTime = (time?: string | number) => {
114
+ if (!time) return Date.now();
115
+ if (typeof time === 'number') return time;
116
+
117
+ return new Date(time).valueOf();
118
+ };
119
+
113
120
  validatedData.push({
114
121
  ...item,
115
- createdAt: item.createdAt ?? Date.now(),
122
+ createdAt: getTime(item.createdAt as string),
116
123
  id,
117
- updatedAt: item.updatedAt ?? Date.now(),
124
+ updatedAt: getTime(item.updatedAt as string),
118
125
  });
119
126
  } else {
120
127
  errors.push(result.error);
@@ -7,9 +7,9 @@ export type DBModel<T> = T & {
7
7
  };
8
8
 
9
9
  export const DBBaseFieldsSchema = z.object({
10
- createdAt: z.number(),
10
+ createdAt: z.number().or(z.string()),
11
11
  id: z.string(),
12
- updatedAt: z.number(),
12
+ updatedAt: z.number().or(z.string()),
13
13
  });
14
14
 
15
15
  export const LOBE_CHAT_LOCAL_DB_NAME = 'LOBE_CHAT_DB';