Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): simplify temporary chat closing
chengyongru516ae11c33c0
diff --git a/webui/src/components/ChatList.tsx b/webui/src/components/ChatList.tsxindex 2ba6b3d45..f71a4e32a 100644--- a/webui/src/components/ChatList.tsx+++ b/webui/src/components/ChatList.tsx@@ -252,7 +252,6 @@ export const ChatList = memo(function ChatList({running={running}onSelect={onSelect}onClose={onCloseTemporaryChat}- actionMenuPortalContainer={actionMenuPortalContainer}/>) : null}{limitedGroups.map((group, index) => {@@ -522,7 +521,6 @@ function TemporaryChatSection({running,onSelect,onClose,- actionMenuPortalContainer,}: {sessions: ChatSummary[];activeKey: string | null;@@ -530,7 +528,6 @@ function TemporaryChatSection({running: ReadonlySet<string>;onSelect: (key: string) => void;onClose?: (key: string) => void;- actionMenuPortalContainer?: HTMLElement | null;}) {const { t } = useTranslation();@@ -571,35 +568,14 @@ function TemporaryChatSection({</button><SessionActivityIndicator state={running.has(session.chatId) ? "running" : null} />{onClose ? (- <DropdownMenu modal={false}>- <DropdownMenuTrigger- className={cn(- "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground/75 opacity-40 transition-opacity",- "hover:bg-sidebar-accent hover:text-sidebar-foreground group-hover:opacity-100",- "focus-visible:opacity-100",- active && "opacity-100",- )}- aria-label={t("chat.actions", { title })}- >- <MoreHorizontal className="h-3.5 w-3.5" />- </DropdownMenuTrigger>- <DropdownMenuContent- align="end"- className={ACTION_MENU_CONTENT_CLASS}- portalContainer={actionMenuPortalContainer}- onCloseAutoFocus={(event) => event.preventDefault()}- >- <DropdownMenuItem- aria-label={t("temporaryChat.closeAction")}- className="whitespace-nowrap"- tone="destructive"- onSelect={() => onClose(session.key)}- >- <X className="h-4 w-4 shrink-0" />- {t("common.close")}- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>+ <button+ type="button"+ aria-label={t("temporaryChat.closeAction", { title })}+ onClick={() => onClose(session.key)}+ className="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"+ >+ <X className="h-3.5 w-3.5" aria-hidden />+ </button>) : null}</div></li>diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.jsonindex d5688ab17..8a44ad3bf 100644--- a/webui/src/i18n/locales/en/common.json+++ b/webui/src/i18n/locales/en/common.json@@ -54,7 +54,7 @@"description": "Not saved to history or memory. Reloading, closing, or losing the connection ends these chats. Requests still go to your model provider, and tool actions may leave changes.","clear": "Clear temporary chat","sectionTitle": "Temporary chats",- "closeAction": "Close temporary chat"+ "closeAction": "Close temporary chat: {{title}}"},"sidebar": {"navigation": "Sidebar navigation",diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.jsonindex 562444df8..eddb45c90 100644--- a/webui/src/i18n/locales/es/common.json+++ b/webui/src/i18n/locales/es/common.json@@ -54,7 +54,7 @@"description": "No se guarda en el historial ni en la memoria. Recargar, cerrar o perder la conexión finaliza estos chats. Las solicitudes siguen llegando al proveedor del modelo y las herramientas pueden dejar cambios.","clear": "Borrar chat temporal","sectionTitle": "Chats temporales",- "closeAction": "Cerrar chat temporal"+ "closeAction": "Cerrar chat temporal: {{title}}"},"sidebar": {"navigation": "Navegación de la barra lateral",diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.jsonindex 1733bd5f5..e137c2263 100644--- a/webui/src/i18n/locales/fr/common.json+++ b/webui/src/i18n/locales/fr/common.json@@ -54,7 +54,7 @@"description": "Elle n’est enregistrée ni dans l’historique ni dans la mémoire. Recharger, fermer ou perdre la connexion met fin à ces discussions. Les requêtes sont tout de même envoyées au fournisseur du modèle et les outils peuvent laisser des modifications.","clear": "Effacer la discussion temporaire","sectionTitle": "Discussions temporaires",- "closeAction": "Fermer la discussion temporaire"+ "closeAction": "Fermer la discussion temporaire : {{title}}"},"sidebar": {"navigation": "Navigation de la barre latérale",diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.jsonindex c43353812..8fdb17996 100644--- a/webui/src/i18n/locales/id/common.json+++ b/webui/src/i18n/locales/id/common.json@@ -54,7 +54,7 @@"description": "Tidak disimpan ke riwayat atau memori. Memuat ulang, menutup, atau kehilangan koneksi akan mengakhiri obrolan ini. Permintaan tetap dikirim ke penyedia model dan tindakan alat dapat meninggalkan perubahan.","clear": "Hapus obrolan sementara","sectionTitle": "Obrolan sementara",- "closeAction": "Tutup obrolan sementara"+ "closeAction": "Tutup obrolan sementara: {{title}}"},"sidebar": {"navigation": "Navigasi bilah samping",diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.jsonindex 1e5adaa42..54484400f 100644--- a/webui/src/i18n/locales/ja/common.json+++ b/webui/src/i18n/locales/ja/common.json@@ -54,7 +54,7 @@"description": "履歴やメモリには保存されません。再読み込み、ページを閉じる操作、接続切断で一時チャットは終了します。リクエストは引き続きモデルプロバイダーに送信され、ツール操作による変更は残る場合があります。","clear": "一時チャットを消去","sectionTitle": "一時チャット",- "closeAction": "一時チャットを閉じる"+ "closeAction": "一時チャット「{{title}}」を閉じる"},"sidebar": {"navigation": "サイドバーのナビゲーション",diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.jsonindex 0e06b109b..4ccf7b79d 100644--- a/webui/src/i18n/locales/ko/common.json+++ b/webui/src/i18n/locales/ko/common.json@@ -54,7 +54,7 @@"description": "기록이나 메모리에 저장되지 않습니다. 새로고침, 페이지 닫기 또는 연결 끊김 시 임시 채팅이 종료됩니다. 요청은 계속 모델 제공업체로 전송되며 도구 작업의 변경 사항은 남을 수 있습니다.","clear": "임시 채팅 지우기","sectionTitle": "임시 채팅",- "closeAction": "임시 채팅 닫기"+ "closeAction": "임시 채팅 닫기: {{title}}"},"sidebar": {"navigation": "사이드바 탐색",diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.jsonindex 09db79d5f..5093a8f48 100644--- a/webui/src/i18n/locales/pt-BR/common.json+++ b/webui/src/i18n/locales/pt-BR/common.json@@ -54,7 +54,7 @@"description": "Não é salvo no histórico nem na memória. Recarregar, fechar ou perder a conexão encerra estes chats. As solicitações ainda são enviadas ao provedor do modelo, e as ações das ferramentas podem deixar alterações.","clear": "Limpar chat temporário","sectionTitle": "Chats temporários",- "closeAction": "Fechar chat temporário"+ "closeAction": "Fechar chat temporário: {{title}}"},"sidebar": {"navigation": "Navegação da barra lateral",diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.jsonindex c80022993..00c410b92 100644--- a/webui/src/i18n/locales/vi/common.json+++ b/webui/src/i18n/locales/vi/common.json@@ -54,7 +54,7 @@"description": "Không được lưu vào lịch sử hoặc bộ nhớ. Tải lại, đóng trang hoặc mất kết nối sẽ kết thúc các cuộc trò chuyện này. Yêu cầu vẫn được gửi đến nhà cung cấp mô hình và thao tác công cụ có thể để lại thay đổi.","clear": "Xóa trò chuyện tạm thời","sectionTitle": "Trò chuyện tạm thời",- "closeAction": "Đóng trò chuyện tạm thời"+ "closeAction": "Đóng trò chuyện tạm thời: {{title}}"},"sidebar": {"navigation": "Điều hướng thanh bên",diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.jsonindex f480e5e3d..d1b9ab503 100644--- a/webui/src/i18n/locales/zh-CN/common.json+++ b/webui/src/i18n/locales/zh-CN/common.json@@ -54,7 +54,7 @@"description": "不会保存到历史记录或记忆。刷新、关闭页面或连接中断后,临时聊天会结束。请求仍会发送给模型提供商,工具操作也可能留下更改。","clear": "清空临时聊天","sectionTitle": "临时聊天",- "closeAction": "关闭临时聊天"+ "closeAction": "关闭临时聊天:{{title}}"},"sidebar": {"navigation": "侧边栏导航",diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.jsonindex 224d84a7a..0fea1f74a 100644--- a/webui/src/i18n/locales/zh-TW/common.json+++ b/webui/src/i18n/locales/zh-TW/common.json@@ -54,7 +54,7 @@"description": "不會儲存至歷史記錄或記憶。重新載入、關閉頁面或連線中斷後,臨時聊天會結束。請求仍會傳送給模型供應商,工具操作也可能留下變更。","clear": "清空臨時聊天","sectionTitle": "臨時聊天",- "closeAction": "關閉臨時聊天"+ "closeAction": "關閉臨時聊天:{{title}}"},"sidebar": {"navigation": "側邊欄導覽",diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsxindex d36db0f82..0b37c16d2 100644--- a/webui/src/tests/app-layout.test.tsx+++ b/webui/src/tests/app-layout.test.tsx@@ -469,10 +469,9 @@ describe("App layout", () => {expect(screen.getByText("Temporary chat")).toBeInTheDocument();expect(screen.queryByRole("button", { name: "Temporary chat" })).not.toBeInTheDocument();- fireEvent.pointerDown(within(sidebar).getByRole("button", {- name: "Topic actions for first private message",- }), { button: 0 });- fireEvent.click(await screen.findByRole("menuitem", { name: "Close temporary chat" }));+ fireEvent.click(within(sidebar).getByRole("button", {+ name: "Close temporary chat: first private message",+ }));await waitFor(() => expect(window.location.hash).toBe(secondHash));expect(within(sidebar).queryByRole("button", {name: "first private message",diff --git a/webui/src/tests/chat-list.test.tsx b/webui/src/tests/chat-list.test.tsxindex e3d184554..97e2cccd1 100644--- a/webui/src/tests/chat-list.test.tsx+++ b/webui/src/tests/chat-list.test.tsx@@ -179,14 +179,9 @@ describe("ChatList", () => {fireEvent.click(within(section).getByRole("button", { name: "Private planning" }));expect(onSelect).toHaveBeenCalledWith("temporary:temporary-one");- fireEvent.pointerDown(- within(section).getByRole("button", { name: "Topic actions for Private planning" }),- { button: 0 },- );- const closeItem = await screen.findByRole("menuitem", { name: "Close temporary chat" });- expect(closeItem).toHaveTextContent("Close");- expect(closeItem).toHaveClass("whitespace-nowrap");- fireEvent.click(closeItem);+ fireEvent.click(within(section).getByRole("button", {+ name: "Close temporary chat: Private planning",+ }));expect(onClose).toHaveBeenCalledWith("temporary:temporary-one");});