mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修改编辑时旧数据影响进度条
This commit is contained in:
parent
5f7a99f957
commit
8ed2754eba
|
|
@ -45,7 +45,7 @@ class ModelPullManage:
|
|||
status = Status.SUCCESS
|
||||
if chunk.get('status') == DownModelChunkStatus.error.value:
|
||||
message = chunk.get("digest")
|
||||
QuerySet(Model).filter(id=model.id).update(meta={"down_model_chunk": down_model_chunk_list, "message": message},
|
||||
QuerySet(Model).filter(id=model.id).update(meta={"down_model_chunk": [], "message": message},
|
||||
status=status)
|
||||
|
||||
|
||||
|
|
@ -230,6 +230,7 @@ class ModelSerializer(serializers.Serializer):
|
|||
credential, model_credential = ModelSerializer.Edit(data={**instance, 'user_id': user_id}).is_valid(
|
||||
model=model)
|
||||
try:
|
||||
model.status = Status.SUCCESS
|
||||
# 校验模型认证数据
|
||||
model_credential.is_valid(
|
||||
model.model_type,
|
||||
|
|
@ -241,7 +242,6 @@ class ModelSerializer(serializers.Serializer):
|
|||
model.status = Status.DOWNLOAD
|
||||
else:
|
||||
raise e
|
||||
model.status = Status.SUCCESS
|
||||
update_keys = ['credential', 'name', 'model_type', 'model_name']
|
||||
for update_key in update_keys:
|
||||
if update_key in instance and instance.get(update_key) is not None:
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ const list_base_model = (model_type: any) => {
|
|||
}
|
||||
}
|
||||
const open = (provider: Provider, model: Model) => {
|
||||
modelValue.value=model
|
||||
ModelApi.getModelById(model.id, formLoading).then((ok) => {
|
||||
modelValue.value = ok.data
|
||||
ModelApi.listModelType(model.provider, model_type_loading).then((ok) => {
|
||||
|
|
@ -176,6 +177,7 @@ const open = (provider: Provider, model: Model) => {
|
|||
|
||||
const close = () => {
|
||||
base_form_data.value = { name: '', model_type: '', model_name: '' }
|
||||
dynamicsFormRef.value?.ruleFormRef?.resetFields()
|
||||
credential_form_data.value = {}
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ import type { Provider, Model } from '@/api/type/model'
|
|||
import ModelApi from '@/api/model'
|
||||
import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import EditModel from '@/views/template/component/EditModel.vue'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { MsgConfirm } from '@/utils/message'
|
||||
|
||||
const props = defineProps<{
|
||||
model: Model
|
||||
|
|
@ -85,6 +85,7 @@ const errMessage = computed(() => {
|
|||
}
|
||||
return currentModel.value.meta.message
|
||||
}
|
||||
return ""
|
||||
})
|
||||
const progress = computed(() => {
|
||||
if (currentModel.value) {
|
||||
|
|
@ -94,8 +95,11 @@ const progress = computed(() => {
|
|||
.filter((chunk: any) => chunk.index > 1)
|
||||
.reduce((prev: any, current: any) => {
|
||||
return (prev.index || 0) > (current.index || 0) ? prev : current
|
||||
})
|
||||
return maxObj.progress?.toFixed(1)
|
||||
},{progress:0})
|
||||
if(maxObj){
|
||||
return parseFloat(maxObj.progress?.toFixed(1))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
@ -135,6 +139,8 @@ const initInterval = () => {
|
|||
ModelApi.getModelMetaById(props.model.id).then((ok) => {
|
||||
downModel.value = ok.data
|
||||
})
|
||||
}else{
|
||||
downModel.value=undefined
|
||||
}
|
||||
}, 6000)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue