@infuro/cms-core 1.0.7 → 1.0.8
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/dist/admin.cjs +270 -41
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +3 -1
- package/dist/admin.d.ts +3 -1
- package/dist/admin.js +304 -75
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +131 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +131 -1
- package/dist/api.js.map +1 -1
- package/dist/{index-BPnATEXW.d.cts → index-P5ajDo8-.d.cts} +9 -0
- package/dist/{index-BPnATEXW.d.ts → index-P5ajDo8-.d.ts} +9 -0
- package/dist/index.cjs +699 -263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -3
- package/dist/index.d.ts +91 -3
- package/dist/index.js +682 -252
- package/dist/index.js.map +1 -1
- package/dist/migrations/1731800000000-ChatAndKnowledgeBase.ts +39 -0
- package/dist/migrations/1731900000000-KnowledgeBaseVector.ts +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
export class ChatAndKnowledgeBase1731800000000 implements MigrationInterface {
|
|
4
|
+
name = 'ChatAndKnowledgeBase1731800000000';
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "knowledge_base_documents" ("id" SERIAL NOT NULL, "name" character varying NOT NULL, "sourceUrl" character varying, "content" text NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_knowledge_base_documents" PRIMARY KEY ("id"))`
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE TABLE "knowledge_base_chunks" ("id" SERIAL NOT NULL, "documentId" integer NOT NULL, "content" text NOT NULL, "chunkIndex" integer NOT NULL DEFAULT 0, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_knowledge_base_chunks" PRIMARY KEY ("id"))`
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE TABLE "chat_conversations" ("id" SERIAL NOT NULL, "contactId" integer NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_chat_conversations" PRIMARY KEY ("id"))`
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE TABLE "chat_messages" ("id" SERIAL NOT NULL, "conversationId" integer NOT NULL, "role" character varying NOT NULL, "content" text NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_chat_messages" PRIMARY KEY ("id"))`
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "knowledge_base_chunks" ADD CONSTRAINT "FK_knowledge_base_chunks_document" FOREIGN KEY ("documentId") REFERENCES "knowledge_base_documents"("id") ON DELETE CASCADE ON UPDATE NO ACTION`
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "chat_conversations" ADD CONSTRAINT "FK_chat_conversations_contact" FOREIGN KEY ("contactId") REFERENCES "contacts"("id") ON DELETE CASCADE ON UPDATE NO ACTION`
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "chat_messages" ADD CONSTRAINT "FK_chat_messages_conversation" FOREIGN KEY ("conversationId") REFERENCES "chat_conversations"("id") ON DELETE CASCADE ON UPDATE NO ACTION`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
31
|
+
await queryRunner.query(`ALTER TABLE "chat_messages" DROP CONSTRAINT "FK_chat_messages_conversation"`);
|
|
32
|
+
await queryRunner.query(`ALTER TABLE "chat_conversations" DROP CONSTRAINT "FK_chat_conversations_contact"`);
|
|
33
|
+
await queryRunner.query(`ALTER TABLE "knowledge_base_chunks" DROP CONSTRAINT "FK_knowledge_base_chunks_document"`);
|
|
34
|
+
await queryRunner.query(`DROP TABLE "chat_messages"`);
|
|
35
|
+
await queryRunner.query(`DROP TABLE "chat_conversations"`);
|
|
36
|
+
await queryRunner.query(`DROP TABLE "knowledge_base_chunks"`);
|
|
37
|
+
await queryRunner.query(`DROP TABLE "knowledge_base_documents"`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
/** Requires pgvector extension: CREATE EXTENSION vector; (run manually if migration fails). */
|
|
4
|
+
export class KnowledgeBaseVector1731900000000 implements MigrationInterface {
|
|
5
|
+
name = 'KnowledgeBaseVector1731900000000';
|
|
6
|
+
|
|
7
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
8
|
+
await queryRunner.query(`CREATE EXTENSION IF NOT EXISTS vector`);
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "knowledge_base_chunks" ADD COLUMN IF NOT EXISTS "embedding" vector(1536)`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
15
|
+
await queryRunner.query(`ALTER TABLE "knowledge_base_chunks" DROP COLUMN IF EXISTS "embedding"`);
|
|
16
|
+
}
|
|
17
|
+
}
|