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: Remove "Thought" and fix info msg styling
Kilian Lieretfbc07f00359b
diff --git a/sweagent/api/hooks.py b/sweagent/api/hooks.pyindex 1b8867cd..2f3fdcad 100644--- a/sweagent/api/hooks.py+++ b/sweagent/api/hooks.py@@ -44,16 +44,18 @@ class WebUpdate:def up_agent(self,message: str,- title: str = "",+ *,format: str = "markdown",thought_idx: Optional[int] =None,+ type_: str = "info",):"""Update the agent feed"""- self._emit('update', {'feed': 'agent', 'title': title, 'message': message, 'format': format, 'thought_idx': thought_idx})+ self._emit('update', {'feed': 'agent', 'message': message, 'format': format, 'thought_idx': thought_idx, 'type': type_})def up_env(self,message: str,+ *,type_: str,format: str = "markdown",thought_idx: Optional[int] =None,@@ -92,11 +94,9 @@ class AgentUpdateHook(AgentHook):def on_actions_generated(self, *, thought: str, action: str, output: str):self._thought_idx += 1- thought, _, discussion = thought.partition("DISCUSSION")- 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)+ for prefix in ["DISCUSSION\n", "THOUGHT\n", "DISCUSSION", "THOUGHT"]:+ thought = thought.replace(prefix, "")+ self._wu.up_agent(message=thought, format="markdown", thought_idx=self._thought_idx, type_="thought")def on_sub_action_started(self, *, sub_action: dict):# msg = f"```bash\n{sub_action['action']}\n```"diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.jsindex 9d1ca7de..f97a4c28 100644--- a/sweagent/frontend/src/Run.js+++ b/sweagent/frontend/src/Run.js@@ -114,7 +114,7 @@ function Run() {React.useEffect(() => {const handleUpdate = (data) => {if (data.feed === 'agent') {- setAgentFeed(prevMessages => [...prevMessages, { title: data.title, message: data.message, format: data.format, step: data.thought_idx }]);+ setAgentFeed(prevMessages => [...prevMessages, { type: data.type, message: data.message, format: data.format, step: data.thought_idx }]);}else if (data.feed === "env") {setEnvFeed(prevMessages => [...prevMessages, { message: data.message, type: data.type, format: data.format, step: data.thought_idx }]);diff --git a/sweagent/frontend/src/components/AgentMessage.js b/sweagent/frontend/src/components/AgentMessage.jsindex 27e1cf1f..c9090bb0 100644--- a/sweagent/frontend/src/components/AgentMessage.js+++ b/sweagent/frontend/src/components/AgentMessage.js@@ -2,6 +2,7 @@ import React from 'react';import "../static/message.css";import "../static/agentMessage.css";+import {Gear} from 'react-bootstrap-icons';const AgentMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, feedRef }) => {const stepClass = item.step !== null ? `step${item.step}` : '';@@ -13,7 +14,7 @@ const AgentMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted,onMouseEnter={() => handleMouseEnter(item, feedRef)}onMouseLeave={handleMouseLeave}>- { item.title && <span className="agentMessageTitle badge badge-dark">{item.title}</span>}+ { item.type !== "thought" && <Gear style={{marginRight: 5}}/>}<span>{item.message}</span></div>);diff --git a/sweagent/frontend/src/components/EnvMessage.js b/sweagent/frontend/src/components/EnvMessage.jsindex a0602c45..77136a2c 100644--- a/sweagent/frontend/src/components/EnvMessage.js+++ b/sweagent/frontend/src/components/EnvMessage.js@@ -49,7 +49,7 @@ const EnvMessage = ({ item, handleMouseEnter, handleMouseLeave, isHighlighted, f"diff": "diff",}- if (item.type !== "text") {+ if (item.format !== "text") {return (<divclassName={`message ${stepClass} ${highlightClass} ${messageTypeClass}`}