i18n notifications and details

This commit is contained in:
josc146
2023-05-18 21:19:13 +08:00
parent 5078a884b0
commit 934f7b15e8
7 changed files with 32 additions and 16 deletions

View File

@@ -1,14 +1,17 @@
import commonStore, {ModelStatus} from '../stores/commonStore';
import commonStore from '../stores/commonStore';
export const readRoot = async () => {
const port = commonStore.getCurrentModelConfig().apiParameters.apiPort;
return fetch(`http://127.0.0.1:${port}`);
};
export const exit = async () => {
commonStore.setModelStatus(ModelStatus.Offline);
export const exit = async (timeout?: number) => {
const controller = new AbortController();
if (timeout)
setTimeout(() => controller.abort(), timeout);
const port = commonStore.getCurrentModelConfig().apiParameters.apiPort;
return fetch(`http://127.0.0.1:${port}/exit`, {method: 'POST'});
return fetch(`http://127.0.0.1:${port}/exit`, {method: 'POST', signal: controller.signal});
};
export const switchModel = async (body: any) => {