reload buffer (#3665)

* reload buffer

* reload buffer

* tts selector
This commit is contained in:
Archer
2025-01-25 13:12:21 +08:00
committed by archer
parent 4ada33e7e6
commit c8e2e0283b
7 changed files with 38 additions and 17 deletions

View File

@@ -13,6 +13,11 @@ import {
import { debounce } from 'lodash';
import { ModelProviderType } from '@fastgpt/global/core/ai/provider';
import { findModelFromAlldata } from '../model';
import {
reloadFastGPTConfigBuffer,
updateFastGPTConfigBuffer
} from '../../../common/system/config/controller';
import { delay } from '@fastgpt/global/common/system/utils';
/*
TODO: 分优先级读取:
@@ -170,8 +175,21 @@ export const watchSystemModelUpdate = () => {
'change',
debounce(async () => {
try {
// Main node will reload twice
await loadSystemModels(true);
// All node reaload buffer
await reloadFastGPTConfigBuffer();
} catch (error) {}
}, 500)
);
};
// 更新完模型后,需要重载缓存
export const updatedReloadSystemModel = async () => {
// 1. 更新模型(所有节点都会触发)
await loadSystemModels(true);
// 2. 更新缓存(仅主节点触发)
await updateFastGPTConfigBuffer();
// 3. 延迟1秒等待其他节点刷新
await delay(1000);
};