From bc5af5ff3ba68d5645104143aac22c2a5a54b617 Mon Sep 17 00:00:00 2001 From: bh0fer Date: Sun, 31 Aug 2025 11:06:19 +0000 Subject: [PATCH] undo ai-features --- package.json | 1 - .../migration.sql | 21 +++++++++ prisma/schema.prisma | 44 ------------------- yarn.lock | 5 --- 4 files changed, 21 insertions(+), 50 deletions(-) create mode 100644 prisma/migrations/20250831110041_revert_ai_changes/migration.sql diff --git a/package.json b/package.json index 2d4137f..81f150b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "global": "^4.4.0", "lodash": "^4.17.21", "morgan": "^1.10.0", - "openai": "^5.0.1", "passport": "^0.7.0", "passport-azure-ad": "^4.3.5", "socket.io": "^4.8.1", diff --git a/prisma/migrations/20250831110041_revert_ai_changes/migration.sql b/prisma/migrations/20250831110041_revert_ai_changes/migration.sql new file mode 100644 index 0000000..4a74fbf --- /dev/null +++ b/prisma/migrations/20250831110041_revert_ai_changes/migration.sql @@ -0,0 +1,21 @@ +/* + Warnings: + + - You are about to drop the `ai_requests` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `ai_templates` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "ai_requests" DROP CONSTRAINT "ai_requests_ai_template_id_fkey"; + +-- DropForeignKey +ALTER TABLE "ai_requests" DROP CONSTRAINT "ai_requests_user_id_fkey"; + +-- DropForeignKey +ALTER TABLE "ai_templates" DROP CONSTRAINT "ai_templates_author_id_fkey"; + +-- DropTable +DROP TABLE "ai_requests"; + +-- DropTable +DROP TABLE "ai_templates"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d56a405..2c4dbeb 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -28,54 +28,10 @@ model User { view_AllDocumentUserPermissions view_AllDocumentUserPermissions[] cmsSettings CmsSettings? studentGroups UserStudentGroup[] @relation("user_student_groups") - aiRequests AiRequest[] - aiTemplates AiTemplate[] @relation("ai_templates") @@map("users") } -model AiTemplate { - id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - - author User @relation("ai_templates", fields: [authorId], references: [id], onDelete: Cascade) - authorId String @map("author_id") @db.Uuid - rateLimit Int @default(0) @map("rate_limit") - rateLimitPeriodMs BigInt @default(3600000) @map("rate_limit_period_ms") // Default to 1 hour - isActive Boolean @default(true) @map("is_active") - - apiKey String @map("api_key") - apiUrl String @map("api_url") - - config Json @map("config") // Configuration for the AI template, e.g., model, parameters - - aiRequests AiRequest[] - - createdAt DateTime @default(now()) @map("created_at") - updatedAt DateTime @default(now()) @updatedAt @map("updated_at") - - @@map("ai_templates") -} - -model AiRequest { - id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - user User @relation(fields: [userId], references: [id], onDelete: Cascade) - userId String @map("user_id") @db.Uuid - - aiTemplate AiTemplate @relation(fields: [aiTemplateId], references: [id], onDelete: Cascade) - aiTemplateId String @map("ai_template_id") @db.Uuid - - status String @default("pending") // pending, completed, failed - statusCode Int? @map("status_code") - - request String - response Json - - createdAt DateTime @default(now()) @map("created_at") - updatedAt DateTime @default(now()) @updatedAt @map("updated_at") - - @@map("ai_requests") -} - model CmsSettings { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid user User @relation(fields: [userId], references: [id], onDelete: Cascade) diff --git a/yarn.lock b/yarn.lock index ffe3779..9b4a997 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4903,11 +4903,6 @@ open@7.4.2: is-docker "^2.0.0" is-wsl "^2.1.1" -openai@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/openai/-/openai-5.0.1.tgz#c7cabc4cb13554f8506158364566c16514d051fe" - integrity sha512-Do6vxhbDv7cXhji/4ct1lrpZYMAOmjYbhyA9LJTuG7OfpbWMpuS+EIXkRT7R+XxpRB1OZhU/op4FU3p3uxU6gw== - p-filter@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-filter/-/p-filter-2.1.0.tgz#1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c"