Skip to content

🙌 OpenHands: AI-Driven Development

refactor(frontend): enhance the launch microagent modal (memory UI). (#10651)

Hiep Le75653e805a1b
diff --git a/frontend/src/components/features/chat/chat-message.tsx b/frontend/src/components/features/chat/chat-message.tsx
index 34ea5a0684..a97ed531cf 100644
--- a/frontend/src/components/features/chat/chat-message.tsx
+++ b/frontend/src/components/features/chat/chat-message.tsx
@@ -9,6 +9,7 @@ import { CopyToClipboardButton } from "#/components/shared/buttons/copy-to-clipb
import { anchor } from "../markdown/anchor";
import { OpenHandsSourceType } from "#/types/core/base";
import { paragraph } from "../markdown/paragraph";
+import { TooltipButton } from "#/components/shared/buttons/tooltip-button";
interface ChatMessageProps {
type: OpenHandsSourceType;
@@ -16,6 +17,7 @@ interface ChatMessageProps {
actions?: Array<{
icon: React.ReactNode;
onClick: () => void;
+ tooltip?: string;
}>;
}
@@ -66,17 +68,35 @@ export function ChatMessage({
"items-center gap-1",
)}
>
- {actions?.map((action, index) => (
- <button
- key={index}
- type="button"
- onClick={action.onClick}
- className="button-base p-1 cursor-pointer"
- aria-label={`Action ${index + 1}`}
- >
- {action.icon}
- </button>
- ))}
+ {actions?.map((action, index) =>
+ action.tooltip ? (
+ <TooltipButton
+ key={index}
+ tooltip={action.tooltip}
+ ariaLabel={action.tooltip}
+ placement="top"
+ >
+ <button
+ type="button"
+ onClick={action.onClick}
+ className="button-base p-1 cursor-pointer"
+ aria-label={`Action ${index + 1}`}
+ >
+ {action.icon}
+ </button>
+ </TooltipButton>
+ ) : (
+ <button
+ key={index}
+ type="button"
+ onClick={action.onClick}
+ className="button-base p-1 cursor-pointer"
+ aria-label={`Action ${index + 1}`}
+ >
+ {action.icon}
+ </button>
+ ),
+ )}
<CopyToClipboardButton
isHidden={!isHovering}
diff --git a/frontend/src/components/features/chat/event-message.tsx b/frontend/src/components/features/chat/event-message.tsx
index 29ad3dc44c..7bffbb5e83 100644
--- a/frontend/src/components/features/chat/event-message.tsx
+++ b/frontend/src/components/features/chat/event-message.tsx
@@ -46,6 +46,7 @@ interface EventMessageProps {
actions?: Array<{
icon: React.ReactNode;
onClick: () => void;
+ tooltip?: string;
}>;
isInLast10Actions: boolean;
}
diff --git a/frontend/src/components/features/chat/messages.tsx b/frontend/src/components/features/chat/messages.tsx
index c5111506de..6187583506 100644
--- a/frontend/src/components/features/chat/messages.tsx
+++ b/frontend/src/components/features/chat/messages.tsx
@@ -1,4 +1,5 @@
import React from "react";
+import { useTranslation } from "react-i18next";
import { createPortal } from "react-dom";
import { OpenHandsAction } from "#/types/core/actions";
import { OpenHandsObservation } from "#/types/core/observations";
@@ -62,6 +63,8 @@ export const Messages: React.FC<MessagesProps> = React.memo(
EventMicroagentStatus[]
>([]);
+ const { t } = useTranslation();
+
const actionHasObservationPair = React.useCallback(
(event: OpenHandsAction | OpenHandsObservation): boolean => {
if (isOpenHandsAction(event)) {
@@ -243,6 +246,7 @@ export const Messages: React.FC<MessagesProps> = React.memo(
setSelectedEventId(message.id);
setShowLaunchMicroagentModal(true);
},
+ tooltip: t("MICROAGENT$ADD_TO_MEMORY"),
},
]
: undefined
diff --git a/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx b/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx
index 00888d99d2..b96379d7c2 100644
--- a/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx
+++ b/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx
@@ -76,6 +76,10 @@ export function LaunchMicroagentModal({
</button>
</div>
+ <span className="text-sm text-[#A3A3A3] font-normal leading-5">
+ {t("MICROAGENT$DEFINITION")}
+ </span>
+
<form
data-testid="launch-microagent-modal"
onSubmit={onSubmit}
diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.ts
index 14f06e142c..23a3ea6273 100644
--- a/frontend/src/i18n/declaration.ts
+++ b/frontend/src/i18n/declaration.ts
@@ -823,4 +823,6 @@ export enum I18nKey {
SETTINGS$SECURITY_ANALYZER_NONE = "SETTINGS$SECURITY_ANALYZER_NONE",
SETTINGS$SECURITY_ANALYZER_INVARIANT = "SETTINGS$SECURITY_ANALYZER_INVARIANT",
COMMON$HIGH_RISK = "COMMON$HIGH_RISK",
+ MICROAGENT$DEFINITION = "MICROAGENT$DEFINITION",
+ MICROAGENT$ADD_TO_MEMORY = "MICROAGENT$ADD_TO_MEMORY",
}
diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json
index 7df631c5c9..8aae5b0243 100644
--- a/frontend/src/i18n/translation.json
+++ b/frontend/src/i18n/translation.json
@@ -13166,5 +13166,37 @@
"tr": "Yüksek Risk",
"de": "Hohes Risiko",
"uk": "Високий ризик"
+ },
+ "MICROAGENT$DEFINITION": {
+ "en": "Microagents are specialized prompts that enhance OpenHands with domain-specific knowledge. They provide expert guidance, automate common tasks, and ensure consistent practices across projects.",
+ "ja": "マイクロエージェントは、OpenHandsにドメイン固有の知識を追加するための専門的なプロンプトです。専門的なガイダンスを提供し、一般的なタスクを自動化し、プロジェクト全体で一貫した実践を保証します。",
+ "zh-CN": "微代理是增强 OpenHands 领域知识的专用提示。它们提供专家指导,自动化常见任务,并确保项目中的一致实践。",
+ "zh-TW": "微代理是增強 OpenHands 領域知識的專用提示。它們提供專家指導,自動化常見任務,並確保專案中的一致實踐。",
+ "ko-KR": "마이크로에이전트는 OpenHands에 도메인별 지식을 추가하는 특화된 프롬프트입니다. 전문가의 안내를 제공하고, 일반적인 작업을 자동화하며, 프로젝트 전반에 걸쳐 일관된 관행을 보장합니다.",
+ "no": "Mikroagenter er spesialiserte prompt som forbedrer OpenHands med domenespesifikk kunnskap. De gir ekspertråd, automatiserer vanlige oppgaver og sikrer konsistente praksiser på tvers av prosjekter.",
+ "it": "I microagenti sono prompt specializzati che arricchiscono OpenHands con conoscenze specifiche di dominio. Forniscono guida esperta, automatizzano attività comuni e garantiscono pratiche coerenti tra i progetti.",
+ "pt": "Microagentes são prompts especializados que aprimoram o OpenHands com conhecimento específico de domínio. Eles fornecem orientação especializada, automatizam tarefas comuns e garantem práticas consistentes em todos os projetos.",
+ "es": "Los microagentes son prompts especializados que mejoran OpenHands con conocimientos específicos de dominio. Proporcionan orientación experta, automatizan tareas comunes y aseguran prácticas consistentes en los proyectos.",
+ "ar": "الميكرووكلاء هم مطالبات متخصصة تعزز OpenHands بمعرفة متخصصة في المجال. يقدمون إرشادات خبراء، ويؤتمتون المهام الشائعة، ويضمنون ممارسات متسقة عبر المشاريع.",
+ "fr": "Les microagents sont des invites spécialisées qui enrichissent OpenHands avec des connaissances spécifiques au domaine. Ils fournissent des conseils d'experts, automatisent les tâches courantes et garantissent des pratiques cohérentes dans les projets.",
+ "tr": "Mikro ajanlar, OpenHands'i alanına özgü bilgilerle geliştiren özel istemlerdir. Uzman rehberliği sağlar, yaygın görevleri otomatikleştirir ve projeler arasında tutarlı uygulamalar sunar.",
+ "de": "Microagents sind spezialisierte Prompts, die OpenHands mit domänenspezifischem Wissen erweitern. Sie bieten fachkundige Anleitung, automatisieren gängige Aufgaben und sorgen für konsistente Praktiken in Projekten.",
+ "uk": "Мікроагенти — це спеціалізовані підказки, які розширюють OpenHands галузевими знаннями. Вони надають експертні поради, автоматизують типові завдання та забезпечують послідовні практики у проєктах."
+ },
+ "MICROAGENT$ADD_TO_MEMORY": {
+ "en": "Add to Microagent Memory",
+ "ja": "マイクロエージェントメモリに追加",
+ "zh-CN": "添加到微代理记忆",
+ "zh-TW": "加入微代理記憶體",
+ "ko-KR": "마이크로에이전트 메모리에 추가",
+ "no": "Legg til i mikroagentminne",
+ "it": "Aggiungi alla memoria del microagente",
+ "pt": "Adicionar à Memória do Microagente",
+ "es": "Agregar a la memoria del microagente",
+ "ar": "أضف إلى ذاكرة الميكرووكيل",
+ "fr": "Ajouter à la mémoire du microagent",
+ "tr": "Mikroajan Hafızasına Ekle",
+ "de": "Zur Microagent-Speicher hinzufügen",
+ "uk": "Додати до пам'яті мікроагента"
}
}