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'
182176import { useConfigStore } from ' @/stores/config' ;
183177import { useUserStore } from ' @/stores/user'
184178import {
185- ReloadOutlined ,
186179 SettingOutlined ,
187180 CodeOutlined ,
188181 FolderOutlined ,
@@ -192,15 +185,12 @@ import {
192185import HeaderComponent from ' @/components/HeaderComponent.vue' ;
193186import ModelProvidersComponent from ' @/components/ModelProvidersComponent.vue' ;
194187import UserManagementComponent from ' @/components/UserManagementComponent.vue' ;
195- import { notification , Button } from ' ant-design-vue' ;
196- import { configApi } from ' @/apis/system_api'
197188import { embeddingApi } from ' @/apis/knowledge_api'
198189import ModelSelectorComponent from ' @/components/ModelSelectorComponent.vue' ;
199190
200191const configStore = useConfigStore ()
201192const userStore = useUserStore ()
202193const items = computed (() => configStore .config ._config_items )
203- const isNeedRestart = ref (false )
204194const state = reactive ({
205195 loading: false ,
206196 section: ' base' ,
@@ -218,20 +208,6 @@ const rerankerChoices = computed(() => {
218208})
219209
220210const 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