@lobehub/lobehub 2.0.0-next.79 → 2.0.0-next.80
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 +17 -0
- package/changelog/v1.json +5 -0
- package/docs/development/database-schema.dbml +17 -13
- package/package.json +1 -1
- package/packages/database/migrations/0046_add_parent_id.sql +15 -0
- package/packages/database/migrations/meta/0046_snapshot.json +7879 -0
- package/packages/database/migrations/meta/_journal.json +7 -0
- package/packages/database/src/core/migrations.json +23 -26
- package/packages/database/src/models/document.ts +5 -6
- package/packages/database/src/models/file.ts +5 -5
- package/packages/database/src/repositories/knowledge/index.test.ts +1 -1
- package/packages/database/src/schemas/file.ts +81 -1
- package/packages/database/src/schemas/index.ts +0 -1
- package/packages/database/src/schemas/rag.ts +32 -2
- package/packages/database/src/schemas/relations.ts +2 -3
- package/packages/database/src/schemas/topic.ts +1 -1
- package/src/server/routers/lambda/file.ts +23 -2
- package/src/services/file/index.ts +10 -1
- package/packages/database/src/schemas/document.ts +0 -105
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.80](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.79...v2.0.0-next.80)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-11-18**</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
|
+
|
|
5
22
|
## [Version 2.0.0-next.79](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.78...v2.0.0-next.79)
|
|
6
23
|
|
|
7
24
|
<sup>Released on **2025-11-18**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -170,20 +170,8 @@ table chat_groups_agents {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
table document_chunks {
|
|
174
|
-
document_id varchar(30) [not null]
|
|
175
|
-
chunk_id uuid [not null]
|
|
176
|
-
page_index integer
|
|
177
|
-
user_id text [not null]
|
|
178
|
-
created_at "timestamp with time zone" [not null, default: `now()`]
|
|
179
|
-
|
|
180
|
-
indexes {
|
|
181
|
-
(document_id, chunk_id) [pk]
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
173
|
table documents {
|
|
186
|
-
id varchar(
|
|
174
|
+
id varchar(255) [pk, not null]
|
|
187
175
|
title text
|
|
188
176
|
content text
|
|
189
177
|
file_type varchar(255) [not null]
|
|
@@ -195,6 +183,7 @@ table documents {
|
|
|
195
183
|
source_type text [not null]
|
|
196
184
|
source text [not null]
|
|
197
185
|
file_id text
|
|
186
|
+
parent_id varchar(255)
|
|
198
187
|
user_id text [not null]
|
|
199
188
|
client_id text
|
|
200
189
|
editor_data jsonb
|
|
@@ -206,6 +195,7 @@ table documents {
|
|
|
206
195
|
source [name: 'documents_source_idx']
|
|
207
196
|
file_type [name: 'documents_file_type_idx']
|
|
208
197
|
file_id [name: 'documents_file_id_idx']
|
|
198
|
+
parent_id [name: 'documents_parent_id_idx']
|
|
209
199
|
(client_id, user_id) [name: 'documents_client_id_user_id_unique', unique]
|
|
210
200
|
}
|
|
211
201
|
}
|
|
@@ -219,6 +209,7 @@ table files {
|
|
|
219
209
|
size integer [not null]
|
|
220
210
|
url text [not null]
|
|
221
211
|
source text
|
|
212
|
+
parent_id varchar(255)
|
|
222
213
|
client_id text
|
|
223
214
|
metadata jsonb
|
|
224
215
|
chunk_task_id uuid
|
|
@@ -229,6 +220,7 @@ table files {
|
|
|
229
220
|
|
|
230
221
|
indexes {
|
|
231
222
|
file_hash [name: 'file_hash_idx']
|
|
223
|
+
parent_id [name: 'files_parent_id_idx']
|
|
232
224
|
(client_id, user_id) [name: 'files_client_id_user_id_unique', unique]
|
|
233
225
|
}
|
|
234
226
|
}
|
|
@@ -660,6 +652,18 @@ table chunks {
|
|
|
660
652
|
}
|
|
661
653
|
}
|
|
662
654
|
|
|
655
|
+
table document_chunks {
|
|
656
|
+
document_id varchar(30) [not null]
|
|
657
|
+
chunk_id uuid [not null]
|
|
658
|
+
page_index integer
|
|
659
|
+
user_id text [not null]
|
|
660
|
+
created_at "timestamp with time zone" [not null, default: `now()`]
|
|
661
|
+
|
|
662
|
+
indexes {
|
|
663
|
+
(document_id, chunk_id) [pk]
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
663
667
|
table embeddings {
|
|
664
668
|
id uuid [pk, not null, default: `gen_random_uuid()`]
|
|
665
669
|
chunk_id uuid [unique]
|
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.80",
|
|
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",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ALTER TABLE "documents" ALTER COLUMN "id" SET DATA TYPE varchar(255);--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "documents" ADD COLUMN IF NOT EXISTS "parent_id" varchar(255);--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "files" ADD COLUMN IF NOT EXISTS "parent_id" varchar(255);--> statement-breakpoint
|
|
4
|
+
DO $$ BEGIN
|
|
5
|
+
ALTER TABLE "documents" ADD CONSTRAINT "documents_parent_id_documents_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."documents"("id") ON DELETE set null ON UPDATE no action;
|
|
6
|
+
EXCEPTION
|
|
7
|
+
WHEN duplicate_object THEN null;
|
|
8
|
+
END $$;--> statement-breakpoint
|
|
9
|
+
DO $$ BEGIN
|
|
10
|
+
ALTER TABLE "files" ADD CONSTRAINT "files_parent_id_documents_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."documents"("id") ON DELETE set null ON UPDATE no action;
|
|
11
|
+
EXCEPTION
|
|
12
|
+
WHEN duplicate_object THEN null;
|
|
13
|
+
END $$;--> statement-breakpoint
|
|
14
|
+
CREATE INDEX IF NOT EXISTS "documents_parent_id_idx" ON "documents" USING btree ("parent_id");--> statement-breakpoint
|
|
15
|
+
CREATE INDEX IF NOT EXISTS "files_parent_id_idx" ON "files" USING btree ("parent_id");
|