Feature/Indexing (#1802)

* indexing

* fix for multiple files upsert

* fix default Postgres port

* fix SQLite node description

* add MySQLRecordManager node

* fix MySQL unique index

* add upsert history

* update jsx ui

* lint-fix

* update dialog details

* update llamaindex pinecone

---------

Co-authored-by: chungyau97 <chungyau97@gmail.com>
This commit is contained in:
Henry Heng
2024-04-02 23:47:19 +01:00
committed by GitHub
parent 957694a912
commit e422ce287b
67 changed files with 3006 additions and 246 deletions
@@ -10,7 +10,7 @@ export class Assistant implements IAssistant {
@Column({ type: 'text' })
details: string
@Column({ type: 'uuid'})
@Column({ type: 'uuid' })
credential: string
@Column({ nullable: true })
@@ -34,11 +34,11 @@ export class ChatFlow implements IChatFlow {
@Column({ nullable: true, type: 'text' })
speechToText?: string
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@UpdateDateColumn()
updatedDate: Date
@@ -41,7 +41,7 @@ export class ChatMessage implements IChatMessage {
@Column({ type: 'varchar', nullable: true })
sessionId?: string
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
}
@@ -25,7 +25,7 @@ export class ChatMessageFeedback implements IChatMessageFeedback {
@Column({ nullable: true, type: 'text' })
content?: string
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
}
@@ -16,11 +16,11 @@ export class Credential implements ICredential {
@Column({ type: 'text' })
encryptedData: string
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@UpdateDateColumn()
updatedDate: Date
}
@@ -25,11 +25,11 @@ export class Tool implements ITool {
@Column({ nullable: true, type: 'text' })
func?: string
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@UpdateDateColumn()
updatedDate: Date
}
@@ -0,0 +1,22 @@
/* eslint-disable */
import { Entity, Column, PrimaryGeneratedColumn, Index, CreateDateColumn } from 'typeorm'
import { IUpsertHistory } from '../../Interface'
@Entity()
export class UpsertHistory implements IUpsertHistory {
@PrimaryGeneratedColumn('uuid')
id: string
@Index()
@Column()
chatflowid: string
@Column()
result: string
@Column()
flowData: string
@CreateDateColumn()
date: Date
}
@@ -16,11 +16,11 @@ export class Variable implements IVariable {
@Column({ default: 'string', type: 'text' })
type: string
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
@Column({type:'timestamp'})
@Column({ type: 'timestamp' })
@UpdateDateColumn()
updatedDate: Date
}
@@ -5,6 +5,7 @@ import { Credential } from './Credential'
import { Tool } from './Tool'
import { Assistant } from './Assistant'
import { Variable } from './Variable'
import { UpsertHistory } from './UpsertHistory'
export const entities = {
ChatFlow,
@@ -13,5 +14,6 @@ export const entities = {
Credential,
Tool,
Assistant,
Variable
Variable,
UpsertHistory
}
@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddUpsertHistoryEntity1709814301358 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE IF NOT EXISTS \`upsert_history\` (
\`id\` varchar(36) NOT NULL,
\`chatflowid\` varchar(255) NOT NULL,
\`result\` text NOT NULL,
\`flowData\` text NOT NULL,
\`date\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
PRIMARY KEY (\`id\`)
KEY \`IDX_a0b59fd66f6e48d2b198123cb6\` (\`chatflowid\`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE upsert_history`)
}
}
@@ -13,6 +13,7 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad
import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage'
import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity'
import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText'
import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity'
import { AddFeedback1707213626553 } from './1707213626553-AddFeedback'
export const mysqlMigrations = [
@@ -31,5 +32,6 @@ export const mysqlMigrations = [
AddFileUploadsToChatMessage1701788586491,
AddVariableEntity1699325775451,
AddSpeechToText1706364937060,
AddUpsertHistoryEntity1709814301358,
AddFeedback1707213626553
]
@@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddUpsertHistoryEntity1709814301358 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE IF NOT EXISTS upsert_history (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
"chatflowid" varchar NOT NULL,
"result" text NOT NULL,
"flowData" text NOT NULL,
"date" timestamp NOT NULL DEFAULT now(),
CONSTRAINT "PK_37327b22b6e246319bd5eeb0e88" PRIMARY KEY (id)
);`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE upsert_history`)
}
}
@@ -13,6 +13,7 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad
import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage'
import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity'
import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText'
import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity'
import { AddFeedback1707213601923 } from './1707213601923-AddFeedback'
import { FieldTypes1710497452584 } from './1710497452584-FieldTypes'
@@ -32,6 +33,7 @@ export const postgresMigrations = [
AddFileUploadsToChatMessage1701788586491,
AddVariableEntity1699325775451,
AddSpeechToText1706364937060,
AddUpsertHistoryEntity1709814301358,
AddFeedback1707213601923,
FieldTypes1710497452584
]
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddUpsertHistoryEntity1709814301358 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE IF NOT EXISTS "upsert_history" ("id" varchar PRIMARY KEY NOT NULL, "chatflowid" varchar NOT NULL, "result" text NOT NULL, "flowData" text NOT NULL, "date" datetime NOT NULL DEFAULT (datetime('now')));`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE upsert_history`)
}
}
@@ -13,6 +13,7 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad
import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage'
import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity'
import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText'
import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity'
import { AddFeedback1707213619308 } from './1707213619308-AddFeedback'
export const sqliteMigrations = [
@@ -31,5 +32,6 @@ export const sqliteMigrations = [
AddFileUploadsToChatMessage1701788586491,
AddVariableEntity1699325775451,
AddSpeechToText1706364937060,
AddUpsertHistoryEntity1709814301358,
AddFeedback1707213619308
]