diff --git a/dashboard/src/i18n/locales/en-US/features/console.json b/dashboard/src/i18n/locales/en-US/features/console.json index 34f65540a..812a9a4a6 100644 --- a/dashboard/src/i18n/locales/en-US/features/console.json +++ b/dashboard/src/i18n/locales/en-US/features/console.json @@ -10,7 +10,10 @@ "packageLabel": "*Package name, e.g. llmtuner", "mirrorLabel": "Force PyPI repository URL (optional)", "mirrorHint": "Force PyPI repository URL > Config item `PyPI Repository Address`", - "installButton": "Install" + "installButton": "Install", + "installSuccess": "Installation successful.", + "installFailed": "Installation failed.", + "requestFailed": "Request failed." }, "debugHint": { "text": "Debug logs can be enabled in \"Configuration File → System → Console Log Level\"" diff --git a/dashboard/src/i18n/locales/ru-RU/features/console.json b/dashboard/src/i18n/locales/ru-RU/features/console.json index 1bbd45d34..d77505d07 100644 --- a/dashboard/src/i18n/locales/ru-RU/features/console.json +++ b/dashboard/src/i18n/locales/ru-RU/features/console.json @@ -10,7 +10,10 @@ "packageLabel": "*Имя пакета, например: llmtuner", "mirrorLabel": "Использовать зеркало PyPI (опционально)", "mirrorHint": "Приоритет зеркала PyPI > настройки «Зеркало репозитория PyPI»", - "installButton": "Установить" + "installButton": "Установить", + "installSuccess": "Установка выполнена успешно.", + "installFailed": "Ошибка установки.", + "requestFailed": "Ошибка запроса." }, "debugHint": { "text": "Для отображения Debug-логов необходимо установить соответствующий уровень в «Конфигурация → Система → Уровень логирования»" diff --git a/dashboard/src/i18n/locales/zh-CN/features/console.json b/dashboard/src/i18n/locales/zh-CN/features/console.json index 844662650..f24f80ad6 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/console.json +++ b/dashboard/src/i18n/locales/zh-CN/features/console.json @@ -10,7 +10,10 @@ "packageLabel": "*库名,如 llmtuner", "mirrorLabel": "强制 PyPI 软件仓库链接(可选)", "mirrorHint": "强制 PyPI 软件仓库链接 > 配置项 `PyPI 软件仓库地址`", - "installButton": "安装" + "installButton": "安装", + "installSuccess": "安装成功。", + "installFailed": "安装失败。", + "requestFailed": "请求失败。" }, "debugHint": { "text": "Debug 日志需要在「配置文件 → 系统 → 控制台日志级别」中开启" diff --git a/dashboard/src/views/ConsolePage.vue b/dashboard/src/views/ConsolePage.vue index a18c327a2..daf50269b 100644 --- a/dashboard/src/views/ConsolePage.vue +++ b/dashboard/src/views/ConsolePage.vue @@ -2,6 +2,7 @@ import ConsoleDisplayer from '@/components/shared/ConsoleDisplayer.vue'; import { useModuleI18n } from '@/i18n/composables'; import axios from 'axios'; +import { useToast } from '@/utils/toast'; const { tm } = useModuleI18n('features/console'); @@ -37,10 +38,6 @@ const { tm } = useModuleI18n('features/console'); {{ tm('pipInstall.mirrorHint') }} -
- {{ status }} -
- @@ -69,8 +66,7 @@ export default { package: '', mirror: '' }, - loading: false, - status: '' + loading: false } }, mounted() { @@ -88,17 +84,19 @@ export default { }, methods: { pipInstall() { + const toast = useToast(); this.loading = true; axios.post('/api/update/pip-install', this.pipInstallPayload) .then(res => { - this.status = res.data.message; - setTimeout(() => { - this.status = ''; + if (res.data.status === 'ok') { + toast.success(res.data.message || tm('pipInstall.installSuccess')); this.pipDialog = false; - }, 2000); + } else { + toast.error(res.data.message || tm('pipInstall.installFailed')); + } }) .catch(err => { - this.status = err.response.data.message; + toast.error(err.response?.data?.message || tm('pipInstall.requestFailed')); }).finally(() => { this.loading = false; });