fix(webui): remove unused bot identity settings

This commit is contained in:
chengyongru 2026-08-03 14:00:42 +08:00 committed by chengyongru
parent f7a6bc2d21
commit 5c72fdcd88
19 changed files with 29 additions and 122 deletions

View File

@ -2583,6 +2583,8 @@ async def test_settings_api_returns_safe_subset_and_updates_whitelist(
assert body["agent"]["model_preset"] == "default"
assert body["agent"]["max_tokens"] == 8192
assert body["agent"]["timezone"] == "UTC"
assert "bot_name" not in body["agent"]
assert "bot_icon" not in body["agent"]
assert body["agent"]["tool_hint_max_length"] == 40
presets = {preset["name"]: preset for preset in body["model_presets"]}
assert presets["default"]["active"] is True
@ -2874,8 +2876,8 @@ async def test_settings_api_returns_safe_subset_and_updates_whitelist(
assert saved.model_presets["fast-writing"].model == "openai/gpt-5.5"
assert saved.model_presets["fast-writing"].provider == "openai"
assert saved.agents.defaults.timezone == "Asia/Shanghai"
assert saved.agents.defaults.bot_name == "Nano"
assert saved.agents.defaults.bot_icon == "N"
assert saved.agents.defaults.bot_name == "nanobot"
assert saved.agents.defaults.bot_icon == "🐈"
assert saved.agents.defaults.tool_hint_max_length == 120
assert saved.providers.openrouter.api_key == "sk-or-next"
assert saved.providers.openrouter.api_base == "https://openrouter.ai/api/v1"

View File

@ -1234,8 +1234,6 @@ def settings_payload(
"temperature": effective_preset.temperature,
"reasoning_effort": effective_preset.reasoning_effort,
"timezone": defaults.timezone,
"bot_name": defaults.bot_name,
"bot_icon": defaults.bot_icon,
"tool_hint_max_length": defaults.tool_hint_max_length,
},
"model_presets": model_presets,
@ -1406,24 +1404,6 @@ def update_agent_settings(query: QueryParams) -> dict[str, Any]:
changed = True
restart_required = True
bot_name = _query_first_alias(query, "bot_name", "botName")
if bot_name is not None:
bot_name = bot_name.strip()
if not bot_name:
raise WebUISettingsError("bot_name is required")
if defaults.bot_name != bot_name:
defaults.bot_name = bot_name
changed = True
restart_required = True
bot_icon = _query_first_alias(query, "bot_icon", "botIcon")
if bot_icon is not None:
bot_icon = bot_icon.strip()
if defaults.bot_icon != bot_icon:
defaults.bot_icon = bot_icon
changed = True
restart_required = True
tool_hint_max_length = _query_first_alias(
query,
"tool_hint_max_length",

View File

@ -234,8 +234,6 @@ interface AgentSettingsDraft {
temperature: number;
reasoningEffort: string;
timezone: string;
botName: string;
botIcon: string;
toolHintMaxLength: number;
}
@ -475,8 +473,6 @@ const DEFAULT_AGENT_SETTINGS_DRAFT: AgentSettingsDraft = {
temperature: 0.1,
reasoningEffort: "",
timezone: "UTC",
botName: "nanobot",
botIcon: "",
toolHintMaxLength: 40,
};
@ -544,8 +540,6 @@ function agentDraftFromPayload(
temperature: activePreset?.temperature ?? payload.agent.temperature,
reasoningEffort: activePreset?.reasoning_effort ?? "",
timezone: payload.agent.timezone,
botName: payload.agent.bot_name,
botIcon: payload.agent.bot_icon,
toolHintMaxLength: payload.agent.tool_hint_max_length,
};
}
@ -1081,11 +1075,7 @@ export function SettingsView({
const runtimeDirty = useMemo(() => {
if (!settings) return false;
return (
form.timezone !== settings.agent.timezone ||
form.botName !== settings.agent.bot_name ||
form.botIcon !== settings.agent.bot_icon
);
return form.timezone !== settings.agent.timezone;
}, [form, settings]);
const imageGenerationDirty = useMemo(() => {
@ -1406,8 +1396,6 @@ export function SettingsView({
try {
const payload = await updateSettings(token, {
timezone: form.timezone,
botName: form.botName,
botIcon: form.botIcon,
});
applyPayload(payload);
if (payload.requires_restart) {
@ -8415,23 +8403,15 @@ function RuntimeSettings({
return (
<div className="space-y-7">
<section>
<SettingsSectionTitle>{tx("settings.sections.identity", "Identity")}</SettingsSectionTitle>
<SettingsGroup>
<SettingsRow title={tx("settings.rows.botName", "Bot name")} description={tx("settings.help.botName", "Shown wherever nanobot uses a display name.")}>
<Input
value={form.botName}
onChange={(event) => setForm((prev) => ({ ...prev, botName: event.target.value }))}
className="h-8 w-[220px] rounded-full text-[13px]"
/>
</SettingsRow>
<SettingsRow title={tx("settings.rows.botIcon", "Bot icon")} description={tx("settings.help.botIcon", "Short emoji or text shown with the bot name.")}>
<Input
value={form.botIcon}
onChange={(event) => setForm((prev) => ({ ...prev, botIcon: event.target.value }))}
className="h-8 w-[120px] rounded-full text-center text-[13px]"
/>
</SettingsRow>
<SettingsRow title={tx("settings.rows.timezone", "Timezone")} description={tx("settings.help.timezone", "Used for schedules and time-aware replies.")}>
<SettingsSectionTitle>{tx("settings.sections.regional", "Regional")}</SettingsSectionTitle>
<SettingsGroup>
<SettingsRow
title={tx("settings.rows.timezone", "Timezone")}
description={tx(
"settings.help.timezone",
"Used for schedules and time-aware replies.",
)}
>
<TimezonePicker
value={form.timezone}
onChange={(timezone) => setForm((prev) => ({ ...prev, timezone }))}

View File

@ -99,7 +99,7 @@
"webBehavior": "Behavior",
"cliApps": "CLI apps",
"mcp": "MCP services",
"identity": "Identity",
"regional": "Regional",
"webuiSafety": "Web safety",
"capabilities": "Capabilities",
"apps": "Apps",
@ -190,8 +190,6 @@
"defaultImageSize": "Default size",
"maxImagesPerTurn": "Max images per turn",
"imageSaveDir": "Save directory",
"botName": "Bot name",
"botIcon": "Bot icon",
"timezone": "Timezone",
"workspacePath": "Default workspace",
"localServiceAccess": "Local services",
@ -235,8 +233,6 @@
"defaultAspectRatio": "Used when the prompt does not choose an aspect ratio.",
"defaultImageSize": "Size hint sent to providers that support it.",
"maxImagesPerTurn": "Upper bound for one generate_image request.",
"botName": "Shown wherever nanobot uses a display name.",
"botIcon": "Short emoji or text shown with the bot name.",
"timezone": "Used for schedules and time-aware replies.",
"cliAppsCatalog": "Install only the app-specific CLI adapters nanobot can run locally; native apps stay untouched.",
"cliAppsFilter": "Search by app, category, or capability.",

View File

@ -97,7 +97,7 @@
"imageDefaults": "Valores predeterminados",
"webSearch": "Búsqueda web",
"webBehavior": "Comportamiento",
"identity": "Identidad",
"regional": "Configuración regional",
"webuiSafety": "Seguridad de WebUI",
"capabilities": "Capacidades",
"cliApps": "Aplicaciones CLI",
@ -136,8 +136,6 @@
"defaultImageSize": "Tamaño predeterminado",
"maxImagesPerTurn": "Máx. imágenes por turno",
"imageSaveDir": "Directorio de guardado",
"botName": "Nombre del bot",
"botIcon": "Icono del bot",
"timezone": "Zona horaria",
"workspacePath": "Workspace predeterminado",
"localServiceAccess": "Servicios locales",
@ -179,8 +177,6 @@
"defaultAspectRatio": "Se usa cuando el prompt no elige una proporción.",
"defaultImageSize": "Pista de tamaño enviada a proveedores compatibles.",
"maxImagesPerTurn": "Límite superior para una solicitud generate_image.",
"botName": "Se muestra donde nanobot usa un nombre visible.",
"botIcon": "Emoji o texto corto junto al nombre del bot.",
"timezone": "Se usa para horarios y respuestas con conciencia temporal.",
"localServiceAccess": "Permite que comandos shell con Full Access alcancen servicios localhost.",
"webuiDefaultAccess": "Usado por chats web sin permiso específico de proyecto.",

View File

@ -97,7 +97,7 @@
"imageDefaults": "Valeurs par défaut",
"webSearch": "Recherche web",
"webBehavior": "Comportement",
"identity": "Identité",
"regional": "Paramètres régionaux",
"webuiSafety": "Sécurité WebUI",
"capabilities": "Capacités",
"cliApps": "Applications CLI",
@ -136,8 +136,6 @@
"defaultImageSize": "Taille par défaut",
"maxImagesPerTurn": "Images max. par tour",
"imageSaveDir": "Dossier denregistrement",
"botName": "Nom du bot",
"botIcon": "Icône du bot",
"timezone": "Fuseau horaire",
"workspacePath": "Espace de travail par défaut",
"localServiceAccess": "Services locaux",
@ -179,8 +177,6 @@
"defaultAspectRatio": "Utilisé lorsque le prompt ne choisit pas de ratio.",
"defaultImageSize": "Indication de taille envoyée aux fournisseurs compatibles.",
"maxImagesPerTurn": "Limite supérieure pour une requête generate_image.",
"botName": "Affiché là où nanobot utilise un nom visible.",
"botIcon": "Emoji ou texte court affiché avec le nom du bot.",
"timezone": "Utilisé pour les horaires et les réponses tenant compte du temps.",
"localServiceAccess": "Autorise les commandes shell Full Access à atteindre les services localhost.",
"webuiDefaultAccess": "Utilisé par les chats web sans permission propre au projet.",

View File

@ -97,7 +97,7 @@
"imageDefaults": "Default",
"webSearch": "Pencarian web",
"webBehavior": "Perilaku",
"identity": "Identitas",
"regional": "Regional",
"webuiSafety": "Keamanan WebUI",
"capabilities": "Kemampuan",
"cliApps": "Aplikasi CLI",
@ -136,8 +136,6 @@
"defaultImageSize": "Ukuran default",
"maxImagesPerTurn": "Maks. gambar per giliran",
"imageSaveDir": "Direktori simpan",
"botName": "Nama bot",
"botIcon": "Ikon bot",
"timezone": "Zona waktu",
"workspacePath": "Workspace default",
"localServiceAccess": "Layanan lokal",
@ -179,8 +177,6 @@
"defaultAspectRatio": "Se usa cuando el prompt no elige una proporción.",
"defaultImageSize": "Petunjuk ukuran yang dikirim ke penyedia yang mendukungnya.",
"maxImagesPerTurn": "Batas atas untuk satu permintaan generate_image.",
"botName": "Se muestra donde nanobot usa un nombre visible.",
"botIcon": "Emoji o texto corto junto al nombre del bot.",
"timezone": "Se usa para horarios y respuestas con conciencia temporal.",
"localServiceAccess": "Izinkan perintah shell Full Access menjangkau layanan localhost.",
"webuiDefaultAccess": "Digunakan oleh chat web tanpa izin khusus proyek.",

View File

@ -97,7 +97,7 @@
"imageDefaults": "既定値",
"webSearch": "ウェブ検索",
"webBehavior": "動作",
"identity": "ID",
"regional": "地域",
"webuiSafety": "WebUI の安全性",
"capabilities": "機能",
"cliApps": "CLI アプリ",
@ -136,8 +136,6 @@
"defaultImageSize": "既定のサイズ",
"maxImagesPerTurn": "1 ターンの最大画像数",
"imageSaveDir": "保存先ディレクトリ",
"botName": "Bot 名",
"botIcon": "Bot アイコン",
"timezone": "タイムゾーン",
"workspacePath": "既定のワークスペース",
"localServiceAccess": "ローカルサービス",
@ -179,8 +177,6 @@
"defaultAspectRatio": "プロンプトで比率が指定されていない場合に使用します。",
"defaultImageSize": "対応しているプロバイダーへ送信するサイズ指定です。",
"maxImagesPerTurn": "1 回の generate_image リクエストで生成できる画像数の上限です。",
"botName": "nanobot が表示名を使う場所に表示されます。",
"botIcon": "Bot 名の横に表示する短い emoji またはテキストです。",
"timezone": "スケジュールと時刻を考慮する返信に使用します。",
"localServiceAccess": "Full Access の shell コマンドが localhost サービスにアクセスできるようにします。",
"webuiDefaultAccess": "プロジェクト固有の権限がない Web チャットで使用します。",

View File

@ -97,7 +97,7 @@
"imageDefaults": "기본값",
"webSearch": "웹 검색",
"webBehavior": "동작",
"identity": "ID",
"regional": "지역",
"webuiSafety": "WebUI 보안",
"capabilities": "기능",
"cliApps": "CLI 앱",
@ -136,8 +136,6 @@
"defaultImageSize": "기본 크기",
"maxImagesPerTurn": "턴당 최대 이미지 수",
"imageSaveDir": "저장 디렉터리",
"botName": "Bot 이름",
"botIcon": "Bot 아이콘",
"timezone": "시간대",
"workspacePath": "기본 작업공간",
"localServiceAccess": "로컬 서비스",
@ -179,8 +177,6 @@
"defaultAspectRatio": "프롬프트가 비율을 선택하지 않을 때 사용됩니다.",
"defaultImageSize": "지원하는 제공자에 보낼 크기 힌트입니다.",
"maxImagesPerTurn": "한 번의 generate_image 요청에서 생성할 수 있는 이미지 상한입니다.",
"botName": "nanobot이 표시 이름을 사용하는 곳에 표시됩니다.",
"botIcon": "Bot 이름 옆에 표시할 짧은 emoji 또는 텍스트입니다.",
"timezone": "일정과 시간 인식 답변에 사용됩니다.",
"localServiceAccess": "Full Access shell 명령이 localhost 서비스에 접근할 수 있게 합니다.",
"webuiDefaultAccess": "프로젝트별 권한이 없는 Web 채팅에 사용됩니다.",

View File

@ -99,7 +99,7 @@
"webBehavior": "Comportamento",
"cliApps": "Apps CLI",
"mcp": "Servidores MCP",
"identity": "Identidade",
"regional": "Regional",
"webuiSafety": "Segurança da WebUI",
"capabilities": "Capacidades",
"apps": "Aplicativos",
@ -190,8 +190,6 @@
"defaultImageSize": "Tamanho padrão",
"maxImagesPerTurn": "Máx. de imagens por turno",
"imageSaveDir": "Diretório de salvamento",
"botName": "Nome do bot",
"botIcon": "Ícone do bot",
"timezone": "Fuso horário",
"workspacePath": "Workspace padrão",
"localServiceAccess": "Serviços locais",
@ -235,8 +233,6 @@
"defaultAspectRatio": "Usado quando o prompt não escolhe uma proporção.",
"defaultImageSize": "Dica de tamanho enviada a provedores compatíveis.",
"maxImagesPerTurn": "Limite superior para uma requisição de generate_image.",
"botName": "Exibido sempre que o nanobot usa um nome visível.",
"botIcon": "Emoji ou texto curto exibido junto ao nome do bot.",
"timezone": "Usado para agendamentos e respostas sensíveis ao horário.",
"cliAppsCatalog": "Instale apenas os adaptadores CLI de apps que o nanobot pode executar localmente; apps nativos permanecem intactos.",
"cliAppsFilter": "Busque por app, categoria ou capacidade.",

View File

@ -97,7 +97,7 @@
"imageDefaults": "Mặc định",
"webSearch": "Tìm kiếm web",
"webBehavior": "Hành vi",
"identity": "Danh tính",
"regional": "Khu vực",
"webuiSafety": "An toàn WebUI",
"capabilities": "Khả năng",
"cliApps": "Ứng dụng CLI",
@ -136,8 +136,6 @@
"defaultImageSize": "Kích thước mặc định",
"maxImagesPerTurn": "Ảnh tối đa mỗi lượt",
"imageSaveDir": "Thư mục lưu",
"botName": "Tên bot",
"botIcon": "Biểu tượng bot",
"timezone": "Múi giờ",
"workspacePath": "Workspace mặc định",
"localServiceAccess": "Dịch vụ cục bộ",
@ -179,8 +177,6 @@
"defaultAspectRatio": "Se usa cuando el prompt no elige una proporción.",
"defaultImageSize": "Gợi ý kích thước gửi tới nhà cung cấp hỗ trợ.",
"maxImagesPerTurn": "Giới hạn trên cho một yêu cầu generate_image.",
"botName": "Se muestra donde nanobot usa un nombre visible.",
"botIcon": "Emoji o texto corto junto al nombre del bot.",
"timezone": "Se usa para horarios y respuestas con conciencia temporal.",
"localServiceAccess": "Cho phép lệnh shell Full Access truy cập dịch vụ localhost.",
"webuiDefaultAccess": "Dùng cho chat web không có quyền riêng theo dự án.",

View File

@ -99,7 +99,7 @@
"webBehavior": "行为",
"cliApps": "CLI 应用",
"mcp": "MCP 服务",
"identity": "身份",
"regional": "区域",
"webuiSafety": "WebUI 安全",
"capabilities": "能力",
"apps": "应用",
@ -190,8 +190,6 @@
"defaultImageSize": "默认尺寸",
"maxImagesPerTurn": "每轮最大图片数",
"imageSaveDir": "保存目录",
"botName": "Bot 名称",
"botIcon": "Bot 图标",
"timezone": "时区",
"workspacePath": "默认工作区",
"localServiceAccess": "本机服务",
@ -235,8 +233,6 @@
"defaultAspectRatio": "当提示词没有指定比例时使用。",
"defaultImageSize": "发送给支持此选项的提供商的尺寸提示。",
"maxImagesPerTurn": "单次 generate_image 请求可生成的图片上限。",
"botName": "显示在 nanobot 使用展示名称的地方。",
"botIcon": "显示在 Bot 名称旁的短 emoji 或文字。",
"timezone": "用于日程和需要时间感知的回复。",
"cliAppsCatalog": "只安装 nanobot 可本地运行的应用 CLI 适配器;不会改动原生应用。",
"cliAppsFilter": "按应用、类别或能力搜索。",

View File

@ -97,7 +97,7 @@
"imageDefaults": "預設值",
"webSearch": "網頁搜尋",
"webBehavior": "行為",
"identity": "身分",
"regional": "區域",
"webuiSafety": "WebUI 安全",
"capabilities": "能力",
"cliApps": "CLI 應用程式",
@ -136,8 +136,6 @@
"defaultImageSize": "預設尺寸",
"maxImagesPerTurn": "每輪最大圖片數",
"imageSaveDir": "儲存目錄",
"botName": "Bot 名稱",
"botIcon": "Bot 圖示",
"timezone": "時區",
"workspacePath": "預設工作區",
"localServiceAccess": "本機服務",
@ -179,8 +177,6 @@
"defaultAspectRatio": "提示詞未指定比例時使用。",
"defaultImageSize": "傳送給支援此選項的供應商的尺寸提示。",
"maxImagesPerTurn": "單次 generate_image 請求可產生的圖片數上限。",
"botName": "顯示於 nanobot 所有使用顯示名稱的位置。",
"botIcon": "顯示在 Bot 名稱旁的短 emoji 或文字。",
"timezone": "用於排程,以及需要時間資訊的回覆。",
"localServiceAccess": "允許具有完整存取權的 shell 命令存取 localhost 服務。",
"webuiDefaultAccess": "用於未指定個別專案權限的 Web 聊天。",

View File

@ -858,8 +858,6 @@ export async function updateSettings(
query.set("context_window_tokens", String(update.contextWindowTokens));
}
if (update.timezone !== undefined) query.set("timezone", update.timezone);
if (update.botName !== undefined) query.set("bot_name", update.botName);
if (update.botIcon !== undefined) query.set("bot_icon", update.botIcon);
if (update.toolHintMaxLength !== undefined) {
query.set("tool_hint_max_length", String(update.toolHintMaxLength));
}

View File

@ -490,8 +490,6 @@ export interface SettingsPayload {
temperature: number;
reasoning_effort: string | null;
timezone: string;
bot_name: string;
bot_icon: string;
tool_hint_max_length: number;
};
model_presets: Array<{
@ -1028,8 +1026,6 @@ export interface SettingsUpdate {
modelPreset?: string | null;
contextWindowTokens?: number;
timezone?: string;
botName?: string;
botIcon?: string;
toolHintMaxLength?: number;
}

View File

@ -413,13 +413,11 @@ describe("webui API helpers", () => {
provider: "openrouter",
contextWindowTokens: 262144,
timezone: "Asia/Shanghai",
botName: "nanobot",
botIcon: "nb",
toolHintMaxLength: 120,
});
expect(fetch).toHaveBeenCalledWith(
"/api/settings/update?model_preset=default&model=openrouter%2Ftest&provider=openrouter&context_window_tokens=262144&timezone=Asia%2FShanghai&bot_name=nanobot&bot_icon=nb&tool_hint_max_length=120",
"/api/settings/update?model_preset=default&model=openrouter%2Ftest&provider=openrouter&context_window_tokens=262144&timezone=Asia%2FShanghai&tool_hint_max_length=120",
expect.objectContaining({
headers: { Authorization: "Bearer tok" },
}),

View File

@ -62,8 +62,6 @@ function baseSettingsPayload() {
temperature: 0.1,
reasoning_effort: null,
timezone: "UTC",
bot_name: "nanobot",
bot_icon: "nb",
tool_hint_max_length: 40,
},
model_presets: [{
@ -1761,8 +1759,6 @@ describe("App layout", () => {
temperature: 0.1,
reasoning_effort: null,
timezone: "UTC",
bot_name: "nanobot",
bot_icon: "nb",
tool_hint_max_length: 40,
},
model_presets: [
@ -2089,7 +2085,10 @@ describe("App layout", () => {
expect(screen.queryByDisplayValue("unsaved-brave-key")).not.toBeInTheDocument();
fireEvent.click(within(settingsNav).getByRole("button", { name: "System" }));
expect(screen.getByText("Bot name")).toBeInTheDocument();
expect(screen.getByText("Regional")).toBeInTheDocument();
expect(screen.getByText("Timezone")).toBeInTheDocument();
expect(screen.queryByText("Bot name")).not.toBeInTheDocument();
expect(screen.queryByText("Bot icon")).not.toBeInTheDocument();
expect(screen.queryByText("Tool hint length")).not.toBeInTheDocument();
expect(screen.queryByText("Heartbeat")).not.toBeInTheDocument();
expect(screen.queryByText("Dream")).not.toBeInTheDocument();
@ -2281,8 +2280,6 @@ describe("App layout", () => {
temperature: 0.1,
reasoning_effort: null,
timezone: "UTC",
bot_name: "nanobot",
bot_icon: "nb",
tool_hint_max_length: 40,
},
model_presets: [

View File

@ -30,8 +30,6 @@ function settingsPayload(): SettingsPayload {
temperature: 0.1,
reasoning_effort: null,
timezone: "UTC",
bot_name: "nanobot",
bot_icon: "nb",
tool_hint_max_length: 40,
},
model_presets: [{

View File

@ -309,8 +309,6 @@ function modelSettings(model: string, provider: string): SettingsPayload {
temperature: 0.7,
reasoning_effort: null,
timezone: "UTC",
bot_name: "nanobot",
bot_icon: "",
tool_hint_max_length: 40,
},
model_presets: [{