Skip to content

armgit / E2B

Public Imported from GitHub
0

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

context detail

Vasek Mlejnsky8bd232d373cc
diff --git a/components/AgentContext.tsx b/components/AgentContext.tsx
index b26257dbc..abf194190 100644
--- a/components/AgentContext.tsx
+++ b/components/AgentContext.tsx
@@ -38,7 +38,7 @@ function AgentContext({
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>
+ <h2 className="font-medium text-sm 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) => (
diff --git a/components/AgentContextDetail.tsx b/components/AgentContextDetail.tsx
new file mode 100644
index 000000000..dcf9c54e3
--- /dev/null
+++ b/components/AgentContextDetail.tsx
@@ -0,0 +1,64 @@
+import {
+ SystemContext,
+ UserContext,
+ AssistantContext,
+} from 'utils/agentLogs'
+import dynamic from 'next/dynamic'
+const ReactJson = dynamic(import('react-json-view'), { ssr: false })
+
+export interface Props {
+ context?: SystemContext | UserContext | AssistantContext
+}
+
+function AgentContextDetail({
+ context,
+}: Props) {
+ return (
+ <div className="overflow-auto p-2 h-full bg-[#1F2437] rounded-md flex flex-col space-y-4 max-w-[500px] min-w-[500px] border border-gray-800">
+ <h2 className="font-medium text-sm text-gray-500">Context</h2>
+
+ {context && (
+ <>
+ <div className="flex flex-col space-y-1 w-full">
+ <span className="text-sm font-medium text-gray-500">Role</span>
+ <span className="text-sm text-gray-200 w-full">{context.role}</span>
+ </div>
+
+ <div className="flex flex-col space-y-1 w-full">
+ <span className="text-sm font-medium text-gray-500">Content</span>
+ {(context as any).role !== 'assistant' ? (
+ <p className="text-sm text-gray-200 w-full prose whitespace-pre-wrap max-w-full">{context.content}</p>
+ ) : (
+ <ReactJson
+ src={JSON.parse(context.content)}
+ theme="pop"
+ name={null}
+ displayDataTypes={false}
+ displayObjectSize={false}
+ />
+ )}
+ </div>
+
+ {(context as any).role === 'assistant' && (
+ <>
+ <span className="text-sm font-medium text-gray-500">Function Call</span>
+ <ReactJson
+ src={{
+ ...(context as any).function_call,
+ 'arguments': JSON.parse((context as any).function_call.arguments),
+ }}
+ theme="pop"
+ name={null}
+ displayDataTypes={false}
+ displayObjectSize={false}
+ />
+ </>
+ )}
+ </>
+ )}
+
+ </div>
+ )
+}
+
+export default AgentContextDetail
\ No newline at end of file
diff --git a/components/AgentFunctions.tsx b/components/AgentFunctions.tsx
index ee37eb09b..171284c28 100644
--- a/components/AgentFunctions.tsx
+++ b/components/AgentFunctions.tsx
@@ -51,7 +51,7 @@ function AgentFunctions({
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">Functions</h2>
+ <h2 className="mb-2 font-medium text-sm text-gray-500">Functions</h2>
<div className="flex-1 flex flex-col space-y-3 max-w-full w-full overflow-auto">
{sortAlphabetically([...functions]).map((fn, idx) => (
diff --git a/components/Layout.tsx b/components/Layout.tsx
index cc4eb0d95..a8693b5c6 100644
--- a/components/Layout.tsx
+++ b/components/Layout.tsx
@@ -107,7 +107,7 @@ function Layout({ children }: PropsWithChildren) {
/>
</div>
- <div className="xl:pl-72 flex flex-col flex-1 max-h-full">
+ <div className="xl:pl-56 flex flex-col flex-1 max-h-full">
{/* Mobile menu icon */}
<div className="xl:hidden sticky top-0 z-40 flex justify-between h-16 shrink-0 items-center gap-x-6 border-b border-white/5 bg-gray-900 px-4 shadow-sm sm:px-6 lg:px-8">
<button type="button" className="-m-2.5 p-2.5 text-white xl:hidden" onClick={() => setIsSidebarOpen(true)}>
diff --git a/pages/log/[logFileID].tsx b/pages/log/[logFileID].tsx
index 0ffde1f82..ad3fe4685 100644
--- a/pages/log/[logFileID].tsx
+++ b/pages/log/[logFileID].tsx
@@ -17,6 +17,7 @@ import {
} from 'utils/agentLogs'
import AgentFunctions from 'components/AgentFunctions'
import AgentContext from 'components/AgentContext'
+import AgentContextDetail from 'components/AgentContextDetail'
interface PathProps extends ParsedUrlQuery {
@@ -139,7 +140,7 @@ function LogFile({ logFile }: Props) {
<h1 className="text-2xl font-semibold leading-7 text-white font-mono">{logFile.name}</h1>
</header>
- <div className="flex-1 flex items-start justify-start sm:p-6 lg:px-8 overflow-hidden">
+ <div className="flex-1 flex items-start justify-start space-x-2 sm:p-6 lg:px-8 overflow-hidden">
<Splitter
draggerClassName={clsx(
'bg-gray-700 group-hover:bg-[#6366F1] transition-all delay-75 duration-[400ms] w-0.5 h-full',
@@ -167,9 +168,9 @@ function LogFile({ logFile }: Props) {
/>
</Splitter>
- <div className="flex flex-col min-w-[500px]">
- hello
- </div>
+ <AgentContextDetail
+ context={selectedContext}
+ />
</div>
</main >
)