Refactor conversation status (#10590)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Tim O'Farrell 2025-08-26 08:06:26 -06:00 committed by GitHub
parent 8f46a0a7a3
commit f9099fe6db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 83 additions and 5 deletions

View File

@ -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>
<div

View File

@ -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>
)}

View File

@ -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 {

View File

@ -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>

After

Width:  |  Height:  |  Size: 512 B

View File

@ -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>

After

Width:  |  Height:  |  Size: 254 B

View File

@ -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",

View File

@ -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": "您確定要停止此對話嗎?",

View File

@ -1 +1,6 @@
export type ConversationStatus = "STARTING" | "RUNNING" | "STOPPED";
export type ConversationStatus =
| "STARTING"
| "RUNNING"
| "STOPPED"
| "ARCHIVED"
| "ERROR";

View File

@ -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 Enum
class ConversationStatus(Enum):
# The conversation is starting
STARTING = 'STARTING'
# The conversation is running - the agent may be working or idle
RUNNING = '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'