Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix logs scrolling

Tomas Valenta6da5d1738470
diff --git a/components/Editor/RouteEditor/PromptEditor.tsx b/components/Editor/RouteEditor/PromptEditor.tsx
index 9deb6d523..a16992bf0 100644
--- a/components/Editor/RouteEditor/PromptEditor.tsx
+++ b/components/Editor/RouteEditor/PromptEditor.tsx
@@ -24,7 +24,11 @@ function PromptEditor({ onChange, block }: Props) {
">
<EditorContent
editor={editor}
- className="w-full h-full outline-none"
+ className="
+ w-full
+ h-full
+ outline-none
+ "
/>
</div>
)
diff --git a/components/Editor/Sidebar/Logs/LogStream.tsx b/components/Editor/Sidebar/Logs/LogStream.tsx
index e5056a3a6..56de7fd8a 100644
--- a/components/Editor/Sidebar/Logs/LogStream.tsx
+++ b/components/Editor/Sidebar/Logs/LogStream.tsx
@@ -10,15 +10,30 @@ export interface Props {
logs?: Log[]
rawLogs?: string | null
onAnswer?: (logID: string, answer: string) => void
+ isDeployRequestRunning?: boolean
}
-function LogStream({ logs, rawLogs, onAnswer }: Props) {
+function LogStream({
+ logs,
+ rawLogs,
+ onAnswer,
+ isDeployRequestRunning,
+}: Props) {
const ref = useRef<HTMLDivElement>(null)
useEffect(function scrollLogs() {
if (!ref.current) return
+ if (!isDeployRequestRunning) return
+
ref.current.scrollIntoView({ behavior: 'smooth' })
- }, [logs])
+ }, [logs, isDeployRequestRunning])
+
+ useEffect(function scrollLogs() {
+ if (!ref.current) return
+ if (isDeployRequestRunning) return
+
+ ref.current.scrollIntoView({ behavior: 'auto' })
+ }, [logs, isDeployRequestRunning])
return (
<div
diff --git a/components/Editor/Sidebar/Logs/Thought.tsx b/components/Editor/Sidebar/Logs/Thought.tsx
index c8455bb54..87086a121 100644
--- a/components/Editor/Sidebar/Logs/Thought.tsx
+++ b/components/Editor/Sidebar/Logs/Thought.tsx
@@ -12,7 +12,7 @@ function Thought({
return log.content
.replaceAll('\nAction:', '')
.replaceAll('Thought:', '')
- .replaceAll('\nFinal Answer:', '')
+ .replaceAll('Final Answer:', '')
.trim()
}, [log.content])
diff --git a/components/Editor/Sidebar/Logs/index.tsx b/components/Editor/Sidebar/Logs/index.tsx
index 1329bf05c..8e58284ea 100644
--- a/components/Editor/Sidebar/Logs/index.tsx
+++ b/components/Editor/Sidebar/Logs/index.tsx
@@ -28,10 +28,12 @@ const tabsProps = {
export interface Props {
deployment?: deployments
+ isDeployRequestRunning?: boolean
}
function Logs({
deployment,
+ isDeployRequestRunning,
}: Props) {
const [selectedTab, setSelectedTab] = useState(0)
const client = useSupabaseClient<Database>()
@@ -95,11 +97,13 @@ function Logs({
<LogStream
logs={deployment?.logs as Log[] | undefined}
onAnswer={saveAnswer}
+ isDeployRequestRunning={isDeployRequestRunning}
/>
}
{selectedTab === 1 &&
<LogStream
rawLogs={deployment?.logs_raw}
+ isDeployRequestRunning={isDeployRequestRunning}
/>
}
</div>
diff --git a/components/Editor/Sidebar/index.tsx b/components/Editor/Sidebar/index.tsx
index 776a8f9d3..13f68c63a 100644
--- a/components/Editor/Sidebar/index.tsx
+++ b/components/Editor/Sidebar/index.tsx
@@ -99,7 +99,6 @@ function Sidebar({
className={clsx(`
flex
bg-white
- flex
w-full
flex-col
min-h-0
@@ -164,6 +163,7 @@ function Sidebar({
<Envs />
<Logs
deployment={deployment}
+ isDeployRequestRunning={isDeployRequestRunning}
/>
</div>
)