Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions astrbot/dashboard/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
from astrbot.dashboard.services.update_service import (
DEMO_MODE,
UpdateService,
call_check_migration_needed_v4,
call_do_migration_v4,
call_download_dashboard,
call_get_dashboard_version,
call_pip_install,
Expand Down Expand Up @@ -141,8 +139,6 @@ def create_dashboard_asgi_app(
download_dashboard_func=call_download_dashboard,
get_dashboard_version_func=call_get_dashboard_version,
pip_install_func=call_pip_install,
check_migration_needed_func=call_check_migration_needed_v4,
do_migration_func=call_do_migration_v4,
demo_mode=DEMO_MODE,
clear_site_data_headers=CLEAR_SITE_DATA_HEADERS,
),
Expand Down
8 changes: 5 additions & 3 deletions astrbot/dashboard/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def get_auth_service(request: Request) -> AuthService:


def _payload(payload) -> dict:
if payload is None:
return {}
return payload.model_dump(exclude_none=True)


Expand Down Expand Up @@ -331,7 +333,7 @@ async def _setup(

async def _totp_setup(
request: Request,
payload: TotpSetupRequest,
payload: TotpSetupRequest | None,
service: AuthService,
):
return _auth_service_response(
Expand Down Expand Up @@ -438,7 +440,7 @@ async def dashboard_setup_authenticated(
@router.post("/auth/totp/setup")
async def totp_setup(
request: Request,
payload: TotpSetupRequest,
payload: TotpSetupRequest | None = None,
_auth: AuthContext = Depends(require_system_scope),
service: AuthService = Depends(get_auth_service),
):
Expand All @@ -448,7 +450,7 @@ async def totp_setup(
@legacy_router.post("/totp/setup")
async def dashboard_totp_setup(
request: Request,
payload: TotpSetupRequest,
payload: TotpSetupRequest | None = None,
_username: str = Depends(require_dashboard_user),
service: AuthService = Depends(get_auth_service),
):
Expand Down
22 changes: 1 addition & 21 deletions astrbot/dashboard/api/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from astrbot.core import logger
from astrbot.dashboard.async_utils import run_maybe_async
from astrbot.dashboard.schemas import MigrationRequest, PipInstallRequest, UpdateRequest
from astrbot.dashboard.schemas import PipInstallRequest, UpdateRequest
from astrbot.dashboard.services.update_service import (
UpdateService,
UpdateServiceError,
Expand Down Expand Up @@ -174,23 +174,3 @@ async def install_dashboard_pip_package(
service: UpdateService = Depends(get_service),
):
return await _run(lambda: service.install_pip_package(_model_dict(payload)))


@router.post("/migrations")
async def run_migration(
payload: MigrationRequest | None = None,
_auth: AuthContext = Depends(require_system_scope),
service: UpdateService = Depends(get_service),
):
body = _model_dict(payload) if payload is not None else {}
return await _run(lambda: service.do_migration_v4(body))


@legacy_router.post("/migration")
async def run_dashboard_migration(
payload: MigrationRequest | None = None,
_username: str = Depends(require_dashboard_user),
service: UpdateService = Depends(get_service),
):
body = _model_dict(payload) if payload is not None else {}
return await _run(lambda: service.do_migration_v4(body))
4 changes: 0 additions & 4 deletions astrbot/dashboard/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ class PipInstallRequest(OpenModel):
mirror: str | None = None


class MigrationRequest(OpenModel):
platform_id_map: dict[str, Any] | None = None


class ChatProjectRequest(OpenModel):
project_id: str | None = None
title: str | None = None
Expand Down
3 changes: 0 additions & 3 deletions astrbot/dashboard/services/stat_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from astrbot.core.config.astrbot_config import AstrBotConfig
from astrbot.core.core_lifecycle import AstrBotCoreLifecycle
from astrbot.core.db import BaseDatabase
from astrbot.core.db.migration.helper import check_migration_needed_v4
from astrbot.core.db.po import ProviderStat
from astrbot.core.utils.astrbot_path import get_astrbot_path
from astrbot.core.utils.auth_password import (
Expand Down Expand Up @@ -87,7 +86,6 @@ async def is_default_cred(self):
) and not DEMO_MODE

async def get_version(self) -> dict:
need_migration = await check_migration_needed_v4(self.core_lifecycle.db)
storage_upgraded = await is_password_storage_upgraded(
self.db_helper,
self.config,
Expand All @@ -104,7 +102,6 @@ async def get_version(self) -> dict:
"change_pwd_hint": await self.is_default_cred(),
"md5_pwd_hint": md5_pwd_hint,
"password_upgrade_required": not storage_upgraded,
"need_migration": need_migration,
}

def get_start_time(self) -> dict:
Expand Down
37 changes: 0 additions & 37 deletions astrbot/dashboard/services/update_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
)
from astrbot.core.config.default import VERSION
from astrbot.core.core_lifecycle import AstrBotCoreLifecycle
from astrbot.core.db.migration.helper import (
check_migration_needed_v4 as _check_migration_needed_v4,
)
from astrbot.core.db.migration.helper import (
do_migration_v4 as _do_migration_v4,
)
from astrbot.core.updator import AstrBotUpdator
from astrbot.core.utils.io import (
download_dashboard as _download_dashboard,
Expand All @@ -35,8 +29,6 @@
pip_installer = _pip_installer
download_dashboard = _download_dashboard
get_dashboard_version = _get_dashboard_version
default_check_migration_needed_v4 = _check_migration_needed_v4
default_do_migration_v4 = _do_migration_v4


async def call_download_dashboard(*args, **kwargs):
Expand All @@ -51,14 +43,6 @@ async def call_pip_install(*args, **kwargs):
return await pip_installer.install(*args, **kwargs)


async def call_check_migration_needed_v4(*args, **kwargs):
return await default_check_migration_needed_v4(*args, **kwargs)


async def call_do_migration_v4(*args, **kwargs):
return await default_do_migration_v4(*args, **kwargs)


@dataclass
class UpdateServiceResult:
data: Any = None
Expand All @@ -80,8 +64,6 @@ def __init__(
download_dashboard_func: Callable[..., Awaitable[Any]],
get_dashboard_version_func: Callable[..., Awaitable[str | None]],
pip_install_func: Callable[..., Awaitable[Any]],
check_migration_needed_func: Callable[..., Awaitable[bool]],
do_migration_func: Callable[..., Awaitable[Any]],
demo_mode: bool,
clear_site_data_headers: dict,
) -> None:
Expand All @@ -90,8 +72,6 @@ def __init__(
self.download_dashboard = download_dashboard_func
self.get_dashboard_version = get_dashboard_version_func
self.pip_install = pip_install_func
self.check_migration_needed = check_migration_needed_func
self.do_migration = do_migration_func
self.demo_mode = demo_mode
self.clear_site_data_headers = clear_site_data_headers
self.update_progress: dict[str, dict] = {}
Expand All @@ -107,23 +87,6 @@ def get_update_progress(self, progress_id: str) -> UpdateServiceResult:
)
return UpdateServiceResult(data=progress)

async def do_migration_v4(self, data: object) -> UpdateServiceResult:
need_migration = await self.check_migration_needed(self.core_lifecycle.db)
if not need_migration:
return UpdateServiceResult(message="不需要进行迁移。")
try:
payload = data if isinstance(data, dict) else {}
platform_id_map = payload.get("platform_id_map", {})
await self.do_migration(
self.core_lifecycle.db,
platform_id_map,
self.core_lifecycle.astrbot_config,
)
return UpdateServiceResult(message="迁移成功。")
except Exception as exc:
logger.error(f"迁移失败: {traceback.format_exc()}")
raise UpdateServiceError(f"迁移失败: {exc!s}") from exc

async def check_update(self, update_type: str | None) -> UpdateServiceResult:
try:
dashboard_version = await self.get_dashboard_version()
Expand Down
12 changes: 1 addition & 11 deletions dashboard/src/api/generated/openapi-v1/sdk.gen.ts

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions dashboard/src/api/generated/openapi-v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,6 @@ export type MessagePart = {

export type type = 'text' | 'plain' | 'image' | 'file' | 'audio' | 'record' | 'video' | 'reply';

export type MigrationRequest = {
platform_id_map?: {
[key: string]: unknown;
};
[key: string]: unknown;
};

export type ModelScopeSyncRequest = {
access_token?: string;
};
Expand Down Expand Up @@ -3299,14 +3292,6 @@ export type InstallPipPackageResponse = (SuccessEnvelope);

export type InstallPipPackageError = unknown;

export type RunMigrationsData = {
body?: MigrationRequest;
};

export type RunMigrationsResponse = (SuccessEnvelope);

export type RunMigrationsError = unknown;

export type ListCronJobsData = {
query?: {
type?: string;
Expand Down
5 changes: 0 additions & 5 deletions dashboard/src/api/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
type LoginRequest,
type ListConversationsData,
type McpServerConfig,
type MigrationRequest,
type ModelScopeSyncRequest,
type PipInstallRequest,
type PluginVersionSupportRequest,
Expand Down Expand Up @@ -95,7 +94,6 @@ export interface ProviderEmbeddingDimensionData {
export interface VersionData {
version?: string;
dashboard_version?: string;
need_migration?: boolean;
change_pwd_hint?: boolean;
md5_pwd_hint?: boolean;
password_upgrade_required?: boolean;
Expand Down Expand Up @@ -574,9 +572,6 @@ export const updatesApi = {
openApiV1.installPipPackage({ body: payload }),
);
},
runMigrations(payload?: MigrationRequest) {
return typed<OpenConfig>(openApiV1.runMigrations({ body: payload }));
},
};

export const backupApi = {
Expand Down
26 changes: 25 additions & 1 deletion dashboard/src/assets/mdi-subset/materialdesignicons-subset.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Auto-generated MDI subset – 274 icons */
/* Auto-generated MDI subset – 280 icons */
/* Do not edit manually. Run: pnpm run subset-icons */

@font-face {
Expand Down Expand Up @@ -60,6 +60,10 @@
content: "\F002A";
}

.mdi-api::before {
content: "\F109B";
}

.mdi-api-off::before {
content: "\F1257";
}
Expand Down Expand Up @@ -308,6 +312,10 @@
content: "\F0193";
}

.mdi-content-save-check-outline::before {
content: "\F18EB";
}

.mdi-content-save-outline::before {
content: "\F0818";
}
Expand Down Expand Up @@ -616,6 +624,10 @@
content: "\F0315";
}

.mdi-lan-connect::before {
content: "\F0318";
}

.mdi-language-css3::before {
content: "\F031C";
}
Expand Down Expand Up @@ -792,6 +804,10 @@
content: "\F0601";
}

.mdi-palette-outline::before {
content: "\F0E0C";
}

.mdi-paperclip::before {
content: "\F03E2";
}
Expand Down Expand Up @@ -940,6 +956,10 @@
content: "\F0BC4";
}

.mdi-shield-lock-outline::before {
content: "\F0CCC";
}

.mdi-shuffle-variant::before {
content: "\F049F";
}
Expand Down Expand Up @@ -1056,6 +1076,10 @@
content: "\F0A7A";
}

.mdi-tune-variant::before {
content: "\F1542";
}

.mdi-unfold-more-horizontal::before {
content: "\F054F";
}
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion dashboard/src/components/ConfirmDialog.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-dialog v-model="isOpen" max-width="400">
<v-card>
<v-card-title class="text-h6">{{ title }}</v-card-title>
<v-card-title class="text-h3 pl-6 pt-4">{{ title }}</v-card-title>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The typography class text-h3 is extremely large in Vuetify 3 (3rem / 48px). For a standard confirmation dialog title, this will likely cause awkward wrapping and layout issues, especially on mobile devices. Consider using a more standard size like text-h5 or text-h6.

      <v-card-title class="text-h5 pl-6 pt-4">{{ title }}</v-card-title>

<v-card-text>{{ message }}</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
Expand Down
Loading
Loading