refactor: 移除系统重启功能及相关代码
- 删除 `system_router.py` 中的重启系统 API 及其相关逻辑。 - 更新 `system_api.js` 中的重启系统 API 调用。 - 移除 `SettingView.vue` 中的重启按钮和相关逻辑。 - 调整 `ChatSidebarComponent.vue` 和 `StatusBar.vue` 的样式,优化 UI 体验。
This commit is contained in:
parent
cb2a57b2a1
commit
bbcfacf975
@ -51,11 +51,6 @@ async def update_config_batch(items: dict = Body(...), current_user: User = Depe
|
|||||||
return config.dump_config()
|
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")
|
@system.get("/logs")
|
||||||
|
|||||||
@ -51,11 +51,6 @@ export const configApi = {
|
|||||||
*/
|
*/
|
||||||
updateConfigBatch: async (items) => apiAdminPost('/api/system/config/update', items),
|
updateConfigBatch: async (items) => apiAdminPost('/api/system/config/update', items),
|
||||||
|
|
||||||
/**
|
|
||||||
* 重启系统(仅超级管理员)
|
|
||||||
* @returns {Promise} - 重启结果
|
|
||||||
*/
|
|
||||||
restartSystem: async () => apiSuperAdminPost('/api/system/restart', {}),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取系统日志
|
* 获取系统日志
|
||||||
|
|||||||
@ -304,10 +304,10 @@ const openAgentModal = () => {
|
|||||||
.new-chat-btn {
|
.new-chat-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
background-color: var(--gray-50);
|
background-color: var(--gray-0);
|
||||||
color: var(--main-color);
|
color: var(--main-color);
|
||||||
border: none;
|
border: 1px solid var(--gray-150);
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -315,9 +315,10 @@ const openAgentModal = () => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
box-shadow: 0 3px 4px rgba(0, 10, 20, 0.02);
|
||||||
|
|
||||||
&:hover:not(:disabled) {
|
&:hover:not(:disabled) {
|
||||||
background-color: var(--gray-100);
|
box-shadow: 0 3px 4px rgba(0, 10, 20, 0.07);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
class="task-center-badge"
|
class="task-center-badge"
|
||||||
>
|
>
|
||||||
<span class="task-center-button">
|
<span class="task-center-button">
|
||||||
<ListChecks class="icon" />
|
<ClipboardList class="icon" />
|
||||||
<span class="task-center-label">任务中心</span>
|
<span class="task-center-label">任务中心</span>
|
||||||
</span>
|
</span>
|
||||||
</a-badge>
|
</a-badge>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||||
import { useInfoStore } from '@/stores/info'
|
import { useInfoStore } from '@/stores/info'
|
||||||
import { useUserStore } from '@/stores/user'
|
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 { useTaskerStore } from '@/stores/tasker'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import dayjs from '@/utils/time'
|
import dayjs from '@/utils/time'
|
||||||
@ -169,7 +169,8 @@ onUnmounted(() => {
|
|||||||
.status-right {
|
.status-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20px;
|
gap: 18px;
|
||||||
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-center-entry {
|
.task-center-entry {
|
||||||
@ -187,27 +188,31 @@ onUnmounted(() => {
|
|||||||
.task-center-button {
|
.task-center-button {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 8px;
|
||||||
padding: 4px 12px;
|
padding: 6px 14px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background-color: #f3f4f6;
|
background-color: transparent;
|
||||||
color: #374151;
|
color: var(--main-600, #2563eb);
|
||||||
font-size: 13px;
|
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 {
|
.task-center-button .icon {
|
||||||
width: 14px;
|
width: 15px;
|
||||||
height: 14px;
|
height: 15px;
|
||||||
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-center-label {
|
.task-center-label {
|
||||||
font-weight: 500;
|
letter-spacing: 0.2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-center-entry:hover .task-center-button {
|
.task-center-entry:hover .task-center-button {
|
||||||
background-color: var(--main-40, #e5f0ff);
|
background-color: rgba(37, 99, 235, 0.08);
|
||||||
color: var(--main-500, #1d4ed8);
|
color: var(--main-700, #1d4ed8);
|
||||||
|
border-color: rgba(37, 99, 235, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-center-badge :deep(.ant-badge-count) {
|
.task-center-badge :deep(.ant-badge-count) {
|
||||||
@ -220,17 +225,20 @@ onUnmounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #6b7280;
|
line-height: 1.3;
|
||||||
|
color: var(--gray-600, #4b5563);
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
width: 14px;
|
width: 15px;
|
||||||
height: 14px;
|
height: 15px;
|
||||||
|
color: var(--gray-600, #6b7280);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-time,
|
.current-time,
|
||||||
.user-greeting {
|
.user-greeting {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
color: var(--gray-900, #111827);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 响应式设计
|
// 响应式设计
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="setting-view">
|
<div class="setting-view">
|
||||||
<HeaderComponent title="设置" class="setting-header">
|
<HeaderComponent title="设置" class="setting-header">
|
||||||
|
|
||||||
<template #actions>
|
|
||||||
<a-button :type="isNeedRestart ? 'primary' : 'default'" @click="sendRestart" :icon="h(ReloadOutlined)">
|
|
||||||
{{ isNeedRestart ? '需要刷新' : '重新加载' }}
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
</HeaderComponent>
|
</HeaderComponent>
|
||||||
<div class="setting-container layout-container">
|
<div class="setting-container layout-container">
|
||||||
<div class="sider" v-if="state.windowWidth > 520">
|
<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 { useConfigStore } from '@/stores/config';
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import {
|
import {
|
||||||
ReloadOutlined,
|
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
CodeOutlined,
|
CodeOutlined,
|
||||||
FolderOutlined,
|
FolderOutlined,
|
||||||
@ -192,15 +185,12 @@ import {
|
|||||||
import HeaderComponent from '@/components/HeaderComponent.vue';
|
import HeaderComponent from '@/components/HeaderComponent.vue';
|
||||||
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue';
|
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue';
|
||||||
import UserManagementComponent from '@/components/UserManagementComponent.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 { embeddingApi } from '@/apis/knowledge_api'
|
||||||
import ModelSelectorComponent from '@/components/ModelSelectorComponent.vue';
|
import ModelSelectorComponent from '@/components/ModelSelectorComponent.vue';
|
||||||
|
|
||||||
const configStore = useConfigStore()
|
const configStore = useConfigStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const items = computed(() => configStore.config._config_items)
|
const items = computed(() => configStore.config._config_items)
|
||||||
const isNeedRestart = ref(false)
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
section: 'base',
|
section: 'base',
|
||||||
@ -218,20 +208,6 @@ const rerankerChoices = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const preHandleChange = (key, e) => {
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,23 +261,6 @@ onUnmounted(() => {
|
|||||||
window.removeEventListener('resize', updateWindowWidth)
|
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模型状态
|
// 检查所有embedding模型状态
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user