Skip to content

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: Minimize menu when run started

Kilian Lierete4f186effe79
diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.js
index 2b9182b6..89be980d 100644
--- a/sweagent/frontend/src/Run.js
+++ b/sweagent/frontend/src/Run.js
@@ -27,12 +27,11 @@ function Run() {
const hoverTimeoutRef = useRef(null);
- const [isTerminalExpanded, setIsTerminalExpanded] = useState(false);
- const [isLogsExpanded, setIsLogsExpanded] = useState(false);
-
const agentFeedRef = useRef(null);
const envFeedRef = useRef(null);
const logsRef = useRef(null);
+
+ const [tabKey, setTabKey] = useState('problem');
axios.defaults.baseURL = url;
@@ -86,6 +85,7 @@ function Run() {
// Handle form submission
const handleSubmit = async (event) => {
+ setTabKey(null);
setIsComputing(true);
event.preventDefault();
setAgentFeed([]);
@@ -181,13 +181,13 @@ function Run() {
<div className="container-demo">
{renderErrorMessage()}
- <LRunControl isComputing={isComputing} isConnected={isConnected} handleStop={handleStop} handleSubmit={handleSubmit} setDataPath={setDataPath} setTestRun={setTestRun} setRepoPath={setRepoPath} testRun={testRun} setModel={setModel} />
+ <LRunControl isComputing={isComputing} isConnected={isConnected} handleStop={handleStop} handleSubmit={handleSubmit} setDataPath={setDataPath} setTestRun={setTestRun} setRepoPath={setRepoPath} testRun={testRun} setModel={setModel} tabKey={tabKey} setTabKey={setTabKey}/>
<div id="demo">
<hr />
<div className="panels">
- <AgentFeed feed={agentFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} handleMouseLeave={handleMouseLeave} selfRef={agentFeedRef} otherRef={envFeedRef} title="Thoughts" />
- <EnvFeed feed={envFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} handleMouseLeave={handleMouseLeave} selfRef={envFeedRef} otherRef={agentFeedRef} setIsTerminalExpanded={setIsTerminalExpanded} title="Terminal" />
- <LogPanel logs={logs} logsRef={logsRef} setIsTerminalExpanded={setIsLogsExpanded} />
+ <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} />
</div>
</div>
<hr />
diff --git a/sweagent/frontend/src/components/controls/LRunControl.js b/sweagent/frontend/src/components/controls/LRunControl.js
index 39778093..c5eb2032 100644
--- a/sweagent/frontend/src/components/controls/LRunControl.js
+++ b/sweagent/frontend/src/components/controls/LRunControl.js
@@ -6,9 +6,8 @@ import { PlayFill, StopFill} from 'react-bootstrap-icons';
import { Link } from 'react-router-dom';
-function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDataPath, setTestRun, testRun, setRepoPath, setModel}) {
+function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDataPath, setTestRun, testRun, setRepoPath, setModel, tabKey, setTabKey}) {
const [psType, setPsType] = useState('gh');
- const [key, setKey] = useState('problem');
const defaultPS = "https://github.com/klieret/swe-agent-test-repo/issues/1" ;
@@ -41,12 +40,21 @@ function LRunControl({isComputing, isConnected, handleStop, handleSubmit, setDat
}
}
+ function onTabClicked(keyClicked) {
+ if (keyClicked === tabKey) {
+ setTabKey(null);
+ }
+ else {
+ setTabKey(keyClicked);
+ }
+ }
+
return (
<div>
<Tabs
id="controlled-tab-example"
- activeKey={key}
- onSelect={(k) => setKey(k)}
+ activeKey={tabKey}
+ onSelect={onTabClicked}
className="mb-3 bordered-tab-contents"
>
<Tab eventKey="problem" title="Problem Source">
diff --git a/sweagent/frontend/src/components/panels/AgentFeed.js b/sweagent/frontend/src/components/panels/AgentFeed.js
index 2c9b5478..9a9857e8 100644
--- a/sweagent/frontend/src/components/panels/AgentFeed.js
+++ b/sweagent/frontend/src/components/panels/AgentFeed.js
@@ -12,7 +12,7 @@ function useScrollToBottom(feed, ref) {
}, [feed, ref]);
}
-const AgentFeed = ({ feed, title, highlightedStep, handleMouseEnter, handleMouseLeave, selfRef, }) => {
+const AgentFeed = ({ feed, highlightedStep, handleMouseEnter, handleMouseLeave, selfRef, }) => {
useScrollToBottom(feed, selfRef);
return (
diff --git a/sweagent/frontend/src/components/panels/EnvFeed.js b/sweagent/frontend/src/components/panels/EnvFeed.js
index 521f2fbe..fbf47cc4 100644
--- a/sweagent/frontend/src/components/panels/EnvFeed.js
+++ b/sweagent/frontend/src/components/panels/EnvFeed.js
@@ -13,7 +13,7 @@ function useScrollToBottom(feed, ref) {
}, [feed, ref]);
}
-const EnvFeed = ({ feed, title, highlightedStep, handleMouseEnter, handleMouseLeave, selfRef, setIsTerminalExpanded}) => {
+const EnvFeed = ({ feed, highlightedStep, handleMouseEnter, handleMouseLeave, selfRef}) => {
useScrollToBottom(feed, selfRef);
return (
diff --git a/sweagent/frontend/src/components/panels/LogPanel.js b/sweagent/frontend/src/components/panels/LogPanel.js
index 6f73cf34..807fa8e8 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, setIsTerminalExpanded}) => {
+const LogPanel = ({ logs, logsRef }) => {
const copyToClipboard = (text) => {
// Create a temporary textarea element