Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
files
Vasek Mlejnskya85b45d3ffe0
diff --git a/components/AgentLogsList.tsx b/components/AgentLogsList.tsxindex 0aae0ed9f..0f0889b46 100644--- a/components/AgentLogsList.tsx+++ b/components/AgentLogsList.tsx@@ -1,18 +1,69 @@+import {+ useState,+} from 'react'+import {+ File,+} from 'lucide-react'+import clsx from 'clsx'+import { useRouter } from 'next/router'+import { LogFile } from 'utils/agentLogs'export interface Props {logFiles: LogFile[]+ initialSelectedLogFileID?: string}-function AgentLogsList() {+function AgentLogsList({+ logFiles,+ initialSelectedLogFileID,+}: Props) {+ const router = useRouter()+ const [selectedLogFileID, setSelectedLogFileID] = useState(initialSelectedLogFileID || '')++ function toggleSelectedLogFileID(projectID: string) {+ if (selectedLogFileID === projectID) {+ setSelectedLogFileID('')+ router.push('/?view=logs', undefined, { shallow: true })+ } else {+ setSelectedLogFileID(projectID)+ router.push(`/?view=logs&fileID=${projectID}`, undefined, { shallow: true })+ }+ }+return (<main className="overflow-hidden flex flex-col max-h-full"><header className="flex items-center justify-between p-4 sm:p-6 lg:px-8">- <h1 className="text-2xl font-semibold leading-7 text-white">Agent Logs</h1>+ <h1 className="text-2xl font-semibold leading-7 text-white">Log Files</h1></header>-- </main>+ <div className="flex flex-col space-y-4 p-4 sm:p-6 lg:px-8">+ {logFiles.map((logFile, i) => (+ <div+ key={logFile.id}+ className={clsx(+ 'flex items-center space-x-2 p-2 cursor-pointer hover:bg-gray-700 transition-all rounded-md',+ selectedLogFileID === logFile.id && 'bg-gray-700',+ selectedLogFileID !== logFile.id && 'bg-gray-800',+ )}+ onClick={() => toggleSelectedLogFileID(logFile.id)}+ >+ <File size={14} className="text-gray-500" />+ <span+ className={clsx(+ 'text-sm',+ 'cursor-pointer',+ 'font-semibold',+ selectedLogFileID === logFile.id && 'font-semibold',+ )}+ onClick={() => toggleSelectedLogFileID(logFile.id)}+ >+ {logFile.name}.json+ </span>+ </div>+ ))}+ </div>+ </main >)}diff --git a/components/DashboardHome.tsx b/components/DashboardHome.tsxindex 5dc6e5b18..fadc41bc9 100644--- a/components/DashboardHome.tsx+++ b/components/DashboardHome.tsx@@ -10,6 +10,7 @@ import { useSupabaseClient } from '@supabase/auth-helpers-react'import { deployments, projects } from 'db/prisma'import AgentList from 'components/AgentList'import AgentRunsList from 'components/AgentRunsList'+import AgentLogsList from 'components/AgentLogsList'export interface Props {@@ -26,6 +27,7 @@ function DashboardHome({const view = router.query.view as string | undefinedconst selectedAgentInstanceID = router.query.projectID as string | undefined+ const selectedLogFileID = router.query.fileID as string | undefinedasync function signOut() {await supabaseClient.auth.signOut()@@ -66,9 +68,12 @@ function DashboardHome({initialSelectedAgentID={selectedAgentInstanceID}/>) : view === 'logs' ? (- <AgentRunsList- allDeployedAgents={projectsWithDeployments}- initialSelectedAgentID={selectedAgentInstanceID}+ <AgentLogsList+ logFiles={[+ { name: '0', id: 'id-0' },+ { name: '1', id: 'id-1' },+ ]}+ initialSelectedLogFileID={selectedLogFileID}/>) : (<span>404</span>diff --git a/pages/index.tsx b/pages/index.tsxindex ad422b09e..87842114e 100644--- a/pages/index.tsx+++ b/pages/index.tsx@@ -88,7 +88,8 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {let redirect: Redirect | undefinedif (!view) {redirect = {- destination: '/?view=deployed',+ // destination: '/?view=deployed',+ destination: '/?view=logs',permanent: false,}}