diff --git a/autogpt_platform/backend/backend/api/features/chat/model.py b/autogpt_platform/backend/backend/api/features/chat/model.py index 738c02cd80..7318ef88d7 100644 --- a/autogpt_platform/backend/backend/api/features/chat/model.py +++ b/autogpt_platform/backend/backend/api/features/chat/model.py @@ -299,10 +299,15 @@ async def invalidate_session_cache(session_id: str) -> None: """Invalidate a chat session from Redis cache. Used by background tasks to ensure fresh data is loaded on next access. + This is best-effort - Redis failures are logged but don't fail the operation. """ - redis_key = _get_session_cache_key(session_id) - async_redis = await get_redis_async() - await async_redis.delete(redis_key) + try: + redis_key = _get_session_cache_key(session_id) + async_redis = await get_redis_async() + await async_redis.delete(redis_key) + except Exception as e: + # Best-effort: log but don't fail - cache will expire naturally + logger.warning(f"Failed to invalidate session cache for {session_id}: {e}") async def _get_session_from_db(session_id: str) -> ChatSession | None: diff --git a/autogpt_platform/frontend/src/components/contextual/Chat/components/ChatContainer/helpers.ts b/autogpt_platform/frontend/src/components/contextual/Chat/components/ChatContainer/helpers.ts index 216671615c..9a0175d958 100644 --- a/autogpt_platform/frontend/src/components/contextual/Chat/components/ChatContainer/helpers.ts +++ b/autogpt_platform/frontend/src/components/contextual/Chat/components/ChatContainer/helpers.ts @@ -344,7 +344,7 @@ export function parseToolResponse( if (responseType === "operation_started") { return { type: "operation_started", - toolName: parsedResult.tool_name as string, + toolName: (parsedResult.tool_name as string) || toolName, operationId: (parsedResult.operation_id as string) || "", message: (parsedResult.message as string) || @@ -355,7 +355,7 @@ export function parseToolResponse( if (responseType === "operation_pending") { return { type: "operation_pending", - toolName: parsedResult.tool_name as string, + toolName: (parsedResult.tool_name as string) || toolName, operationId: (parsedResult.operation_id as string) || "", message: (parsedResult.message as string) || @@ -366,7 +366,7 @@ export function parseToolResponse( if (responseType === "operation_in_progress") { return { type: "operation_in_progress", - toolName: parsedResult.tool_name as string, + toolName: (parsedResult.tool_name as string) || toolName, toolCallId: (parsedResult.tool_call_id as string) || "", message: (parsedResult.message as string) || diff --git a/autogpt_platform/frontend/src/components/contextual/Chat/components/PendingOperationWidget/PendingOperationWidget.tsx b/autogpt_platform/frontend/src/components/contextual/Chat/components/PendingOperationWidget/PendingOperationWidget.tsx index 61976cd9c6..6cfea7f327 100644 --- a/autogpt_platform/frontend/src/components/contextual/Chat/components/PendingOperationWidget/PendingOperationWidget.tsx +++ b/autogpt_platform/frontend/src/components/contextual/Chat/components/PendingOperationWidget/PendingOperationWidget.tsx @@ -19,6 +19,19 @@ interface Props { className?: string; } +function getOperationTitle(toolName?: string): string { + if (!toolName) return "Operation"; + // Convert tool name to human-readable format + // e.g., "create_agent" -> "Creating Agent", "edit_agent" -> "Editing Agent" + if (toolName === "create_agent") return "Creating Agent"; + if (toolName === "edit_agent") return "Editing Agent"; + // Default: capitalize and format tool name + return toolName + .split("_") + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join(" "); +} + export function PendingOperationWidget({ status, message, @@ -30,6 +43,8 @@ export function PendingOperationWidget({ const isCompleted = status === "completed"; const isError = status === "error"; + const operationTitle = getOperationTitle(toolName); + return (