feat: display the version and backend service status on the page (#848)

### What problem does this PR solve?

#643 feat: display the version and backend service status on the page

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-05-20 18:28:36 +08:00
committed by GitHub
parent 9a01d1b876
commit 93b35f4e58
21 changed files with 286 additions and 7 deletions

View File

@ -77,4 +77,8 @@ export default {
createFolder: `${api_host}/file/create`,
connectFileToKnowledge: `${api_host}/file2document/convert`,
getFile: `${api_host}/file/get`,
// system
getSystemVersion: `${api_host}/system/version`,
getSystemStatus: `${api_host}/system/status`,
};

View File

@ -65,3 +65,10 @@ export const filterOptionsByInput = (
input: string,
option: { label: string; value: string } | undefined,
) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase());
export const toFixed = (value: unknown, fixed = 2) => {
if (typeof value === 'number') {
return value.toFixed(fixed);
}
return value;
};

View File

@ -9,7 +9,7 @@ const registerServer = <T extends string>(
) => {
const server: Service<T> = {} as Service<T>;
for (let key in opt) {
server[key] = (params: any, urlAppendix?: string) => {
server[key] = (params?: any, urlAppendix?: string) => {
let url = opt[key].url;
const requestOptions = opt[key];
if (urlAppendix) {