Skip to content

Commit 4dc66ec

Browse files
Enhance error messages in OrchestrationManager and format error message in PlanPage for improved clarity and user experience
1 parent 34b68c5 commit 4dc66ec

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/backend/v3/orchestration/orchestration_manager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
189189
if hasattr(e, "__dict__"):
190190
self.logger.info(f"Error attributes: {e.__dict__}")
191191
self.logger.info("=" * 50)
192-
error_content = "The agent is currently unavailable. Please check if it was deleted or recreated.\n\nIf yes, please create a new plan from the home page."
192+
error_content = "**Attention:** The agent is currently unavailable. Please check if it was deleted or recreated.\n\nIf yes, please create a new plan from the home page."
193193
self.logger.info(f"🔴 Sending error message to user {user_id}: {error_content}")
194194

195195
await connection_config.send_status_update_async(
@@ -213,7 +213,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
213213
{
214214
"type": WebsocketMessageType.ERROR_MESSAGE,
215215
"data": {
216-
"content": "An error occurred while processing the final response.\n\nPlease try creating a new plan from the home page.",
216+
"content": "**Attention:** An error occurred while processing the final response.\n\nPlease try creating a new plan from the home page.",
217217
"status": "error",
218218
"timestamp": asyncio.get_event_loop().time(),
219219
},
@@ -230,7 +230,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
230230
{
231231
"type": WebsocketMessageType.ERROR_MESSAGE,
232232
"data": {
233-
"content": "I'm having trouble connecting to the agent right now.\n\nPlease try creating a new plan from the home page or try again later.",
233+
"content": "**Attention:** I'm having trouble connecting to the agent right now.\n\nPlease try creating a new plan from the home page or try again later.",
234234
"status": "error",
235235
"timestamp": asyncio.get_event_loop().time(),
236236
},
@@ -250,7 +250,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
250250
{
251251
"type": WebsocketMessageType.ERROR_MESSAGE,
252252
"data": {
253-
"content": "Something went wrong.\n\nPlease try creating a new plan from the home page or try again later.",
253+
"content": "**Attention:** Something went wrong.\n\nPlease try creating a new plan from the home page or try again later.",
254254
"status": "error",
255255
"timestamp": asyncio.get_event_loop().time(),
256256
},
@@ -267,7 +267,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
267267
self.logger.info(f"Error attributes: {e.__dict__}")
268268
self.logger.info("=" * 50)
269269

270-
error_content = "Something went wrong.\n\nPlease try creating a new plan from the home page or try again later."
270+
error_content = "**Attention:** Something went wrong.\n\nPlease try creating a new plan from the home page or try again later."
271271

272272
self.logger.info(f"🔴 Sending error message to user {user_id}: {error_content}")
273273

src/frontend/src/pages/PlanPage.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,20 @@ const PlanPage: React.FC = () => {
5858
const [showBufferingText, setShowBufferingText] = useState<boolean>(false);
5959
const [agentMessages, setAgentMessages] = useState<AgentMessageData[]>([]);
6060
const formatErrorMessage = useCallback((content: string): string => {
61-
return `⚠️ ${content}`;
61+
// return `⚠️ ${content}`;
62+
// Split content by newlines and add proper indentation
63+
const lines = content.split('\n');
64+
const formattedLines = lines.map((line, index) => {
65+
if (index === 0) {
66+
return `⚠️ ${line}`;
67+
} else if (line.trim() === '') {
68+
return ''; // Preserve blank lines
69+
} else {
70+
// Use HTML non-breaking spaces to avoid Markdown code block formatting
71+
return `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${line}`;
72+
}
73+
});
74+
return formattedLines.join('\n');
6275
}, []);
6376
// Plan approval state - track when plan is approved
6477
const [planApproved, setPlanApproved] = useState<boolean>(false);

0 commit comments

Comments
 (0)