Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Cleanup

Tomas Valenta5ce366ed5947
diff --git a/components/AgentLogFileContent.tsx b/components/AgentLogFileContent.tsx
index f2dde9680..6271f69ac 100644
--- a/components/AgentLogFileContent.tsx
+++ b/components/AgentLogFileContent.tsx
@@ -18,7 +18,7 @@ import AgentPromptLogsList from 'components/AgentPromptLogsList'
import AgentNextActionLogDetail from 'components/AgentNextActionLogDetail'
export interface Props {
- logFile?: Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content'> & { content: AgentPromptLogs | AgentNextActionLog }
+ logFile?: Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content' | 'last_modified'> & { content: AgentPromptLogs | AgentNextActionLog }
}
function AgentLogFileContent({
diff --git a/components/AgentLogFilesList.tsx b/components/AgentLogFilesList.tsx
index 820c8df84..1060dc3aa 100644
--- a/components/AgentLogFilesList.tsx
+++ b/components/AgentLogFilesList.tsx
@@ -34,7 +34,7 @@ function AgentLogFilesList({
const getLogFile = useGetLogFile()
const [isUploading, setIsUploading] = useState(false)
const [openedLogUploads, setOpeneLogUploads] = useState<string[]>([])
- const [selectedLogFile, setSelectedLogFile] = useState<Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content'> & { content: AgentPromptLogs | AgentNextActionLog }>()
+ const [selectedLogFile, setSelectedLogFile] = useState<Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content' | 'last_modified'> & { content: AgentPromptLogs | AgentNextActionLog }>()
const router = useRouter()
const fileInput = useRef<HTMLInputElement>(null)
const uploadFiles = useUploadLogs(defaultProjectID)
diff --git a/pages/api/log_file/[:logFileID].ts b/pages/api/log_file/[:logFileID].ts
deleted file mode 100644
index cae1b63b5..000000000
--- a/pages/api/log_file/[:logFileID].ts
+++ /dev/null
@@ -1,99 +0,0 @@
-import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
-import { NextApiRequest, NextApiResponse } from 'next'
-
-import { prisma } from 'db/prisma'
-import { serverCreds } from 'db/credentials'
-
-async function getLog(req: NextApiRequest, res: NextApiResponse) {
- let {
- ':logFileID': logFileID,
- } = req.query
-
- console.log('getting log >>>>')
-
- try {
- if (!logFileID) {
- res.status(400).json({ statusCode: 400, message: 'Missing log ID in URL' })
- return
- }
- logFileID = logFileID as string
-
- const supabase = createServerSupabaseClient({ req, res }, serverCreds)
- const { data: { session } } = await supabase.auth.getSession()
- if (!session) {
- return res.status(401).json({
- error: 'not_authenticated',
- description: 'The user does not have an active session or is not authenticated',
- })
- }
-
- const user = await prisma.auth_users.findUnique({
- where: {
- id: session.user.id,
- },
- include: {
- users_teams: {
- include: {
- teams: {
- include: {
- projects: {
- include: {
- log_files: {
- where: {
- id: logFileID,
- },
- }
- },
- },
- },
- },
- },
- },
- },
- })
-
- if (!user) {
- return res.status(401).json({
- error: 'invalid_user',
- })
- }
-
- const hasAccessToLogs = user
- .users_teams
- .flatMap(t => t.teams.projects)
- .flatMap(p => p.log_files)
- .some(l => l.id === logFileID)
-
- if (!hasAccessToLogs) {
- return res.status(401).json({
- error: 'logs_does_not_belong_to_user',
- })
- }
-
- const logFile = await prisma.log_files.findUnique({
- where: {
- id: logFileID,
- },
- })
- res.status(200).json(logFile)
- } catch (err: any) {
- console.error(err)
- res.status(500).json({ statusCode: 500, message: err.message })
- }
-}
-
-async function handler(
- req: NextApiRequest,
- res: NextApiResponse,
-) {
- if (req.method === 'GET') {
- await getLog(req, res)
- return
- }
-
- res.setHeader('Allow', ['GET'])
- res.status(405).json({ statusCode: 405, message: 'Method Not Allowed' })
- return
-}
-
-export default handler
diff --git a/pages/index.tsx b/pages/index.tsx
index 56d682e85..0e83e1da1 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -18,7 +18,7 @@ function getLastTwoDirsAndFile(fullPath: string): string {
return path.join(lastTwoDirs, fileName)
}
-function formatLogFileContent(logFile: Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id'>) {
+function formatLogFileContent(logFile: Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'last_modified'>) {
const parsedFileContent = JSON.parse(logFile.content)
const relativePath = getLastTwoDirsAndFile(logFile.relativePath)
@@ -102,7 +102,6 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
id: true,
created_at: true,
filename: true,
- last_modified: true,
relativePath: true,
content: true,
},
diff --git a/utils/agentLogs.ts b/utils/agentLogs.ts
index 827630890..946354107 100644
--- a/utils/agentLogs.ts
+++ b/utils/agentLogs.ts
@@ -1,7 +1,7 @@
import { log_files, log_uploads } from 'db/prisma'
export interface LiteLogUpload extends Omit<log_uploads, 'log_files' | 'project_id'> {
- log_files: (Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content'> & { content: AgentPromptLogs | AgentNextActionLog })[]
+ log_files: (Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content' | 'last_modified'> & { content: AgentPromptLogs | AgentNextActionLog })[]
}
export interface AgentPromptLogs {