Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Cleanup

Tomas Valenta93b459f46a08
diff --git a/components/Editor/Sidebar/Logs/Tool/AskHuman.tsx b/components/Editor/Sidebar/Logs/Tool/AskHuman.tsx
index d82656da7..74976357e 100644
--- a/components/Editor/Sidebar/Logs/Tool/AskHuman.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/AskHuman.tsx
@@ -1,5 +1,4 @@
import {
- ReactNode,
useCallback,
useState,
} from 'react'
@@ -32,9 +31,8 @@ function AskHuman({
onAnswer?.({ logID: log.id, answer, toolName: ToolName.AskHuman })
}, [answer, onAnswer, log.id, log.tool_output])
- let body: ReactNode = null
- if (log.tool_input.trim()) {
- body = (
+ const body = log.tool_input.trim()
+ ? (
<div className="
flex
flex-col
@@ -64,7 +62,7 @@ function AskHuman({
</div>
</div>
)
- }
+ : null
return (
<Base
@@ -75,4 +73,4 @@ function AskHuman({
)
}
-export default AskHuman
\ No newline at end of file
+export default AskHuman
diff --git a/components/Editor/Sidebar/Logs/Tool/Base.tsx b/components/Editor/Sidebar/Logs/Tool/Base.tsx
index 556b11108..6b0ed7afd 100644
--- a/components/Editor/Sidebar/Logs/Tool/Base.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/Base.tsx
@@ -75,4 +75,4 @@ function BaseTool({
)
}
-export default BaseTool
\ No newline at end of file
+export default BaseTool
diff --git a/components/Editor/Sidebar/Logs/Tool/Curl.tsx b/components/Editor/Sidebar/Logs/Tool/Curl.tsx
index be1d63133..9080cb22b 100644
--- a/components/Editor/Sidebar/Logs/Tool/Curl.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/Curl.tsx
@@ -1,6 +1,3 @@
-import {
- ReactNode
-} from 'react'
import {
Terminal,
} from 'lucide-react'
@@ -19,17 +16,15 @@ function Curl({
}: Props) {
if (log.tool_name !== ToolName.Curl) throw new Error(`'${log.tool_name}': This component supports only logs for '${ToolName.Curl}' tool`)
- let body: ReactNode = null
- if (log.tool_input.trim()) {
- body = (
- <div className="
- ">
+ const body = log.tool_input.trim()
+ ? (
+ <div className="">
<pre>
{log.tool_input.trim()}
</pre>
</div>
)
- }
+ : null
return (
<Base
@@ -40,4 +35,4 @@ function Curl({
)
}
-export default Curl
\ No newline at end of file
+export default Curl
diff --git a/components/Editor/Sidebar/Logs/Tool/InstallNPMDeps.tsx b/components/Editor/Sidebar/Logs/Tool/InstallNPMDeps.tsx
index bfe671b0a..0721d192f 100644
--- a/components/Editor/Sidebar/Logs/Tool/InstallNPMDeps.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/InstallNPMDeps.tsx
@@ -1,6 +1,3 @@
-import {
- ReactNode
-} from 'react'
import {
Package,
} from 'lucide-react'
@@ -19,18 +16,18 @@ function InstallNPMDeps({
}: Props) {
if (log.tool_name !== ToolName.InstallNPMDependencies) throw new Error(`'${log.tool_name}': This component supports only logs for '${ToolName.InstallNPMDependencies}' tool`)
- let body: ReactNode = null
- if (log.tool_input.trim()) {
- body = (
+ const body = log.tool_input.trim()
+ ? (
<div className="
pt-2
- ">
+ ">
<pre>
{log.tool_input.trim()}
</pre>
</div>
)
- }
+ : null
+
return (
<Base
@@ -41,4 +38,4 @@ function InstallNPMDeps({
)
}
-export default InstallNPMDeps
\ No newline at end of file
+export default InstallNPMDeps
diff --git a/components/Editor/Sidebar/Logs/Tool/LetHumanChoose.tsx b/components/Editor/Sidebar/Logs/Tool/LetHumanChoose.tsx
index c4f883ab8..2196007f7 100644
--- a/components/Editor/Sidebar/Logs/Tool/LetHumanChoose.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/LetHumanChoose.tsx
@@ -1,21 +1,16 @@
import {
- useState,
- useEffect,
- ReactNode,
Fragment,
+ useMemo,
} from 'react'
import {
HelpCircle,
} from 'lucide-react'
import Text from 'components/Text'
-// import Input from 'components/Input'
-// import Button from 'components/Button'
import { ToolName, ToolLog } from 'db/types'
import Base from './Base'
-
export interface Props {
log: ToolLog
onAnswer?: (args: { logID: string, answer: string, toolName: ToolName }) => void
@@ -26,13 +21,11 @@ function LetHumanChoose({
onAnswer,
}: Props) {
if (log.tool_name !== ToolName.LetHumanChoose) throw new Error(`'${log.tool_name}': This component supports only logs for '${ToolName.LetHumanChoose}' tool`)
- const [body, setBody] = useState<ReactNode>()
- useEffect(function createBody() {
+ const body = useMemo(() => {
const xmlString = log.tool_input.trim()
if (!xmlString) {
console.error('LetHumanChoose: Tool input is empty')
- console.log({ log })
return
}
@@ -50,8 +43,7 @@ function LetHumanChoose({
throw new Error('LetHumanChoose: No options found')
}
- console.log({ question })
- const b = (
+ return (
<div className="
flex
flex-col
@@ -100,13 +92,15 @@ function LetHumanChoose({
</div>
</div>
)
- setBody(b)
} catch (err) {
console.error('LetHumanChoose: Error parsing XML:', err)
- console.log({ log })
- return
+ return null
}
- }, [log, onAnswer])
+ }, [
+ log.id,
+ log.tool_input,
+ log.tool_output, onAnswer,
+ ])
return (
<Base
@@ -117,4 +111,4 @@ function LetHumanChoose({
)
}
-export default LetHumanChoose
\ No newline at end of file
+export default LetHumanChoose
diff --git a/components/Editor/Sidebar/Logs/Tool/RunSavedCode.tsx b/components/Editor/Sidebar/Logs/Tool/RunSavedCode.tsx
index a4babc2ed..332d42821 100644
--- a/components/Editor/Sidebar/Logs/Tool/RunSavedCode.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/RunSavedCode.tsx
@@ -1,6 +1,3 @@
-import {
- ReactNode
-} from 'react'
import {
Code2,
} from 'lucide-react'
@@ -19,9 +16,8 @@ function RunSavedCode({
}: Props) {
if (log.tool_name !== ToolName.RunSavedCode) throw new Error(`'${log.tool_name}': This component supports only logs for '${ToolName.WriteJavaScriptCode}' tool`)
- let body: ReactNode = null
- if (log.tool_input.trim()) {
- body = (
+ const body = log.tool_input.trim()
+ ? (
<div className="
pt-2
">
@@ -30,7 +26,7 @@ function RunSavedCode({
</pre>
</div>
)
- }
+ : null
return (
<Base
@@ -41,4 +37,4 @@ function RunSavedCode({
)
}
-export default RunSavedCode
\ No newline at end of file
+export default RunSavedCode
diff --git a/components/Editor/Sidebar/Logs/Tool/WriteCode.tsx b/components/Editor/Sidebar/Logs/Tool/WriteCode.tsx
index 5041ac378..3eaf96b40 100644
--- a/components/Editor/Sidebar/Logs/Tool/WriteCode.tsx
+++ b/components/Editor/Sidebar/Logs/Tool/WriteCode.tsx
@@ -1,6 +1,3 @@
-import {
- ReactNode
-} from 'react'
import {
FileEdit,
} from 'lucide-react'
@@ -9,7 +6,6 @@ import { ToolName, ToolLog } from 'db/types'
import Base from './Base'
-
export interface Props {
log: ToolLog
}
@@ -19,17 +15,15 @@ function WriteCode({
}: Props) {
if (log.tool_name !== ToolName.WriteJavaScriptCode) throw new Error(`'${log.tool_name}': This component supports only logs for '${ToolName.WriteJavaScriptCode}' tool`)
- let body: ReactNode = null
- if (log.tool_input.trim()) {
- body = (
- <div className="
- ">
+ const body = log.tool_input.trim()
+ ? (
+ <div className="">
<pre>
{log.tool_input.trim()}
</pre>
</div>
)
- }
+ : null
return (
<Base
@@ -40,4 +34,4 @@ function WriteCode({
)
}
-export default WriteCode
\ No newline at end of file
+export default WriteCode