@lobehub/lobehub 2.0.0-next.174 → 2.0.0-next.175
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/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/changelog/v1.json +5 -0
- package/package.json +1 -1
- package/packages/database/migrations/0064_add_agents_session_group_id.sql +7 -0
- package/packages/database/migrations/meta/0064_snapshot.json +9143 -0
- package/packages/database/migrations/meta/_journal.json +7 -0
- package/packages/database/src/core/migrations.json +10 -0
- package/packages/database/src/schemas/agent.ts +6 -0
|
@@ -448,6 +448,13 @@
|
|
|
448
448
|
"when": 1766157362540,
|
|
449
449
|
"tag": "0063_add_columns_for_several_tables",
|
|
450
450
|
"breakpoints": true
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"idx": 64,
|
|
454
|
+
"version": "7",
|
|
455
|
+
"when": 1766297832021,
|
|
456
|
+
"tag": "0064_add_agents_session_group_id",
|
|
457
|
+
"breakpoints": true
|
|
451
458
|
}
|
|
452
459
|
],
|
|
453
460
|
"version": "6"
|
|
@@ -1023,5 +1023,15 @@
|
|
|
1023
1023
|
"bps": true,
|
|
1024
1024
|
"folderMillis": 1766157362540,
|
|
1025
1025
|
"hash": "7a8ee107778222390e676951173baa81bfa09dd47216a8467575fca54915172c"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"sql": [
|
|
1029
|
+
"ALTER TABLE \"agents\" ADD COLUMN IF NOT EXISTS \"session_group_id\" text;",
|
|
1030
|
+
"\nDO $$ BEGIN\n IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'agents_session_group_id_session_groups_id_fk') THEN\n ALTER TABLE \"agents\" ADD CONSTRAINT \"agents_session_group_id_session_groups_id_fk\" FOREIGN KEY (\"session_group_id\") REFERENCES \"public\".\"session_groups\"(\"id\") ON DELETE set null ON UPDATE no action;\n END IF;\nEND $$;",
|
|
1031
|
+
"\nCREATE INDEX IF NOT EXISTS \"agents_session_group_id_idx\" ON \"agents\" USING btree (\"session_group_id\");\n"
|
|
1032
|
+
],
|
|
1033
|
+
"bps": true,
|
|
1034
|
+
"folderMillis": 1766297832021,
|
|
1035
|
+
"hash": "431a620396060130c46d6174d4bef3a517a0872aff8d19f3044bd9e7dec78ba5"
|
|
1026
1036
|
}
|
|
1027
1037
|
]
|
|
@@ -15,6 +15,7 @@ import { createInsertSchema } from 'drizzle-zod';
|
|
|
15
15
|
import { idGenerator, randomSlug } from '../utils/idGenerator';
|
|
16
16
|
import { timestamps } from './_helpers';
|
|
17
17
|
import { files, knowledgeBases } from './file';
|
|
18
|
+
import { sessionGroups } from './session';
|
|
18
19
|
import { users } from './user';
|
|
19
20
|
|
|
20
21
|
// Agent table is the main table for storing agents
|
|
@@ -60,6 +61,10 @@ export const agents = pgTable(
|
|
|
60
61
|
openingMessage: text('opening_message'),
|
|
61
62
|
openingQuestions: text('opening_questions').array().default([]),
|
|
62
63
|
|
|
64
|
+
sessionGroupId: text('session_group_id').references(() => sessionGroups.id, {
|
|
65
|
+
onDelete: 'set null',
|
|
66
|
+
}),
|
|
67
|
+
|
|
63
68
|
...timestamps,
|
|
64
69
|
},
|
|
65
70
|
(t) => [
|
|
@@ -68,6 +73,7 @@ export const agents = pgTable(
|
|
|
68
73
|
index('agents_user_id_idx').on(t.userId),
|
|
69
74
|
index('agents_title_idx').on(t.title),
|
|
70
75
|
index('agents_description_idx').on(t.description),
|
|
76
|
+
index('agents_session_group_id_idx').on(t.sessionGroupId),
|
|
71
77
|
],
|
|
72
78
|
);
|
|
73
79
|
|