From 16ece263a6c975c3cbb32b9bf9f14bded68633dc Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Thu, 7 May 2026 13:06:05 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=90=AF=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E6=A3=80=E6=9F=A5webui=E7=89=88=E6=9C=AC=E5=B9=B6=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/package.json | 2 +- .../dynamic-form/DynamicConfigForm.tsx | 18 +- .../components/dynamic-form/DynamicField.tsx | 14 +- dashboard/src/components/layout/Header.tsx | 16 +- dashboard/src/components/layout/Layout.tsx | 4 +- dashboard/src/lib/version.ts | 2 +- dashboard/src/routes/config/bot.tsx | 22 +- src/config/config.py | 2 +- src/config/official_configs.py | 9 + src/main.py | 32 +- src/webui/dashboard_update.py | 283 ++++++++++++++++++ src/webui/routers/system.py | 86 +----- 12 files changed, 372 insertions(+), 118 deletions(-) create mode 100644 src/webui/dashboard_update.py diff --git a/dashboard/package.json b/dashboard/package.json index 234c422a..79fc2769 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -1,7 +1,7 @@ { "name": "maibot-dashboard", "private": true, - "version": "1.0.6", + "version": "1.0.7", "type": "module", "main": "./out/main/index.js", "scripts": { diff --git a/dashboard/src/components/dynamic-form/DynamicConfigForm.tsx b/dashboard/src/components/dynamic-form/DynamicConfigForm.tsx index ee1d7339..79fd246a 100644 --- a/dashboard/src/components/dynamic-form/DynamicConfigForm.tsx +++ b/dashboard/src/components/dynamic-form/DynamicConfigForm.tsx @@ -84,7 +84,7 @@ function DynamicConfigSection({ values: Record }) { return ( - +
@@ -296,15 +296,15 @@ export const DynamicConfigForm: React.FC = ({ row.length > 1 ? (
field.name).join('|')} - className="grid gap-4 py-1 md:grid-cols-[repeat(var(--field-row-count),minmax(0,1fr))]" + className="grid min-w-0 gap-4 py-1 md:grid-cols-[repeat(var(--field-row-count),minmax(0,1fr))]" style={{ '--field-row-count': row.length } as React.CSSProperties} > {row.map((field) => ( -
{renderField(field)}
+
{renderField(field)}
))}
) : ( -
{renderField(row[0])}
+
{renderField(row[0])}
) ))} @@ -322,7 +322,7 @@ export const DynamicConfigForm: React.FC = ({ ) return ( -
+
{visibleFields.length > 0 && (
{renderFieldList(visibleFields)} @@ -353,7 +353,7 @@ export const DynamicConfigForm: React.FC = ({ const HookComponent = hookEntry.component if (hookEntry.type === 'replace') { return ( -
+
= ({ } return ( -
+
= ({ } return ( - +
@@ -449,7 +449,7 @@ export const DynamicConfigForm: React.FC = ({ if (level === 0 && sectionColumns === 2 && visibleNestedSections.length > 1) { return ( -
+
{visibleNestedSections}
) diff --git a/dashboard/src/components/dynamic-form/DynamicField.tsx b/dashboard/src/components/dynamic-form/DynamicField.tsx index cfd6171a..3687ffd9 100644 --- a/dashboard/src/components/dynamic-form/DynamicField.tsx +++ b/dashboard/src/components/dynamic-form/DynamicField.tsx @@ -158,7 +158,7 @@ export const DynamicField: React.FC = ({ const label = ( ) @@ -281,8 +281,8 @@ export const DynamicField: React.FC = ({ const renderSwitch = () => { const checked = Boolean(value) return ( -
-
+
+
{renderFieldHeader()}
= ({ const step = schema.step ?? 1 return ( -
+
onChange(values[0])} @@ -466,7 +466,7 @@ export const DynamicField: React.FC = ({ className="flex flex-col gap-2 py-2 sm:flex-row sm:items-center" style={{ '--field-input-width': schema['x-input-width'] ?? '12rem' } as React.CSSProperties} > -
+
{renderFieldHeader()}
@@ -477,7 +477,7 @@ export const DynamicField: React.FC = ({ } return ( -
+
{renderFieldHeader()} {/* Input component */} diff --git a/dashboard/src/components/layout/Header.tsx b/dashboard/src/components/layout/Header.tsx index c9f085f5..a9c2ee37 100644 --- a/dashboard/src/components/layout/Header.tsx +++ b/dashboard/src/components/layout/Header.tsx @@ -87,12 +87,12 @@ export function Header({ return (
{!inheritsPageBackground && } -
+
{/* 移动端菜单按钮 */}
-
+
{/* 工作区切换:复用 Tabs 组件 + Motion 动画指示器 */} @@ -165,7 +165,7 @@ export function Header({ -
+
{/* 后端切换按钮(仅 Electron) */} {isElectron() && ( <> @@ -211,7 +211,7 @@ export function Header({ variant="ghost" size="sm" onClick={() => window.open('https://docs.mai-mai.org', '_blank')} - className="gap-2" + className="hidden gap-2 sm:inline-flex" title={t('header.viewDocs')} > @@ -221,7 +221,7 @@ export function Header({ {/* 语言切换 */} - {/* 分隔线 */} -
+
{/* 登出按钮 */}