refactor: 移除系统重启功能及相关代码

- 删除 `system_router.py` 中的重启系统 API 及其相关逻辑。
- 更新 `system_api.js` 中的重启系统 API 调用。
- 移除 `SettingView.vue` 中的重启按钮和相关逻辑。
- 调整 `ChatSidebarComponent.vue` 和 `StatusBar.vue` 的样式,优化 UI 体验。
This commit is contained in:
Wenjie Zhang 2025-11-10 13:10:53 +08:00
parent cb2a57b2a1
commit bbcfacf975
5 changed files with 30 additions and 72 deletions

View File

@ -51,11 +51,6 @@ async def update_config_batch(items: dict = Body(...), current_user: User = Depe
return config.dump_config()
@system.post("/restart")
async def restart_system(current_user: User = Depends(get_superadmin_user)):
"""重启系统(仅超级管理员)"""
graph_base.start()
return {"message": "系统已重启"}
@system.get("/logs")

View File

@ -51,12 +51,7 @@ export const configApi = {
*/
updateConfigBatch: async (items) => apiAdminPost('/api/system/config/update', items),
/**
* 重启系统仅超级管理员
* @returns {Promise} - 重启结果
*/
restartSystem: async () => apiSuperAdminPost('/api/system/restart', {}),
/**
* 获取系统日志
* @returns {Promise} - 系统日志

View File

@ -304,10 +304,10 @@ const openAgentModal = () => {
.new-chat-btn {
width: 100%;
padding: 8px 12px;
border-radius: 6px;
background-color: var(--gray-50);
border-radius: 8px;
background-color: var(--gray-0);
color: var(--main-color);
border: none;
border: 1px solid var(--gray-150);
transition: all 0.2s ease;
font-weight: 500;
cursor: pointer;
@ -315,9 +315,10 @@ const openAgentModal = () => {
align-items: center;
justify-content: center;
gap: 8px;
box-shadow: 0 3px 4px rgba(0, 10, 20, 0.02);
&:hover:not(:disabled) {
background-color: var(--gray-100);
box-shadow: 0 3px 4px rgba(0, 10, 20, 0.07);
}
&:disabled {

View File

@ -28,7 +28,7 @@
class="task-center-badge"
>
<span class="task-center-button">
<ListChecks class="icon" />
<ClipboardList class="icon" />
<span class="task-center-label">任务中心</span>
</span>
</a-badge>
@ -42,7 +42,7 @@
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { useInfoStore } from '@/stores/info'
import { useUserStore } from '@/stores/user'
import { Clock, User, ListChecks } from 'lucide-vue-next'
import { Clock, User, ClipboardList } from 'lucide-vue-next'
import { useTaskerStore } from '@/stores/tasker'
import { storeToRefs } from 'pinia'
import dayjs from '@/utils/time'
@ -169,7 +169,8 @@ onUnmounted(() => {
.status-right {
display: flex;
align-items: center;
gap: 20px;
gap: 18px;
font-size: 13px;
}
.task-center-entry {
@ -187,27 +188,31 @@ onUnmounted(() => {
.task-center-button {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 12px;
gap: 8px;
padding: 6px 14px;
border-radius: 999px;
background-color: #f3f4f6;
color: #374151;
background-color: transparent;
color: var(--main-600, #2563eb);
font-size: 13px;
transition: background-color 0.2s ease, color 0.2s ease;
font-weight: 500;
border: 1px solid rgba(37, 99, 235, 0.3);
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.task-center-button .icon {
width: 14px;
height: 14px;
width: 15px;
height: 15px;
color: inherit;
}
.task-center-label {
font-weight: 500;
letter-spacing: 0.2px;
}
.task-center-entry:hover .task-center-button {
background-color: var(--main-40, #e5f0ff);
color: var(--main-500, #1d4ed8);
background-color: rgba(37, 99, 235, 0.08);
color: var(--main-700, #1d4ed8);
border-color: rgba(37, 99, 235, 0.5);
}
.task-center-badge :deep(.ant-badge-count) {
@ -220,17 +225,20 @@ onUnmounted(() => {
align-items: center;
gap: 6px;
font-size: 13px;
color: #6b7280;
line-height: 1.3;
color: var(--gray-600, #4b5563);
.icon {
width: 14px;
height: 14px;
width: 15px;
height: 15px;
color: var(--gray-600, #6b7280);
}
}
.current-time,
.user-greeting {
font-weight: 500;
color: var(--gray-900, #111827);
}
//

View File

@ -1,12 +1,6 @@
<template>
<div class="setting-view">
<HeaderComponent title="设置" class="setting-header">
<template #actions>
<a-button :type="isNeedRestart ? 'primary' : 'default'" @click="sendRestart" :icon="h(ReloadOutlined)">
{{ isNeedRestart ? '需要刷新' : '重新加载' }}
</a-button>
</template>
</HeaderComponent>
<div class="setting-container layout-container">
<div class="sider" v-if="state.windowWidth > 520">
@ -182,7 +176,6 @@ import { computed, reactive, ref, h, watch, onMounted, onUnmounted } from 'vue'
import { useConfigStore } from '@/stores/config';
import { useUserStore } from '@/stores/user'
import {
ReloadOutlined,
SettingOutlined,
CodeOutlined,
FolderOutlined,
@ -192,15 +185,12 @@ import {
import HeaderComponent from '@/components/HeaderComponent.vue';
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue';
import UserManagementComponent from '@/components/UserManagementComponent.vue';
import { notification, Button } from 'ant-design-vue';
import { configApi } from '@/apis/system_api'
import { embeddingApi } from '@/apis/knowledge_api'
import ModelSelectorComponent from '@/components/ModelSelectorComponent.vue';
const configStore = useConfigStore()
const userStore = useUserStore()
const items = computed(() => configStore.config._config_items)
const isNeedRestart = ref(false)
const state = reactive({
loading: false,
section: 'base',
@ -218,20 +208,6 @@ const rerankerChoices = computed(() => {
})
const preHandleChange = (key, e) => {
if (key == 'enable_reranker'
|| key == 'embed_model'
|| key == 'reranker'
|| key == 'model_local_paths') {
isNeedRestart.value = true
notification.info({
message: '需要重新加载模型',
description: '请点击右下角按钮重新加载模型',
placement: 'topLeft',
duration: 0,
btn: h(Button, { type: 'primary', onClick: sendRestart }, '立即重新加载')
})
}
return true
}
@ -285,23 +261,6 @@ onUnmounted(() => {
window.removeEventListener('resize', updateWindowWidth)
})
const sendRestart = () => {
console.log('Restarting...')
message.loading({ content: '重新加载模型中', key: "restart", duration: 0 });
configApi.restartSystem()
.then(() => {
console.log('Restarted')
message.success({ content: '重新加载完成!', key: "restart", duration: 2 });
setTimeout(() => {
window.location.reload()
}, 200)
})
.catch(error => {
console.error('重启服务失败:', error)
message.error({ content: `重启失败: ${error.message}`, key: "restart", duration: 2 });
});
}
// embedding