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: Fix spacing of code blocks
Kilian Lieret22c293c0a895
diff --git a/sweagent/api/hooks.py b/sweagent/api/hooks.pyindex 376d9056..1b8867cd 100644--- a/sweagent/api/hooks.py+++ b/sweagent/api/hooks.py@@ -100,7 +100,7 @@ class AgentUpdateHook(AgentHook):def on_sub_action_started(self, *, sub_action: dict):# msg = f"```bash\n{sub_action['action']}\n```"- msg = sub_action["action"].strip()+ msg = "$ " + sub_action["action"].strip()self._sub_action = sub_action["action"].strip()self._wu.up_env(message=msg, thought_idx=self._thought_idx, type_="command")diff --git a/sweagent/frontend/src/components/EnvMessage.js b/sweagent/frontend/src/components/EnvMessage.jsindex b844f302..a0602c45 100644--- a/sweagent/frontend/src/components/EnvMessage.js+++ b/sweagent/frontend/src/components/EnvMessage.js@@ -11,14 +11,22 @@ import { prism } from 'react-syntax-highlighter/dist/esm/styles/prism';// SyntaxHighlighter.registerLanguage('bash', bash);+function capitalizeFirstLetter(str) {+ return str[0].toUpperCase() + str.slice(1);+}+const EnvMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, feedRef}) => {const stepClass = item.step !== null ? `step${item.step}` : '';const highlightClass = isHighlighted ? 'highlight' : '';+ const messageTypeClass = "envMessage" + capitalizeFirstLetter(item.type);++ const paddingBottom = item.type === "command" ? "0" : "0.5em";+ const paddingTop = ["output", "diff"].includes(item.type) ? "0" : "0.5em";const customStyle = {margin: 0,- padding: '0 0.5em',+ padding: `${paddingTop} 0.5em ${paddingBottom} 0.5em`,overflowX: 'hidden',lineHeight: 'inherit',backgroundColor: 'transparent',@@ -29,7 +37,7 @@ const EnvMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, fboxShadow: "none",margin: "0",overflowY: "hidden",- padding: "0.25em 0.5em 0.75em 0.5em",+ padding: "0",lineHeight: 'inherit',fontSize: 'inherit',}@@ -41,16 +49,16 @@ const EnvMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, f"diff": "diff",}- if (item.type === "command" || item.type === "output") {+ if (item.type !== "text") {return (<div- className={`message ${stepClass} ${highlightClass}`}+ className={`message ${stepClass} ${highlightClass} ${messageTypeClass}`}onMouseEnter={() => handleMouseEnter(item, feedRef)}onMouseLeave={handleMouseLeave}><SyntaxHighlightercodeTagProps={codeTagProps}- customStyle={{customStyleMerged: customStyle, overflow: 'hidden'}}+ customStyle={customStyle}language={typeToLanguage[item.type]}// lineProps={{ style: {wordBreak: 'break-word', whiteSpace: 'normal'} }}style={{backgroundColor: 'transparent', ...prism}}@@ -64,7 +72,7 @@ const EnvMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, f} else {return (<div- className={`message ${stepClass} ${highlightClass}`}+ className={`message ${stepClass} ${highlightClass} ${messageTypeClass}`}onMouseEnter={() => handleMouseEnter(item, feedRef)}><span>{item.message}</span>diff --git a/sweagent/frontend/src/static/envMessage.css b/sweagent/frontend/src/static/envMessage.cssindex cce94364..a6d0274e 100644--- a/sweagent/frontend/src/static/envMessage.css+++ b/sweagent/frontend/src/static/envMessage.css@@ -4,7 +4,7 @@/* border-bottom: 1px dashed black; */}-.envMessageOutput{+.envMessageOutput, .envMessageDiff {border-radius: 0em 0em 1em 1em;margin: 0em 1em 1em 1em;}