SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Web: Only show "Copy to clipboard" after run
Kilian Lieret75989a724aa9
diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.jsindex 89be980d..47cda0e2 100644--- a/sweagent/frontend/src/Run.js+++ b/sweagent/frontend/src/Run.js@@ -121,13 +121,17 @@ function Run() {}};+ const scrollLog = () => {+ logsRef.current.scrollTop = logsRef.current.scrollHeight;+ console.log('Scrolling to bottom', logsRef.current.scrollHeight);+ }+const handleLogMessage = (data) => {setLogs(prevLogs => prevLogs + data.message);if (logsRef.current) {setTimeout(() => {- logsRef.current.scrollTop = logsRef.current.scrollHeight;- console.log('Scrolling to bottom', logsRef.current.scrollHeight);+ scrollLog();}, 100);}}@@ -149,11 +153,15 @@ function Run() {console.log("Disconnected from server");setIsConnected(false);setConnectionError('Connection to server lost.');+ setIsComputing(false);+ scrollLog(); // reveal copy button});socket.on('connect_error', (error) => {setIsConnected(false);setConnectionError('Failed to connect to server.');+ setIsComputing(false);+ scrollLog(); // reveal copy button});return () => {@@ -187,7 +195,7 @@ function Run() {<div className="panels"><AgentFeed feed={agentFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} handleMouseLeave={handleMouseLeave} selfRef={agentFeedRef} otherRef={envFeedRef} /><EnvFeed feed={envFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} handleMouseLeave={handleMouseLeave} selfRef={envFeedRef} otherRef={agentFeedRef} />- <LogPanel logs={logs} logsRef={logsRef} />+ <LogPanel logs={logs} logsRef={logsRef} isComputing={isComputing}/></div></div><hr />diff --git a/sweagent/frontend/src/components/panels/LogPanel.js b/sweagent/frontend/src/components/panels/LogPanel.jsindex 807fa8e8..98663b20 100644--- a/sweagent/frontend/src/components/panels/LogPanel.js+++ b/sweagent/frontend/src/components/panels/LogPanel.js@@ -4,7 +4,7 @@ import "../../static/logPanel.css";import { Button } from 'react-bootstrap';import { Clipboard } from 'react-bootstrap-icons';-const LogPanel = ({ logs, logsRef }) => {+const LogPanel = ({ logs, logsRef, isComputing }) => {const copyToClipboard = (text) => {// Create a temporary textarea element@@ -37,11 +37,13 @@ const LogPanel = ({ logs, logsRef }) => {<pre id="logContent">{logs}</pre><div style={{ clear: "both", marginTop: '1em' }}/></div>- <div style={{ display: 'flex', justifyContent: 'right', width: '100%' }}>- <Button variant="light" onClick={handleCopy} style={{marginBottom: 20, marginRight: 20}}>- <Clipboard /> Copy to clipboard- </Button>- </div>+ { !isComputing &&+ <div style={{ display: 'flex', justifyContent: 'center', width: '100%' }}>+ <Button variant="light" onClick={handleCopy} style={{marginBottom: 20, marginRight: 20}}>+ <Clipboard /> Copy to clipboard+ </Button>+ </div>+ }</div></div>);