chore: clear backend parameters、backend_version、env on change backend
This commit is contained in:
@@ -82,7 +82,9 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
|
||||
const handleBackendChange = async (val: string) => {
|
||||
const updates = {
|
||||
backend_version: ''
|
||||
backend_version: '',
|
||||
backend_parameters: [],
|
||||
env: {}
|
||||
};
|
||||
if (val === backendOptionsMap.llamaBox) {
|
||||
Object.assign(updates, {
|
||||
|
||||
@@ -126,7 +126,9 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
|
||||
const handleBackendChange = (backend: string) => {
|
||||
const updates = {
|
||||
backend_version: ''
|
||||
backend_version: '',
|
||||
backend_parameters: [],
|
||||
env: {}
|
||||
};
|
||||
if (backend === backendOptionsMap.llamaBox) {
|
||||
Object.assign(updates, {
|
||||
|
||||
@@ -353,14 +353,12 @@ export const useCheckCompatibility = () => {
|
||||
const isOllamaModel = localPath?.includes('ollama');
|
||||
const isGGUFFile = localPath.endsWith('.gguf');
|
||||
|
||||
const isOllamaModelFile = isBlobFile || isOllamaModel;
|
||||
|
||||
let warningMessage = '';
|
||||
if (isBlobFile && isOllamaModel && backend === backendOptionsMap.llamaBox) {
|
||||
if (isOllamaModelFile && backend === backendOptionsMap.llamaBox) {
|
||||
warningMessage = '';
|
||||
} else if (
|
||||
isBlobFile &&
|
||||
isOllamaModel &&
|
||||
backend !== backendOptionsMap.llamaBox
|
||||
) {
|
||||
} else if (isOllamaModelFile && backend !== backendOptionsMap.llamaBox) {
|
||||
warningMessage = intl.formatMessage({
|
||||
id: 'models.form.ollama.warning'
|
||||
});
|
||||
@@ -488,9 +486,7 @@ export const useCheckCompatibility = () => {
|
||||
source: source
|
||||
});
|
||||
|
||||
if (res.show) {
|
||||
setWarningStatus?.(res);
|
||||
}
|
||||
setWarningStatus?.(res);
|
||||
return res;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user