fix: ollama model change trigger check action
This commit is contained in:
@@ -184,6 +184,19 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
};
|
||||
|
||||
const handleScheduleTypeChange = (value: string) => {
|
||||
if (value === 'auto') {
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
}
|
||||
};
|
||||
|
||||
const handleGpuSelectorChange = (value: any[] | string) => {
|
||||
if (!value?.length || !value) {
|
||||
return;
|
||||
}
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
};
|
||||
|
||||
const collapseItems = useMemo(() => {
|
||||
const children = (
|
||||
<>
|
||||
@@ -198,6 +211,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
</Form.Item>
|
||||
<Form.Item name="scheduleType">
|
||||
<SealSelect
|
||||
onChange={handleScheduleTypeChange}
|
||||
label={intl.formatMessage({ id: 'models.form.scheduletype' })}
|
||||
description={<TooltipList list={scheduleTypeTips}></TooltipList>}
|
||||
options={[
|
||||
@@ -301,6 +315,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
value={form.getFieldValue(['gpu_selector', 'gpu_ids'])}
|
||||
optionNode={GPUCard}
|
||||
getPopupContainer={(triggerNode) => triggerNode.parentNode}
|
||||
onChange={handleGpuSelectorChange}
|
||||
></SealCascader>
|
||||
</Form.Item>
|
||||
</>
|
||||
|
||||
@@ -146,6 +146,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
|
||||
const handleOnValuesChange = async (changedValues: any, allValues: any) => {
|
||||
const fieldName = Object.keys(changedValues)[0];
|
||||
console.log('handleOnValuesChange', fieldName, changedValues, allValues);
|
||||
if (excludeFields.includes(fieldName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,13 +99,21 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
const [isGGUF, setIsGGUF] = useState<boolean>(props.isGGUF || false);
|
||||
const modelFileRef = useRef<any>(null);
|
||||
|
||||
const getCategory = (item: any) => {
|
||||
const categories = item.evaluateResult?.default_spec?.categories || [];
|
||||
if (Array.isArray(categories)) {
|
||||
return categories?.[0] || null;
|
||||
}
|
||||
return categories || null;
|
||||
};
|
||||
const handleSelectModelFile = (item: any) => {
|
||||
form.current?.form?.resetFields(resetFields);
|
||||
const modelInfo = onSelectModel(selectedModel, props.source);
|
||||
form.current?.setFieldsValue?.({
|
||||
file_name: item.fakeName,
|
||||
...item.evaluateResult?.default_spec,
|
||||
...modelInfo
|
||||
...modelInfo,
|
||||
categories: getCategory(item)
|
||||
});
|
||||
|
||||
if (item.fakeName) {
|
||||
@@ -122,7 +130,8 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
handleShowCompatibleAlert(item.evaluateResult);
|
||||
form.current?.setFieldsValue?.({
|
||||
...item.evaluateResult?.default_spec,
|
||||
...modelInfo
|
||||
...modelInfo,
|
||||
categories: getCategory(item)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user