Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
commit
Vasek Mlejnsky5e2fa50157af
diff --git a/components/AgentContext.tsx b/components/AgentContext.tsxnew file mode 100644index 000000000..b26257dbc--- /dev/null+++ b/components/AgentContext.tsx@@ -0,0 +1,68 @@+import {+ useState,+} from 'react'+import clsx from 'clsx'+import {+ SystemContext,+ UserContext,+ AssistantContext,+} from 'utils/agentLogs'++export interface Props {+ context: (SystemContext | UserContext | AssistantContext)[]+ onSelected: (ctx: SystemContext | UserContext | AssistantContext) => void+}++function AgentContext({+ context,+ onSelected: onOpened,+}: Props) {+ const [opened, setOpened] = useState<number>()++ function open(idx: number) {+ setOpened(idx)+ onOpened(context[idx])+ }++ function close(idx: number) {+ setOpened(undefined)+ }++ function toggle(idx: number) {+ if (opened === idx) {+ close(idx)+ } else {+ open(idx)+ }+ }++ return (+ <div className="flex-1 flex flex-col space-y-2 max-w-full w-full overflow-hidden">+ <h2 className="font-bold text-gray-500">Logs</h2>++ <div className="flex-1 flex flex-col space-y-1 max-w-full w-full overflow-auto">+ {context.map((ctx, idx) => (+ <>+ <div key={idx} className="flex items-center space-x-2 ">+ <span className="font-bold text-sm text-[#55618C] capitalize min-w-[72px]">{ctx.role}</span>+ <span+ className={clsx(+ 'text-sm text-gray-100 max-w-full truncate p-2 hover:bg-[#1F2437] transition-all rounded-md cursor-pointer w-full',+ opened === idx && 'bg-[#1F2437]',+ )}+ onClick={() => toggle(idx)}+ >+ {ctx.content}+ </span>+ </div>+ {idx !== context.length - 1 && (+ <div className="ml-1 rounded min-h-[20px] w-px bg-gray-800" />+ )}+ </>+ ))}+ </div>+ </div>+ )+}++export default AgentContext\ No newline at end of filediff --git a/components/AgentFunctions.tsx b/components/AgentFunctions.tsxindex 733fe2bd1..e9c851e87 100644--- a/components/AgentFunctions.tsx+++ b/components/AgentFunctions.tsx@@ -7,29 +7,6 @@ import {} from 'lucide-react'import ReactJson from 'react-json-view'---const theme = {- scheme: 'monokai',- author: 'wimer hazenberg (http://www.monokai.nl)',- base00: '#272822',- base01: '#383830',- base02: '#49483e',- base03: '#75715e',- base04: '#a59f85',- base05: '#f8f8f2',- base06: '#f5f4f1',- base07: '#f9f8f5',- base08: '#f92672',- base09: '#fd971f',- base0A: '#f4bf75',- base0B: '#a6e22e',- base0C: '#a1efe4',- base0D: '#66d9ef',- base0E: '#ae81ff',- base0F: '#cc6633',-}-import { AgentFunction } from 'utils/agentLogs'export interface Props {@@ -100,13 +77,13 @@ function AgentFunctions({'rounded-md','py-0.5','px-2',- 'hover:bg-gray-800',+ 'hover:bg-[#1F2437]','transition-all','w-full','text-sm','cursor-pointer','font-mono',- opened.includes(idx) && 'bg-gray-800',+ opened.includes(idx) && 'bg-[#1F2437]',opened.includes(idx) && 'font-semibold',)}onClick={() => toggle(idx)}diff --git a/components/Sidebar/DashboardDesktopSidebar.tsx b/components/Sidebar/DashboardDesktopSidebar.tsxindex 80ecc44d8..014f8aa70 100644--- a/components/Sidebar/DashboardDesktopSidebar.tsx+++ b/components/Sidebar/DashboardDesktopSidebar.tsx@@ -19,7 +19,7 @@ function DashboardDesktopSidebar({const isOnLogDetail = router.pathname.startsWith('/log/[logFileID]')return (- <div className="hidden xl:fixed xl:inset-y-0 xl:z-50 xl:flex xl:w-72 xl:flex-col">+ <div className="hidden xl:fixed xl:inset-y-0 xl:z-50 xl:flex xl:w-56 xl:flex-col">{/* Sidebar component, swap this element with another sidebar if you like */}<div className="flex grow flex-col gap-y-5 overflow-y-auto bg-black/10 px-6 border-r border-white/5">{/* Logo */}diff --git a/pages/log/[logFileID].tsx b/pages/log/[logFileID].tsxindex af5aeee59..0ffde1f82 100644--- a/pages/log/[logFileID].tsx+++ b/pages/log/[logFileID].tsx@@ -10,7 +10,13 @@ import Link from 'next/link'import { prisma } from 'db/prisma'import { serverCreds } from 'db/credentials'+import {+ SystemContext,+ UserContext,+ AssistantContext,+} from 'utils/agentLogs'import AgentFunctions from 'components/AgentFunctions'+import AgentContext from 'components/AgentContext'interface PathProps extends ParsedUrlQuery {@@ -119,6 +125,7 @@ export interface Props {function LogFile({ logFile }: Props) {const [isResizing, setIsResizing] = useState(false)const [sizes, setSizes] = useState([50, 50])+ const [selectedContext, setSelectedContext] = useState<SystemContext | UserContext | AssistantContext>()return (<main className="overflow-hidden flex flex-col flex-1">@@ -153,15 +160,16 @@ function LogFile({ logFile }: Props) {<AgentFunctionsfunctions={logFile.content.functions}/>- <div className="flex flex-col space-y-4 max-w-full overflow-auto">- <h2 className="font-bold text-gray-500">Logs</h2>- {logFile.content.context.map((ctx, idx) => (- <div key={idx} className="shadow sm:rounded-md">- {ctx.role}- </div>- ))}- </div>++ <AgentContext+ context={logFile.content.context}+ onSelected={setSelectedContext}+ /></Splitter>++ <div className="flex flex-col min-w-[500px]">+ hello+ </div></div></main >)