Skip to content

Commit bbcfacf

Browse files
committed
refactor: 移除系统重启功能及相关代码
- 删除 `system_router.py` 中的重启系统 API 及其相关逻辑。 - 更新 `system_api.js` 中的重启系统 API 调用。 - 移除 `SettingView.vue` 中的重启按钮和相关逻辑。 - 调整 `ChatSidebarComponent.vue` 和 `StatusBar.vue` 的样式,优化 UI 体验。
1 parent cb2a57b commit bbcfacf

File tree

5 files changed

+30
-72
lines changed

5 files changed

+30
-72
lines changed

server/routers/system_router.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ async def update_config_batch(items: dict = Body(...), current_user: User = Depe
5151
return config.dump_config()
5252

5353

54-
@system.post("/restart")
55-
async def restart_system(current_user: User = Depends(get_superadmin_user)):
56-
"""重启系统(仅超级管理员)"""
57-
graph_base.start()
58-
return {"message": "系统已重启"}
5954

6055

6156
@system.get("/logs")

web/src/apis/system_api.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ export const configApi = {
5151
*/
5252
updateConfigBatch: async (items) => apiAdminPost('/api/system/config/update', items),
5353

54-
/**
55-
* 重启系统(仅超级管理员)
56-
* @returns {Promise} - 重启结果
57-
*/
58-
restartSystem: async () => apiSuperAdminPost('/api/system/restart', {}),
59-
54+
6055
/**
6156
* 获取系统日志
6257
* @returns {Promise} - 系统日志

web/src/components/ChatSidebarComponent.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,20 +304,21 @@ const openAgentModal = () => {
304304
.new-chat-btn {
305305
width: 100%;
306306
padding: 8px 12px;
307-
border-radius: 6px;
308-
background-color: var(--gray-50);
307+
border-radius: 8px;
308+
background-color: var(--gray-0);
309309
color: var(--main-color);
310-
border: none;
310+
border: 1px solid var(--gray-150);
311311
transition: all 0.2s ease;
312312
font-weight: 500;
313313
cursor: pointer;
314314
display: flex;
315315
align-items: center;
316316
justify-content: center;
317317
gap: 8px;
318+
box-shadow: 0 3px 4px rgba(0, 10, 20, 0.02);
318319
319320
&:hover:not(:disabled) {
320-
background-color: var(--gray-100);
321+
box-shadow: 0 3px 4px rgba(0, 10, 20, 0.07);
321322
}
322323
323324
&:disabled {

web/src/components/StatusBar.vue

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class="task-center-badge"
2929
>
3030
<span class="task-center-button">
31-
<ListChecks class="icon" />
31+
<ClipboardList class="icon" />
3232
<span class="task-center-label">任务中心</span>
3333
</span>
3434
</a-badge>
@@ -42,7 +42,7 @@
4242
import { ref, computed, onMounted, onUnmounted } from 'vue'
4343
import { useInfoStore } from '@/stores/info'
4444
import { useUserStore } from '@/stores/user'
45-
import { Clock, User, ListChecks } from 'lucide-vue-next'
45+
import { Clock, User, ClipboardList } from 'lucide-vue-next'
4646
import { useTaskerStore } from '@/stores/tasker'
4747
import { storeToRefs } from 'pinia'
4848
import dayjs from '@/utils/time'
@@ -169,7 +169,8 @@ onUnmounted(() => {
169169
.status-right {
170170
display: flex;
171171
align-items: center;
172-
gap: 20px;
172+
gap: 18px;
173+
font-size: 13px;
173174
}
174175
175176
.task-center-entry {
@@ -187,27 +188,31 @@ onUnmounted(() => {
187188
.task-center-button {
188189
display: inline-flex;
189190
align-items: center;
190-
gap: 6px;
191-
padding: 4px 12px;
191+
gap: 8px;
192+
padding: 6px 14px;
192193
border-radius: 999px;
193-
background-color: #f3f4f6;
194-
color: #374151;
194+
background-color: transparent;
195+
color: var(--main-600, #2563eb);
195196
font-size: 13px;
196-
transition: background-color 0.2s ease, color 0.2s ease;
197+
font-weight: 500;
198+
border: 1px solid rgba(37, 99, 235, 0.3);
199+
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
197200
}
198201
199202
.task-center-button .icon {
200-
width: 14px;
201-
height: 14px;
203+
width: 15px;
204+
height: 15px;
205+
color: inherit;
202206
}
203207
204208
.task-center-label {
205-
font-weight: 500;
209+
letter-spacing: 0.2px;
206210
}
207211
208212
.task-center-entry:hover .task-center-button {
209-
background-color: var(--main-40, #e5f0ff);
210-
color: var(--main-500, #1d4ed8);
213+
background-color: rgba(37, 99, 235, 0.08);
214+
color: var(--main-700, #1d4ed8);
215+
border-color: rgba(37, 99, 235, 0.5);
211216
}
212217
213218
.task-center-badge :deep(.ant-badge-count) {
@@ -220,17 +225,20 @@ onUnmounted(() => {
220225
align-items: center;
221226
gap: 6px;
222227
font-size: 13px;
223-
color: #6b7280;
228+
line-height: 1.3;
229+
color: var(--gray-600, #4b5563);
224230
225231
.icon {
226-
width: 14px;
227-
height: 14px;
232+
width: 15px;
233+
height: 15px;
234+
color: var(--gray-600, #6b7280);
228235
}
229236
}
230237
231238
.current-time,
232239
.user-greeting {
233240
font-weight: 500;
241+
color: var(--gray-900, #111827);
234242
}
235243
236244
// 响应式设计

web/src/views/SettingView.vue

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<template>
22
<div class="setting-view">
33
<HeaderComponent title="设置" class="setting-header">
4-
5-
<template #actions>
6-
<a-button :type="isNeedRestart ? 'primary' : 'default'" @click="sendRestart" :icon="h(ReloadOutlined)">
7-
{{ isNeedRestart ? '需要刷新' : '重新加载' }}
8-
</a-button>
9-
</template>
104
</HeaderComponent>
115
<div class="setting-container layout-container">
126
<div class="sider" v-if="state.windowWidth > 520">
@@ -182,7 +176,6 @@ import { computed, reactive, ref, h, watch, onMounted, onUnmounted } from 'vue'
182176
import { useConfigStore } from '@/stores/config';
183177
import { useUserStore } from '@/stores/user'
184178
import {
185-
ReloadOutlined,
186179
SettingOutlined,
187180
CodeOutlined,
188181
FolderOutlined,
@@ -192,15 +185,12 @@ import {
192185
import HeaderComponent from '@/components/HeaderComponent.vue';
193186
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue';
194187
import UserManagementComponent from '@/components/UserManagementComponent.vue';
195-
import { notification, Button } from 'ant-design-vue';
196-
import { configApi } from '@/apis/system_api'
197188
import { embeddingApi } from '@/apis/knowledge_api'
198189
import ModelSelectorComponent from '@/components/ModelSelectorComponent.vue';
199190
200191
const configStore = useConfigStore()
201192
const userStore = useUserStore()
202193
const items = computed(() => configStore.config._config_items)
203-
const isNeedRestart = ref(false)
204194
const state = reactive({
205195
loading: false,
206196
section: 'base',
@@ -218,20 +208,6 @@ const rerankerChoices = computed(() => {
218208
})
219209
220210
const preHandleChange = (key, e) => {
221-
222-
if (key == 'enable_reranker'
223-
|| key == 'embed_model'
224-
|| key == 'reranker'
225-
|| key == 'model_local_paths') {
226-
isNeedRestart.value = true
227-
notification.info({
228-
message: '需要重新加载模型',
229-
description: '请点击右下角按钮重新加载模型',
230-
placement: 'topLeft',
231-
duration: 0,
232-
btn: h(Button, { type: 'primary', onClick: sendRestart }, '立即重新加载')
233-
})
234-
}
235211
return true
236212
}
237213
@@ -285,23 +261,6 @@ onUnmounted(() => {
285261
window.removeEventListener('resize', updateWindowWidth)
286262
})
287263
288-
const sendRestart = () => {
289-
console.log('Restarting...')
290-
message.loading({ content: '重新加载模型中', key: "restart", duration: 0 });
291-
292-
configApi.restartSystem()
293-
.then(() => {
294-
console.log('Restarted')
295-
message.success({ content: '重新加载完成!', key: "restart", duration: 2 });
296-
setTimeout(() => {
297-
window.location.reload()
298-
}, 200)
299-
})
300-
.catch(error => {
301-
console.error('重启服务失败:', error)
302-
message.error({ content: `重启失败: ${error.message}`, key: "restart", duration: 2 });
303-
});
304-
}
305264
306265
307266
// 检查所有embedding模型状态

0 commit comments

Comments
 (0)