Feature/Custom Assistant Builder (#3631)

* add custom assistant builder

* add tools to custom assistant

* add save assistant button
This commit is contained in:
Henry Heng
2024-12-06 22:11:17 +00:00
committed by GitHub
parent e02045285f
commit fe2ed26999
46 changed files with 3134 additions and 221 deletions
@@ -1,6 +1,6 @@
/* eslint-disable */
import { Entity, Column, CreateDateColumn, UpdateDateColumn, PrimaryGeneratedColumn } from 'typeorm'
import { IAssistant } from '../../Interface'
import { AssistantType, IAssistant } from '../../Interface'
@Entity()
export class Assistant implements IAssistant {
@@ -16,6 +16,9 @@ export class Assistant implements IAssistant {
@Column({ nullable: true })
iconSrc?: string
@Column({ nullable: true, type: 'text' })
type?: AssistantType
@Column({ type: 'timestamp' })
@CreateDateColumn()
createdDate: Date
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToAssistant1733011290987 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('assistant', 'type')
if (!columnExists) {
await queryRunner.query(`ALTER TABLE \`assistant\` ADD COLUMN \`type\` TEXT;`)
await queryRunner.query(`UPDATE \`assistant\` SET \`type\` = 'OPENAI';`)
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`assistant\` DROP COLUMN \`type\`;`)
}
}
@@ -27,6 +27,7 @@ import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn'
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
import { AddFollowUpPrompts1726666318346 } from './1726666318346-AddFollowUpPrompts'
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
export const mariadbMigrations = [
Init1693840429259,
@@ -57,5 +58,6 @@ export const mariadbMigrations = [
LongTextColumn1722301395521,
AddCustomTemplate1725629836652,
AddArtifactsToChatMessage1726156258465,
AddFollowUpPrompts1726666318346
AddFollowUpPrompts1726666318346,
AddTypeToAssistant1733011290987
]
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToAssistant1733011290987 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('assistant', 'type')
if (!columnExists) {
await queryRunner.query(`ALTER TABLE \`assistant\` ADD COLUMN \`type\` TEXT;`)
await queryRunner.query(`UPDATE \`assistant\` SET \`type\` = 'OPENAI';`)
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`assistant\` DROP COLUMN \`type\`;`)
}
}
@@ -27,6 +27,7 @@ import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn'
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
import { AddFollowUpPrompts1726666302024 } from './1726666302024-AddFollowUpPrompts'
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
export const mysqlMigrations = [
Init1693840429259,
@@ -57,5 +58,6 @@ export const mysqlMigrations = [
LongTextColumn1722301395521,
AddCustomTemplate1725629836652,
AddArtifactsToChatMessage1726156258465,
AddFollowUpPrompts1726666302024
AddFollowUpPrompts1726666302024,
AddTypeToAssistant1733011290987
]
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToAssistant1733011290987 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('assistant', 'type')
if (!columnExists) {
await queryRunner.query(`ALTER TABLE "assistant" ADD COLUMN "type" TEXT;`)
await queryRunner.query(`UPDATE "assistant" SET "type" = 'OPENAI';`)
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "assistant" DROP COLUMN "type";`)
}
}
@@ -27,6 +27,7 @@ import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionTo
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
import { AddFollowUpPrompts1726666309552 } from './1726666309552-AddFollowUpPrompts'
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
export const postgresMigrations = [
Init1693891895163,
@@ -57,5 +58,6 @@ export const postgresMigrations = [
AddActionToChatMessage1721078251523,
AddCustomTemplate1725629836652,
AddArtifactsToChatMessage1726156258465,
AddFollowUpPrompts1726666309552
AddFollowUpPrompts1726666309552,
AddTypeToAssistant1733011290987
]
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTypeToAssistant1733011290987 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('assistant', 'type')
if (!columnExists) {
await queryRunner.query(`ALTER TABLE "assistant" ADD COLUMN "type" TEXT;`)
await queryRunner.query(`UPDATE "assistant" SET "type" = 'OPENAI';`)
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "assistant" DROP COLUMN "type";`)
}
}
@@ -26,6 +26,7 @@ import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionTo
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
import { AddFollowUpPrompts1726666294213 } from './1726666294213-AddFollowUpPrompts'
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
export const sqliteMigrations = [
Init1693835579790,
@@ -55,5 +56,6 @@ export const sqliteMigrations = [
AddActionToChatMessage1721078251523,
AddArtifactsToChatMessage1726156258465,
AddCustomTemplate1725629836652,
AddFollowUpPrompts1726666294213
AddFollowUpPrompts1726666294213,
AddTypeToAssistant1733011290987
]