Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Ensure we return only the last two dirs and the filename for each log file as the relativePath
Tomas Valenta29b37e315d51
diff --git a/pages/index.tsx b/pages/index.tsxindex ef8aef40a..376aa4275 100644--- a/pages/index.tsx+++ b/pages/index.tsx@@ -1,12 +1,23 @@import type { GetServerSideProps } from 'next'import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'import { nanoid } from 'nanoid'+import path from 'path'import { prisma, projects, deployments } from 'db/prisma'import { serverCreds } from 'db/credentials'import DashboardHome from 'components/DashboardHome'import { LiteLogUpload } from 'utils/agentLogs'+function getLastTwoDirsAndFile(fullPath: string): string {+ const fileName = path.basename(fullPath)+ const dirName = path.dirname(fullPath)++ const parts = dirName.split(path.sep)+ const lastTwoDirs = parts.slice(-2).join(path.sep)++ return path.join(lastTwoDirs, fileName)+}+export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {// Select the 'deployed' view by default.const view = ctx.query['view'] as string@@ -176,6 +187,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {log_files: u.log_files.map(f => ({...f,content: undefined,+ relativePath: getLastTwoDirsAndFile(f.relativePath),})),}))}))