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: Remove highlight if mouse leaves message
Kilian Lieretb9430174f96c
diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.jsindex 4814f19e..74c1616e 100644--- a/sweagent/frontend/src/Run.js+++ b/sweagent/frontend/src/Run.js@@ -61,6 +61,11 @@ function Run() {}};+ const handleMouseLeave = () => {+ console.log('Mouse left');+ setHighlightedStep(null);+ }+// Handle form submissionconst handleSubmit = async (event) => {@@ -163,8 +168,8 @@ function Run() {<div id="demo"><hr /><div className="panels">- <AgentFeed feed={agentFeed} id="agent" highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} selfRef={agentFeedRef} otherRef={envFeedRef} title="Thoughts" />- <EnvFeed feed={envFeed} id="env" highlightedStep={highlightedStep} handleMouseEnter={handleMouseEnter} selfRef={envFeedRef} otherRef={agentFeedRef} setIsTerminalExpanded={setIsTerminalExpanded} title="Terminal" />+ <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} /></div></div>diff --git a/sweagent/frontend/src/components/AgentMessage.js b/sweagent/frontend/src/components/AgentMessage.jsindex bf999c71..27e1cf1f 100644--- a/sweagent/frontend/src/components/AgentMessage.js+++ b/sweagent/frontend/src/components/AgentMessage.js@@ -3,7 +3,7 @@ import React from 'react';import "../static/message.css";import "../static/agentMessage.css";-const AgentMessage = ({ item, handleMouseEnter, isHighlighted, feedRef }) => {+const AgentMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, feedRef }) => {const stepClass = item.step !== null ? `step${item.step}` : '';const highlightClass = isHighlighted ? 'highlight' : '';@@ -11,6 +11,7 @@ const AgentMessage = ({ item, handleMouseEnter, isHighlighted, feedRef }) => {<divclassName={`message ${item.format} ${stepClass} ${highlightClass}`}onMouseEnter={() => handleMouseEnter(item, feedRef)}+ onMouseLeave={handleMouseLeave}>{ item.title && <span className="agentMessageTitle badge badge-dark">{item.title}</span>}<span>{item.message}</span>diff --git a/sweagent/frontend/src/components/EnvMessage.js b/sweagent/frontend/src/components/EnvMessage.jsindex 37aa8f92..b844f302 100644--- a/sweagent/frontend/src/components/EnvMessage.js+++ b/sweagent/frontend/src/components/EnvMessage.js@@ -9,10 +9,10 @@ import {import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';import { prism } from 'react-syntax-highlighter/dist/esm/styles/prism';-SyntaxHighlighter.registerLanguage('bash', bash);+// SyntaxHighlighter.registerLanguage('bash', bash);-const EnvMessage = ({ item, handleMouseEnter, isHighlighted, feedRef}) => {+const EnvMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, feedRef}) => {const stepClass = item.step !== null ? `step${item.step}` : '';const highlightClass = isHighlighted ? 'highlight' : '';@@ -46,6 +46,7 @@ const EnvMessage = ({ item, handleMouseEnter, isHighlighted, feedRef}) => {<divclassName={`message ${stepClass} ${highlightClass}`}onMouseEnter={() => handleMouseEnter(item, feedRef)}+ onMouseLeave={handleMouseLeave}><SyntaxHighlightercodeTagProps={codeTagProps}diff --git a/sweagent/frontend/src/components/panels/AgentFeed.js b/sweagent/frontend/src/components/panels/AgentFeed.jsindex d2495ddd..a46bfb6d 100644--- a/sweagent/frontend/src/components/panels/AgentFeed.js+++ b/sweagent/frontend/src/components/panels/AgentFeed.js@@ -12,11 +12,9 @@ function useScrollToBottom(feed, ref) {}, [feed, ref]);}-const AgentFeed = ({ feed, id, title, highlightedStep, handleMouseEnter, selfRef, }) => {+const AgentFeed = ({ feed, title, highlightedStep, handleMouseEnter, handleMouseLeave, selfRef, }) => {useScrollToBottom(feed, selfRef);- const feedID = id + "Feed";-return (<div id="agentFeed" className="agentFeed"><div id="label">@@ -30,6 +28,7 @@ const AgentFeed = ({ feed, id, title, highlightedStep, handleMouseEnter, selfRefkey={index}item={item}handleMouseEnter={handleMouseEnter}+ handleMouseLeave={handleMouseLeave}isHighlighted={item.step !== null && highlightedStep === item.step}feedRef={selfRef}/>diff --git a/sweagent/frontend/src/components/panels/EnvFeed.js b/sweagent/frontend/src/components/panels/EnvFeed.jsindex 14f5c47e..cb793df1 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, id, title, highlightedStep, handleMouseEnter, selfRef, setIsTerminalExpanded}) => {+const EnvFeed = ({ feed, title, highlightedStep, handleMouseEnter, handleMouseLeave, selfRef, setIsTerminalExpanded}) => {useScrollToBottom(feed, selfRef);return (@@ -34,6 +34,7 @@ const EnvFeed = ({ feed, id, title, highlightedStep, handleMouseEnter, selfRef,key={index}item={item}handleMouseEnter={handleMouseEnter}+ handleMouseLeave={handleMouseLeave}isHighlighted={item.step !== null && highlightedStep === item.step}feedRef={selfRef}/>