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 enh: Only scroll and highlight after computation is finished
Kilian Lieret8b4d8762d2ed
diff --git a/sweagent/api/hooks.py b/sweagent/api/hooks.pyindex 3f5c5545..e51021a2 100644--- a/sweagent/api/hooks.py+++ b/sweagent/api/hooks.py@@ -73,8 +73,10 @@ class AgentUpdateHook(AgentHook):def on_actions_generated(self, *, thought: str, action: str, output: str):self._thought_idx += 1thought, _, discussion = thought.partition("DISCUSSION")- self._wu.up_agent(title=f"Thought", message=thought, format="markdown", thought_idx=self._thought_idx)- self._wu.up_agent(title=f"Discussion", message=discussion, format="markdown", thought_idx=self._thought_idx)+ if thought.strip():+ self._wu.up_agent(title=f"Thought", message=thought, format="markdown", thought_idx=self._thought_idx)+ if discussion.strip():+ self._wu.up_agent(title=f"Discussion", message=discussion, format="markdown", thought_idx=self._thought_idx)def on_sub_action_started(self, *, sub_action: dict):msg = f"```bash\n{sub_action['action']}\n```"diff --git a/sweagent/frontend/src/App.js b/sweagent/frontend/src/App.jsindex 1a5fc80d..8a67f328 100644--- a/sweagent/frontend/src/App.js+++ b/sweagent/frontend/src/App.js@@ -23,7 +23,9 @@ function App() {axios.defaults.baseURL = url;const handleMouseEnter = (step) => {- setHighlightedStep(step);+ if (!isComputing) {+ setHighlightedStep(step);+ }};@@ -98,8 +100,8 @@ function App() {<button onClick={handleStop} disabled={!isComputing}>Stop Computation</button><h2>Trajectory</h2><div id="container">- <Feed feed={agentFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} selfRef={agentFeedRef} otherRef={envFeedRef} title="Agent Feed" />- <Feed feed={envFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} selfRef={envFeedRef} otherRef={agentFeedRef} title="Environment Feed" />+ <Feed feed={agentFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} selfRef={agentFeedRef} otherRef={envFeedRef} isComputing={isComputing} title="Agent Feed" />+ <Feed feed={envFeed} highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} selfRef={envFeedRef} otherRef={agentFeedRef} isComputing={isComputing} title="Environment Feed" /></div><div id="log" ref={logsRef}><h3>Logs</h3>@@ -109,17 +111,17 @@ function App() {);}-const Feed = ({ feed, title, highlightedStep, handleMouseEnter, selfRef, otherRef }) => {+const Feed = ({ feed, title, highlightedStep, handleMouseEnter, selfRef, otherRef, isComputing }) => {// Scroll to the bottom of the feed whenever the feed data changesuseEffect(() => {if (selfRef.current) {selfRef.current.scrollTop = selfRef.current.scrollHeight;}- }, [feed]);+ }, [feed, selfRef]);// Scroll to the first message of the highlighted step from the other feeduseEffect(() => {- if (highlightedStep && otherRef.current) {+ if (!isComputing && highlightedStep && otherRef.current) {const firstStepMessage = [...otherRef.current.children].find(child => child.classList.contains(`step${highlightedStep}`));@@ -132,7 +134,7 @@ const Feed = ({ feed, title, highlightedStep, handleMouseEnter, selfRef, otherRe});}}- }, [highlightedStep, otherRef]);+ }, [highlightedStep, otherRef, isComputing]);const feedID = title.toLowerCase().replace(' ', '');