From f4160e081ccea671109daa331183b07fe7e5317e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daphn=C3=A9=20Popin?= Date: Wed, 6 Sep 2023 17:54:52 +0200 Subject: [PATCH] Assistant: Add missing CreationOptional id/createdAt/updatedAt in config models (#1290) --- .../lib/models/assistant/actions/retrieval.ts | 29 +++++++++++++++++-- front/lib/models/assistant/agent.ts | 29 +++++++++++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/front/lib/models/assistant/actions/retrieval.ts b/front/lib/models/assistant/actions/retrieval.ts index 5121a796e941..5593af5d3f56 100644 --- a/front/lib/models/assistant/actions/retrieval.ts +++ b/front/lib/models/assistant/actions/retrieval.ts @@ -1,4 +1,5 @@ import { + CreationOptional, DataTypes, ForeignKey, InferAttributes, @@ -18,7 +19,9 @@ export class AgentRetrievalConfiguration extends Model< InferAttributes, InferCreationAttributes > { - declare id: number; + declare id: CreationOptional; + declare createdAt: CreationOptional; + declare updatedAt: CreationOptional; declare query: "auto" | "none" | "templated"; declare queryTemplate: string | null; @@ -36,6 +39,16 @@ AgentRetrievalConfiguration.init( autoIncrement: true, primaryKey: true, }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, query: { type: DataTypes.STRING, allowNull: false, @@ -100,7 +113,9 @@ export class AgentDataSourceConfiguration extends Model< InferAttributes, InferCreationAttributes > { - declare id: number; + declare id: CreationOptional; + declare createdAt: CreationOptional; + declare updatedAt: CreationOptional; declare minTimestamp: number | null; declare maxTimestamp: number | null; @@ -124,6 +139,16 @@ AgentDataSourceConfiguration.init( autoIncrement: true, primaryKey: true, }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, minTimestamp: { type: DataTypes.INTEGER, allowNull: true, diff --git a/front/lib/models/assistant/agent.ts b/front/lib/models/assistant/agent.ts index dcda67f5b35c..c10393cceac4 100644 --- a/front/lib/models/assistant/agent.ts +++ b/front/lib/models/assistant/agent.ts @@ -1,4 +1,5 @@ import { + CreationOptional, DataTypes, ForeignKey, InferAttributes, @@ -21,7 +22,9 @@ export class AgentConfiguration extends Model< InferAttributes, InferCreationAttributes > { - declare id: number; + declare id: CreationOptional; + declare createdAt: CreationOptional; + declare updatedAt: CreationOptional; declare sId: string; declare status: AgentConfigurationStatus; @@ -40,6 +43,16 @@ AgentConfiguration.init( autoIncrement: true, primaryKey: true, }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, sId: { type: DataTypes.STRING, allowNull: false, @@ -95,7 +108,9 @@ export class AgentGenerationConfiguration extends Model< InferAttributes, InferCreationAttributes > { - declare id: number; + declare id: CreationOptional; + declare createdAt: CreationOptional; + declare updatedAt: CreationOptional; declare prompt: string; declare modelProvider: string; @@ -110,6 +125,16 @@ AgentGenerationConfiguration.init( autoIncrement: true, primaryKey: true, }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: DataTypes.NOW, + }, prompt: { type: DataTypes.TEXT, allowNull: false,