### What problem does this PR solve? fix: #567 use modal to upload files in the knowledge base ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { IFactory } from '@/interfaces/database/llm';
|
||||
import isObject from 'lodash/isObject';
|
||||
import snakeCase from 'lodash/snakeCase';
|
||||
|
||||
@@ -33,3 +34,29 @@ export const formatNumberWithThousandsSeparator = (numberStr: string) => {
|
||||
const formattedNumber = numberStr.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
return formattedNumber;
|
||||
};
|
||||
|
||||
const orderFactoryList = [
|
||||
'OpenAI',
|
||||
'Moonshot',
|
||||
'ZHIPU-AI',
|
||||
'Ollama',
|
||||
'Xinference',
|
||||
];
|
||||
|
||||
export const sortLLmFactoryListBySpecifiedOrder = (list: IFactory[]) => {
|
||||
const finalList: IFactory[] = [];
|
||||
orderFactoryList.forEach((orderItem) => {
|
||||
const index = list.findIndex((item) => item.name === orderItem);
|
||||
if (index !== -1) {
|
||||
finalList.push(list[index]);
|
||||
}
|
||||
});
|
||||
|
||||
list.forEach((item) => {
|
||||
if (finalList.every((x) => x.name !== item.name)) {
|
||||
finalList.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return finalList;
|
||||
};
|
||||
|
||||
@@ -42,3 +42,7 @@ export const getExtension = (name: string) =>
|
||||
export const isPdf = (name: string) => {
|
||||
return getExtension(name) === 'pdf';
|
||||
};
|
||||
|
||||
export const getUnSupportedFilesCount = (message: string) => {
|
||||
return message.split('\n').length;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user