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
refactor(webui): remove obsolete topic rename dialog mode
chengyongruc7ab7aa6da28
diff --git a/webui/src/App.tsx b/webui/src/App.tsxindex 498b34b5f..d8ac957e3 100644--- a/webui/src/App.tsx+++ b/webui/src/App.tsx@@ -165,9 +165,9 @@ const DeleteConfirm = lazy(async () => {const module = await import("@/components/DeleteConfirm");return { default: module.DeleteConfirm };});-const RenameChatDialog = lazy(async () => {- const module = await import("@/components/RenameChatDialog");- return { default: module.RenameChatDialog };+const RenameDialog = lazy(async () => {+ const module = await import("@/components/RenameDialog");+ return { default: module.RenameDialog };});function SurfaceLoadingFallback({ label }: { label?: string }) {@@ -3156,7 +3156,7 @@ function Shell({) : null}{pendingTabRename ? (<Suspense fallback={null}>- <RenameChatDialog+ <RenameDialogopentitle={pendingTabRename.label}dialogTitle={t("workbench.renameGroupTitle")}@@ -3169,7 +3169,7 @@ function Shell({) : null}{pendingProjectRename ? (<Suspense fallback={null}>- <RenameChatDialog+ <RenameDialogopentitle={pendingProjectRename.label}dialogTitle={t("chat.renameProjectTitle")}diff --git a/webui/src/components/RenameChatDialog.tsx b/webui/src/components/RenameDialog.tsxsimilarity index 80%rename from webui/src/components/RenameChatDialog.tsxrename to webui/src/components/RenameDialog.tsxindex da558cd4f..aa921533c 100644--- a/webui/src/components/RenameChatDialog.tsx+++ b/webui/src/components/RenameDialog.tsx@@ -12,17 +12,17 @@ import {} from "@/components/ui/dialog";import { Input } from "@/components/ui/input";-interface RenameChatDialogProps {+interface RenameDialogProps {open: boolean;title: string;- dialogTitle?: string;- description?: string;- placeholder?: string;+ dialogTitle: string;+ description: string;+ placeholder: string;onCancel: () => void;onConfirm: (title: string) => void;}-export function RenameChatDialog({+export function RenameDialog({open,title,dialogTitle,@@ -30,7 +30,7 @@ export function RenameChatDialog({placeholder,onCancel,onConfirm,-}: RenameChatDialogProps) {+}: RenameDialogProps) {const { t } = useTranslation();const [value, setValue] = useState(title);@@ -54,15 +54,13 @@ export function RenameChatDialog({}}><DialogHeader className="text-left">- <DialogTitle>{dialogTitle ?? t("chat.renameTitle")}</DialogTitle>- <DialogDescription>- {description ?? t("chat.renameDescription")}- </DialogDescription>+ <DialogTitle>{dialogTitle}</DialogTitle>+ <DialogDescription>{description}</DialogDescription></DialogHeader><Inputvalue={value}onChange={(event) => setValue(event.target.value)}- placeholder={placeholder ?? t("chat.renamePlaceholder")}+ placeholder={placeholder}autoFocusmaxLength={160}/>diff --git a/webui/src/dev/gallery/shell.tsx b/webui/src/dev/gallery/shell.tsxindex d1ce1a085..0a640bdf8 100644--- a/webui/src/dev/gallery/shell.tsx+++ b/webui/src/dev/gallery/shell.tsx@@ -1,5 +1,6 @@import { useRef, useState, type ReactNode } from "react";import { createPortal } from "react-dom";+import { useTranslation } from "react-i18next";import { CapabilityMentionToken } from "@/components/CliAppMentionText";import type { CapabilityMentionSegment } from "@/lib/composer-mention-text";@@ -7,7 +8,7 @@ import { DeleteConfirm } from "@/components/DeleteConfirm";import { FileActions } from "@/components/FileActions";import { InlineTokenHighlight, INLINE_TOKEN_HIGHLIGHT_COLOR } from "@/components/InlineTokenHighlight";import { MessageLinksMenu, useMessageWebLinks } from "@/components/MessageLinksMenu";-import { RenameChatDialog } from "@/components/RenameChatDialog";+import { RenameDialog } from "@/components/RenameDialog";import { SessionHandleLabel } from "@/components/SessionHandleLabel";import { SlashCommandText } from "@/components/SlashCommandText";import { StartupShell } from "@/components/StartupShell";@@ -43,12 +44,17 @@ const sessionMention: SessionMention = {};function RenamePreview() {+ const { t } = useTranslation();const [open, setOpen] = useState(false);const [title, setTitle] = useState("组件设计");return <div className="space-y-4"><p className="text-sm">{title}</p>- <Button variant="outline" onClick={() => setOpen(true)}>重命名会话</Button>- <RenameChatDialog open={open} title={title} onCancel={() => setOpen(false)}+ <Button variant="outline" onClick={() => setOpen(true)}>重命名分组</Button>+ <RenameDialog open={open} title={title}+ dialogTitle={t("workbench.renameGroupTitle")}+ description={t("workbench.renameGroupDescription")}+ placeholder={t("workbench.renameGroupPlaceholder")}+ onCancel={() => setOpen(false)}onConfirm={(next) => { setTitle(next); setOpen(false); }} /><p role="status" className="text-xs text-muted-foreground">保存后更新上方标题。</p></div>;@@ -244,9 +250,9 @@ function CompatibilityPreview() {const components = "webui/src/components/";export const shellExamples: ComponentExample[] = [- { title: "RenameChatDialog · 重命名", files: ["RenameChatDialog"], Preview: RenamePreview,- description: "打开真实重命名对话框,编辑标题并保存。", options: "open 控制显示,title 设置初值,onConfirm 接收去除两端空白的标题。空标题无法保存。",- code: '<RenameChatDialog open={open} title={title} onCancel={close} onConfirm={rename} />' },+ { title: "RenameDialog · 分组与项目改名", files: ["RenameDialog"], Preview: RenamePreview,+ description: "预览分组和项目使用的改名弹窗;话题在会话列表中行内改名。", options: "调用方提供 dialogTitle、description 和 placeholder。title 设置初值,onConfirm 接收去除两端空白的标题。空标题无法保存。",+ code: '<RenameDialog open={open} title={title} dialogTitle="Rename group" description="Give this group a name." placeholder="Group name" onCancel={close} onConfirm={rename} />' },{ title: "DeleteConfirm · 删除确认", files: ["DeleteConfirm"], Preview: DeletePreview,description: "切换单个、批量和关联自动任务的删除确认。", options: "count 控制批量文案;automations 展示关联任务、计划与下次运行时间。确认按钮调用 onConfirm。",code: '<DeleteConfirm open={open} title="组件设计" count={1} automations={jobs} onCancel={close} onConfirm={remove} />' },diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.jsonindex 736694415..7100394f3 100644--- a/webui/src/i18n/locales/en/common.json+++ b/webui/src/i18n/locales/en/common.json@@ -1763,8 +1763,6 @@"pin": "Pin","unpin": "Unpin","rename": "Rename",- "renameTitle": "Rename topic",- "renameDescription": "Change the topic's display name in WebUI.","renamePlaceholder": "Topic name","renameProjectTitle": "Rename project","renameProjectDescription": "Change only this project's name in the WebUI sidebar.",diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.jsonindex 9f28c4ffc..8aefbcc58 100644--- a/webui/src/i18n/locales/es/common.json+++ b/webui/src/i18n/locales/es/common.json@@ -1564,8 +1564,6 @@"pin": "Fijar","unpin": "Desfijar","rename": "Renombrar",- "renameTitle": "Renombrar tema",- "renameDescription": "Cambia el nombre del tema en WebUI.","renamePlaceholder": "Nombre del tema","renameProjectTitle": "Renombrar proyecto","renameProjectDescription": "Cambia solo el nombre del proyecto en la barra lateral WebUI.",diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.jsonindex 4304af5a4..69ad97831 100644--- a/webui/src/i18n/locales/fr/common.json+++ b/webui/src/i18n/locales/fr/common.json@@ -1563,8 +1563,6 @@"pin": "Épingler","unpin": "Désépingler","rename": "Renommer",- "renameTitle": "Renommer le sujet",- "renameDescription": "Changez le nom du sujet affiché dans WebUI.","renamePlaceholder": "Nom du sujet","renameProjectTitle": "Renommer le projet","renameProjectDescription": "Changez seulement le nom du projet dans la barre latérale WebUI.",diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.jsonindex ea1309039..d1a7d6caf 100644--- a/webui/src/i18n/locales/id/common.json+++ b/webui/src/i18n/locales/id/common.json@@ -1563,8 +1563,6 @@"pin": "Sematkan","unpin": "Lepas sematan","rename": "Ganti nama",- "renameTitle": "Ubah nama topik",- "renameDescription": "Ubah nama tampilan topik di WebUI.","renamePlaceholder": "Nama topik","renameProjectTitle": "Ubah nama proyek","renameProjectDescription": "Ubah hanya nama proyek di sidebar WebUI.",diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.jsonindex 6225a0981..260dbb155 100644--- a/webui/src/i18n/locales/ja/common.json+++ b/webui/src/i18n/locales/ja/common.json@@ -1563,8 +1563,6 @@"pin": "ピン留め","unpin": "ピン留めを解除","rename": "名前を変更",- "renameTitle": "トピック名を変更",- "renameDescription": "WebUI に表示するトピック名を変更します。","renamePlaceholder": "トピック名","renameProjectTitle": "プロジェクト名を変更","renameProjectDescription": "WebUI のサイドバーに表示するプロジェクト名だけを変更します。",diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.jsonindex e5352bfde..e368fecb4 100644--- a/webui/src/i18n/locales/ko/common.json+++ b/webui/src/i18n/locales/ko/common.json@@ -1563,8 +1563,6 @@"pin": "고정","unpin": "고정 해제","rename": "이름 변경",- "renameTitle": "주제 이름 변경",- "renameDescription": "WebUI에 표시되는 주제 이름을 변경하세요.","renamePlaceholder": "주제 이름","renameProjectTitle": "프로젝트 이름 변경","renameProjectDescription": "WebUI 사이드바의 프로젝트 이름만 변경하세요.",diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.jsonindex 49645921a..58875906e 100644--- a/webui/src/i18n/locales/pt-BR/common.json+++ b/webui/src/i18n/locales/pt-BR/common.json@@ -1577,8 +1577,6 @@"pin": "Fixar","unpin": "Desafixar","rename": "Renomear",- "renameTitle": "Renomear tópico",- "renameDescription": "Altere o nome do tópico exibido no WebUI.","renamePlaceholder": "Nome do tópico","renameProjectTitle": "Renomear projeto","renameProjectDescription": "Altere apenas o nome do projeto na barra lateral WebUI.",diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.jsonindex d7130a134..2cb0c1f6b 100644--- a/webui/src/i18n/locales/vi/common.json+++ b/webui/src/i18n/locales/vi/common.json@@ -1563,8 +1563,6 @@"pin": "Ghim","unpin": "Bỏ ghim","rename": "Đổi tên",- "renameTitle": "Đổi tên chủ đề",- "renameDescription": "Đổi tên chủ đề hiển thị trong WebUI.","renamePlaceholder": "Tên chủ đề","renameProjectTitle": "Đổi tên dự án","renameProjectDescription": "Chỉ đổi tên dự án trong thanh bên WebUI.",diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.jsonindex c611490b5..32c13e121 100644--- a/webui/src/i18n/locales/zh-CN/common.json+++ b/webui/src/i18n/locales/zh-CN/common.json@@ -1763,8 +1763,6 @@"pin": "置顶","unpin": "取消置顶","rename": "重命名",- "renameTitle": "话题改名",- "renameDescription": "修改 WebUI 中显示的话题名称","renamePlaceholder": "话题名称","renameProjectTitle": "项目改名","renameProjectDescription": "仅修改 WebUI 侧栏中的项目名称",diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.jsonindex 39b994a72..d8f571c80 100644--- a/webui/src/i18n/locales/zh-TW/common.json+++ b/webui/src/i18n/locales/zh-TW/common.json@@ -1563,8 +1563,6 @@"pin": "置頂","unpin": "取消置頂","rename": "重新命名",- "renameTitle": "話題改名",- "renameDescription": "修改 WebUI 中顯示的話題名稱","renamePlaceholder": "話題名稱","renameProjectTitle": "專案改名","renameProjectDescription": "僅修改 WebUI 側欄中的專案名稱",diff --git a/webui/src/tests/chat-list-focus.test.tsx b/webui/src/tests/chat-list-focus.test.tsxindex 266957f9c..225b804d8 100644--- a/webui/src/tests/chat-list-focus.test.tsx+++ b/webui/src/tests/chat-list-focus.test.tsx@@ -1,10 +1,8 @@-import { useState } from "react";import { act, render, screen, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { ChatList } from "@/components/ChatList";-import { RenameChatDialog } from "@/components/RenameChatDialog";import type { ChatSummary } from "@/lib/types";import { mockBrowserFocus } from "./browser-focus";@@ -15,7 +13,6 @@ const topic: ChatSummary = {};function SidebarFocusCase() {- const [rename, setRename] = useState<string | null>(null);return <><ChatListsessions={[topic, {@@ -44,12 +41,10 @@ function SidebarFocusCase() {onToggleArchive={vi.fn()}onAttachPane={vi.fn()}onRequestRename={vi.fn().mockResolvedValue(undefined)}- onRequestRenameTab={(_key, title) => setRename(title)}- onRequestRenameProject={(_key, title) => setRename(title)}+ onRequestRenameTab={vi.fn()}+ onRequestRenameProject={vi.fn()}/><button>Outside destination</button>- <RenameChatDialog open={rename !== null} title={rename ?? ""}- onCancel={() => setRename(null)} onConfirm={() => setRename(null)} /></>;}