🙌 OpenHands: AI-Driven Development
Refactor conversation status (#10590)
Tim O'Farrellf9099fe6dbd8
diff --git a/frontend/src/components/features/conversation-panel/confirm-stop-modal.tsx b/frontend/src/components/features/conversation-panel/confirm-stop-modal.tsxindex 162d43a9eb..30ebb5759a 100644--- a/frontend/src/components/features/conversation-panel/confirm-stop-modal.tsx+++ b/frontend/src/components/features/conversation-panel/confirm-stop-modal.tsx@@ -23,9 +23,9 @@ export function ConfirmStopModal({<ModalBackdrop><ModalBody className="items-start border border-tertiary"><div className="flex flex-col gap-2">- <BaseModalTitle title={t(I18nKey.CONVERSATION$CONFIRM_STOP)} />+ <BaseModalTitle title={t(I18nKey.CONVERSATION$CONFIRM_PAUSE)} /><BaseModalDescription- description={t(I18nKey.CONVERSATION$STOP_WARNING)}+ description={t(I18nKey.CONVERSATION$PAUSE_WARNING)}/></div><divdiff --git a/frontend/src/components/features/conversation-panel/conversation-card-context-menu.tsx b/frontend/src/components/features/conversation-panel/conversation-card-context-menu.tsxindex 8298f008c0..b33affd23a 100644--- a/frontend/src/components/features/conversation-panel/conversation-card-context-menu.tsx+++ b/frontend/src/components/features/conversation-panel/conversation-card-context-menu.tsx@@ -129,7 +129,7 @@ export function ConversationCardContextMenu({{onStop && (<ContextMenuListItem testId="stop-button" onClick={onStop}>- <ContextMenuIconText icon={Power} text={t(I18nKey.BUTTON$STOP)} />+ <ContextMenuIconText icon={Power} text={t(I18nKey.BUTTON$PAUSE)} /></ContextMenuListItem>)}diff --git a/frontend/src/components/features/conversation-panel/conversation-state-indicator.tsx b/frontend/src/components/features/conversation-panel/conversation-state-indicator.tsxindex 2fdec49473..83bb571f24 100644--- a/frontend/src/components/features/conversation-panel/conversation-state-indicator.tsx+++ b/frontend/src/components/features/conversation-panel/conversation-state-indicator.tsx@@ -1,4 +1,6 @@import { ConversationStatus } from "#/types/conversation-status";+import ArchivedIcon from "./state-indicators/archived.svg?react";+import ErrorIcon from "./state-indicators/error.svg?react";import RunningIcon from "./state-indicators/running.svg?react";import StartingIcon from "./state-indicators/starting.svg?react";import StoppedIcon from "./state-indicators/stopped.svg?react";@@ -9,6 +11,8 @@ const CONVERSATION_STATUS_INDICATORS: Record<ConversationStatus, SVGIcon> = {STOPPED: StoppedIcon,RUNNING: RunningIcon,STARTING: StartingIcon,+ ARCHIVED: ArchivedIcon,+ ERROR: ErrorIcon,};interface ConversationStateIndicatorProps {diff --git a/frontend/src/components/features/conversation-panel/state-indicators/archived.svg b/frontend/src/components/features/conversation-panel/state-indicators/archived.svgnew file mode 100644index 0000000000..9ae37de1fa--- /dev/null+++ b/frontend/src/components/features/conversation-panel/state-indicators/archived.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#A7A9AC"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3 2 4.27z"/><path d="M0 24V0" fill="none"/></svg>diff --git a/frontend/src/components/features/conversation-panel/state-indicators/error.svg b/frontend/src/components/features/conversation-panel/state-indicators/error.svgnew file mode 100644index 0000000000..c956633ba4--- /dev/null+++ b/frontend/src/components/features/conversation-panel/state-indicators/error.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#e7000b"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.tsindex 2b535e0fc1..a7ee2d725b 100644--- a/frontend/src/i18n/declaration.ts+++ b/frontend/src/i18n/declaration.ts@@ -328,6 +328,7 @@ export enum I18nKey {USER$ACCOUNT_SETTINGS = "USER$ACCOUNT_SETTINGS",JUPYTER$OUTPUT_LABEL = "JUPYTER$OUTPUT_LABEL",BUTTON$STOP = "BUTTON$STOP",+ BUTTON$PAUSE = "BUTTON$PAUSE",BUTTON$EDIT_TITLE = "BUTTON$EDIT_TITLE",BUTTON$DOWNLOAD_VIA_VSCODE = "BUTTON$DOWNLOAD_VIA_VSCODE",BUTTON$DISPLAY_COST = "BUTTON$DISPLAY_COST",@@ -339,6 +340,8 @@ export enum I18nKey {LANDING$RECENT_CONVERSATION = "LANDING$RECENT_CONVERSATION",CONVERSATION$CONFIRM_DELETE = "CONVERSATION$CONFIRM_DELETE",CONVERSATION$CONFIRM_STOP = "CONVERSATION$CONFIRM_STOP",+ CONVERSATION$CONFIRM_PAUSE = "CONVERSATION$CONFIRM_PAUSE",+ CONVERSATION$PAUSE_WARNING = "CONVERSATION$PAUSE_WARNING",CONVERSATION$STOP_WARNING = "CONVERSATION$STOP_WARNING",CONVERSATION$METRICS_INFO = "CONVERSATION$METRICS_INFO",CONVERSATION$CREATED = "CONVERSATION$CREATED",diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.jsonindex bd8727df27..afae10585d 100644--- a/frontend/src/i18n/translation.json+++ b/frontend/src/i18n/translation.json@@ -5247,6 +5247,22 @@"tr": "Durdur","uk": "Стоп"},+ "BUTTON$PAUSE": {+ "en": "Pause",+ "ja": "一時停止",+ "zh-CN": "暂停",+ "zh-TW": "暫停",+ "ko-KR": "일시정지",+ "fr": "Mettre en pause",+ "es": "Pausar",+ "de": "Pausieren",+ "it": "Pausa",+ "pt": "Pausar",+ "ar": "إيقاف مؤقت",+ "no": "Pause",+ "tr": "Duraklat",+ "uk": "Призупинити"+ },"BUTTON$EDIT_TITLE": {"en": "Edit Title","ja": "タイトルを編集",@@ -5423,8 +5439,40 @@"de": "Stopp bestätigen","uk": "Підтвердити зупинку"},+ "CONVERSATION$CONFIRM_PAUSE": {+ "en": "Confirm Pause",+ "ja": "一時停止の確認",+ "zh-CN": "确认暂停",+ "zh-TW": "確認暫停",+ "ko-KR": "일시정지 확인",+ "no": "Bekreft pause",+ "it": "Conferma pausa",+ "pt": "Confirmar pausa",+ "es": "Confirmar pausa",+ "ar": "تأكيد الإيقاف المؤقت",+ "fr": "Confirmer la mise en pause",+ "tr": "Duraklatmayı Onayla",+ "de": "Pause bestätigen",+ "uk": "Підтвердити призупинення"+ },+ "CONVERSATION$PAUSE_WARNING": {+ "en": "Are you sure you want to pause this conversation?",+ "ja": "この会話を一時停止してもよろしいですか?",+ "zh-CN": "您确定要暂停此对话吗?",+ "zh-TW": "您確定要暫停此對話嗎?",+ "ko-KR": "이 대화를 일시정지하시겠습니까?",+ "no": "Er du sikker på at du vil pause denne samtalen?",+ "it": "Sei sicuro di voler mettere in pausa questa conversazione?",+ "pt": "Tem certeza de que deseja pausar esta conversa?",+ "es": "¿Está seguro de que desea pausar esta conversación?",+ "ar": "هل أنت متأكد أنك تريد إيقاف هذه المحادثة مؤقتًا؟",+ "fr": "Êtes-vous sûr de vouloir mettre cette conversation en pause ?",+ "tr": "Bu konuşmayı duraklatmak istediğinizden emin misiniz?",+ "de": "Sind Sie sicher, dass Sie dieses Gespräch pausieren möchten?",+ "uk": "Ви впевнені, що хочете призупинити цю розмову?"+ },"CONVERSATION$STOP_WARNING": {- "en": "Are you sure you want to stop this conversation?",+ "en": "Are you sure you want to pause this conversation?","ja": "この会話を停止してもよろしいですか?","zh-CN": "您确定要停止此对话吗?","zh-TW": "您確定要停止此對話嗎?",diff --git a/frontend/src/types/conversation-status.ts b/frontend/src/types/conversation-status.tsindex 3b4fa99064..a9d77217dd 100644--- a/frontend/src/types/conversation-status.ts+++ b/frontend/src/types/conversation-status.ts@@ -1 +1,6 @@-export type ConversationStatus = "STARTING" | "RUNNING" | "STOPPED";+export type ConversationStatus =+ | "STARTING"+ | "RUNNING"+ | "STOPPED"+ | "ARCHIVED"+ | "ERROR";diff --git a/openhands/storage/data_models/conversation_status.py b/openhands/storage/data_models/conversation_status.pyindex fdbdab5575..9681d4d5ca 100644--- a/openhands/storage/data_models/conversation_status.py+++ b/openhands/storage/data_models/conversation_status.py@@ -1,7 +1,23 @@+"""+This class is similar to the RuntimeStatus defined in the runtime api. (When this class was defined+a RuntimeStatus class already existed in OpenHands which serves a completely different purpose) Some of+the status definitions do not match up:++STOPPED/paused - the runtime is not running but may be restarted+ARCHIVED/stopped - the runtime is not running and will not restart due to deleted files.+"""+from enum import Enumclass ConversationStatus(Enum):+ # The conversation is startingSTARTING = 'STARTING'+ # The conversation is running - the agent may be working or idleRUNNING = 'RUNNING'+ # The conversation has stopped (This is synonymous with `paused` in the runtime API.)STOPPED = 'STOPPED'+ # The conversation has been archived and cannot be restarted.+ ARCHIVED = 'ARCHIVED'+ # Something has gone wrong with the conversation (The runtime rather than the agent)+ ERROR = 'ERROR'