Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 21 additions & 0 deletions prisma/migrations/20250831110041_revert_ai_changes/migration.sql
Original file line number Diff line number Diff line change
@@ -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";
44 changes: 0 additions & 44 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4903,11 +4903,6 @@ [email protected]:
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==

[email protected]:
version "2.1.0"
resolved "https://registry.yarnpkg.com/p-filter/-/p-filter-2.1.0.tgz#1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c"
Expand Down