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