Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Change DB model

Tomas Valentac69a30f99d0c
diff --git a/components/AgentLogFilesList.tsx b/components/AgentLogFilesList.tsx
index 7eff14725..3acf6b979 100644
--- a/components/AgentLogFilesList.tsx
+++ b/components/AgentLogFilesList.tsx
@@ -97,7 +97,7 @@ function AgentLogFilesList({
}
async function handleUpload(files: FileList) {
- const logFiles: Pick<log_files, 'content' | 'filename' | 'relativePath' | 'size' | 'last_modified' | 'type'>[] = []
+ const logFiles: Pick<log_files, 'content' | 'filename' | 'relativePath' | 'last_modified'>[] = []
for (let i = 0; i < files.length; i++) {
const file = files[i]
@@ -108,10 +108,8 @@ function AgentLogFilesList({
logFiles.push({
filename: file.name,
relativePath: file.webkitRelativePath,
- type: file.type,
content,
last_modified: new Date(file.lastModified),
- size: file.size,
})
}
diff --git a/hooks/useUploadLogUpload.ts b/hooks/useUploadLogUpload.ts
index c8d94a3ac..b6e82fd60 100644
--- a/hooks/useUploadLogUpload.ts
+++ b/hooks/useUploadLogUpload.ts
@@ -2,7 +2,7 @@ import { log_files } from 'db/prisma'
import { useCallback } from 'react'
import useSWRMutation from 'swr/mutation'
-export interface FileUpload extends Pick<log_files, 'content' | 'filename' | 'relativePath' | 'size' | 'last_modified' | 'type'> { }
+export interface FileUpload extends Pick<log_files, 'content' | 'filename' | 'relativePath' | 'last_modified'> { }
export interface PostLogUpload {
logFiles: FileUpload[]
diff --git a/pages/index.tsx b/pages/index.tsx
index 94e69789c..405bb8fb5 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -13,7 +13,6 @@ export interface Props {
defaultProjectID: string
}
-
function getLastTwoDirsAndFile(fullPath: string): string {
const fileName = path.basename(fullPath)
const dirName = path.dirname(fullPath)
@@ -24,7 +23,7 @@ function getLastTwoDirsAndFile(fullPath: string): string {
return path.join(lastTwoDirs, fileName)
}
-function formatLogFileContent(logFile: Omit<log_files, 'project_id' | 'type' | 'size' | 'last_modified'>) {
+function formatLogFileContent(logFile: Omit<log_files, 'project_id' | 'type' | 'size' | 'last_modified' | 'deployment_id'>) {
const relativePath = getLastTwoDirsAndFile(logFile.relativePath)
if (logFile.filename.includes('user_input')) {
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 640fb1257..961802a3a 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -269,6 +269,7 @@ model deployments {
auth Json?
last_finished_prompt String?
projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
+ log_files log_files[]
@@schema("public")
}
@@ -322,18 +323,18 @@ model feedback {
/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
model log_files {
- id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
- created_at DateTime @default(now()) @db.Timestamptz(6)
- content String @default("")
- filename String
- size Int
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+ created_at DateTime @default(now()) @db.Timestamptz(6)
+ content String @default("")
+ filename String @default("")
relativePath String
- last_modified DateTime @db.Timestamptz(6)
+ last_modified DateTime @db.Timestamptz(6)
project_id String
- log_upload_id String @db.Uuid
- type String?
- log_upload log_uploads @relation(fields: [log_upload_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
- projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
+ log_upload_id String? @db.Uuid
+ deployment_id String? @db.Uuid
+ deployments deployments? @relation(fields: [deployment_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
+ log_upload log_uploads? @relation(fields: [log_upload_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
+ projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
@@schema("public")
}
diff --git a/utils/agentLogs.ts b/utils/agentLogs.ts
index a8ef8d3db..9c934c7dc 100644
--- a/utils/agentLogs.ts
+++ b/utils/agentLogs.ts
@@ -1,6 +1,6 @@
import { log_files, log_uploads } from 'db/prisma'
-export interface LiteLogFile extends Omit<log_files, 'project_id' | 'type' | 'size' | 'content' | 'last_modified'> {
+export interface LiteLogFile extends Omit<log_files, 'project_id' | 'type' | 'size' | 'content' | 'last_modified' | 'deployment_id'> {
content: AgentPromptLogs | AgentNextActionLog | string
}