Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Prepare the runs view

Vasek Mlejnsky651865b7951f
diff --git a/components/AgentList.tsx b/components/AgentList.tsx
index 47a160f6f..0fbb6d6d8 100644
--- a/components/AgentList.tsx
+++ b/components/AgentList.tsx
@@ -4,7 +4,6 @@ import Link from 'next/link'
import { projects, deployments } from 'db/prisma'
export interface Props {
-
agents: {
project: projects & {
deployments: deployments[];
@@ -24,14 +23,13 @@ function AgentList({
<h1 className="text-2xl font-semibold leading-7 text-white">Deployed Agents</h1>
</header>
- {/* Deployment list */}
<ul role="list" className="px-4 sm:px-6 lg:px-8 space-y-4 overflow-auto">
{agents.map(a => (
<li
key={a.project.id}
>
<Link
- href={`deployed/${a.project.id}`}
+ href={`/?view=runs&projectID=${a.project.id}`}
onClick={(e) => onSelectAgent(e, a.project.id)}
>
<AgentListItem
diff --git a/components/AgentRunsList.tsx b/components/AgentRunsList.tsx
new file mode 100644
index 000000000..095ac8f4a
--- /dev/null
+++ b/components/AgentRunsList.tsx
@@ -0,0 +1,34 @@
+import { deployments, projects } from 'db/prisma'
+
+
+export interface Props {
+ agentInstance: (projects & { deployments: deployments[] })
+}
+
+function AgentRunsList({
+ agentInstance,
+}: Props) {
+ console.log('agentInstance', agentInstance)
+ // TODO: We'll have a better concept for run, challenge, task, benchmark, etc
+ // once we give access to the AutoGPT team. Let's start with a simple version first.
+ // At the moment, a run is just an array of logs with the same run ID.
+ const runs = agentInstance.deployments.reduce((acc, d) => {
+
+ return acc
+ }, [])
+
+
+ return (
+ <main className="overflow-hidden">
+ <header className="flex items-center justify-between border-b border-white/5 p-4 sm:p-6 lg:px-8">
+ <h1 className="text-2xl font-semibold leading-7 text-white">{agentInstance.name}</h1>
+ </header>
+
+ <ul role="list" className="px-4 sm:px-6 lg:px-8 space-y-4 overflow-auto">
+
+ </ul>
+ </main>
+ )
+}
+
+export default AgentRunsList
\ No newline at end of file
diff --git a/pages/index.tsx b/pages/index.tsx
index 5e90bf45e..706e55921 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -17,6 +17,7 @@ import { useSupabaseClient } from '@supabase/auth-helpers-react'
import { deployments, prisma, projects } from 'db/prisma'
import { serverCreds } from 'db/credentials'
import AgentList from 'components/AgentList'
+import AgentRunsList from 'components/AgentRunsList'
const navigation = [
{
@@ -127,6 +128,8 @@ function Home({ projects }: Props) {
const posthog = usePostHog()
const view = router.query.view as string | undefined
+ const selectedAgentInstance = router.query.projectID as string | undefined
+ console.log({ view, selectedAgentInstance })
async function signOut() {
await supabaseClient.auth.signOut()
@@ -137,7 +140,8 @@ function Home({ projects }: Props) {
function selectAgent(e: any, projectID: string) {
e.preventDefault()
posthog?.capture('selected deployed agent', { projectID: projectID })
- router.push(`/deployed/${projectID}`)
+ router.push(`/?view=runs&projectID=${projectID}`, undefined, { shallow: true })
+ // router.push(`/deployed/${projectID}`)
}
const projectsWithDeployments = projects
@@ -318,8 +322,10 @@ function Home({ projects }: Props) {
agents={projectsWithDeployments}
onSelectAgent={selectAgent}
/>
- ) : view === 'runs' ? (
- <div>runs</div>
+ ) : view === 'runs' && selectedAgentInstance ? (
+ <AgentRunsList
+ agentInstance={projects.find(p => p.id === selectedAgentInstance)!}
+ />
) : (
<span>404</span>
)}