@lobehub/chat 1.36.11 → 1.36.12
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/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/database/migrations/0006_add_knowledge_base.sql +1 -1
- package/src/database/migrations/0007_fix_embedding_table.sql +4 -0
- package/src/database/server/models/topic.ts +1 -1
- package/src/services/import/client.ts +1 -1
- package/src/types/importer.ts +10 -2
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.36.12](https://github.com/lobehub/lobe-chat/compare/v1.36.11...v1.36.12)
|
6
|
+
|
7
|
+
<sup>Released on **2024-12-11**</sup>
|
8
|
+
|
9
|
+
#### ♻ Code Refactoring
|
10
|
+
|
11
|
+
- **misc**: Update sql and types.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Code refactoring
|
19
|
+
|
20
|
+
- **misc**: Update sql and types, closes [#4979](https://github.com/lobehub/lobe-chat/issues/4979) ([8243f01](https://github.com/lobehub/lobe-chat/commit/8243f01))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
5
30
|
### [Version 1.36.11](https://github.com/lobehub/lobe-chat/compare/v1.36.10...v1.36.11)
|
6
31
|
|
7
32
|
<sup>Released on **2024-12-11**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.36.
|
3
|
+
"version": "1.36.12",
|
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",
|
@@ -121,7 +121,7 @@ CREATE TABLE IF NOT EXISTS "unstructured_chunks" (
|
|
121
121
|
"file_id" varchar
|
122
122
|
);
|
123
123
|
--> statement-breakpoint
|
124
|
-
ALTER TABLE "files_to_messages" RENAME TO "messages_files"
|
124
|
+
ALTER TABLE "files_to_messages" RENAME TO "messages_files";--> statement-breakpoint
|
125
125
|
DROP TABLE "files_to_agents";--> statement-breakpoint
|
126
126
|
ALTER TABLE "files" ADD COLUMN "file_hash" varchar(64);--> statement-breakpoint
|
127
127
|
ALTER TABLE "files" ADD COLUMN "chunk_task_id" uuid;--> statement-breakpoint
|
@@ -3,16 +3,20 @@ CREATE TEMP TABLE embeddings_temp AS
|
|
3
3
|
SELECT DISTINCT ON (chunk_id) *
|
4
4
|
FROM embeddings
|
5
5
|
ORDER BY chunk_id, random();
|
6
|
+
--> statement-breakpoint
|
6
7
|
|
7
8
|
-- step 2: delete all rows from the original table
|
8
9
|
DELETE FROM embeddings;
|
10
|
+
--> statement-breakpoint
|
9
11
|
|
10
12
|
-- step 3: insert the rows we want to keep back into the original table
|
11
13
|
INSERT INTO embeddings
|
12
14
|
SELECT * FROM embeddings_temp;
|
15
|
+
--> statement-breakpoint
|
13
16
|
|
14
17
|
-- step 4: drop the temporary table
|
15
18
|
DROP TABLE embeddings_temp;
|
19
|
+
--> statement-breakpoint
|
16
20
|
|
17
21
|
-- step 5: now it's safe to add the unique constraint
|
18
22
|
ALTER TABLE "embeddings" ADD CONSTRAINT "embeddings_chunk_id_unique" UNIQUE("chunk_id");
|
@@ -2,9 +2,9 @@ import { Column, count, inArray, sql } from 'drizzle-orm';
|
|
2
2
|
import { and, desc, eq, exists, isNull, like, or } from 'drizzle-orm/expressions';
|
3
3
|
|
4
4
|
import { LobeChatDatabase } from '@/database/type';
|
5
|
+
import { idGenerator } from '@/database/utils/idGenerator';
|
5
6
|
|
6
7
|
import { NewMessage, TopicItem, messages, topics } from '../../schemas';
|
7
|
-
import { idGenerator } from '@/database/utils/idGenerator';
|
8
8
|
|
9
9
|
export interface CreateTopicParams {
|
10
10
|
favorite?: boolean;
|
@@ -32,7 +32,7 @@ export class ClientService {
|
|
32
32
|
}
|
33
33
|
|
34
34
|
if (sessionGroups.length > 0) {
|
35
|
-
const res = await SessionGroupModel.batchCreate(sessionGroups);
|
35
|
+
const res = await SessionGroupModel.batchCreate(sessionGroups as any);
|
36
36
|
sessionGroupResult = this.mapImportResult(res);
|
37
37
|
}
|
38
38
|
|
package/src/types/importer.ts
CHANGED
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
MessageRoleType,
|
9
9
|
} from '@/types/message';
|
10
10
|
import { MetaData } from '@/types/meta';
|
11
|
-
import { SessionGroupId
|
11
|
+
import { SessionGroupId } from '@/types/session';
|
12
12
|
import { ChatTopic } from '@/types/topic';
|
13
13
|
|
14
14
|
interface ImportSession {
|
@@ -64,9 +64,17 @@ interface ImportMessage {
|
|
64
64
|
updatedAt: number;
|
65
65
|
}
|
66
66
|
|
67
|
+
interface ImportSessionGroup {
|
68
|
+
createdAt: number;
|
69
|
+
id: string;
|
70
|
+
name: string;
|
71
|
+
sort?: number | null;
|
72
|
+
updatedAt: number;
|
73
|
+
}
|
74
|
+
|
67
75
|
export interface ImporterEntryData {
|
68
76
|
messages?: ImportMessage[];
|
69
|
-
sessionGroups?:
|
77
|
+
sessionGroups?: ImportSessionGroup[];
|
70
78
|
sessions?: ImportSession[];
|
71
79
|
topics?: ChatTopic[];
|
72
80
|
version: number;
|