diff --git a/ui/src/views/template/component/ModelCard.vue b/ui/src/views/template/component/ModelCard.vue
index 1192b829f..ee0abc1cb 100644
--- a/ui/src/views/template/component/ModelCard.vue
+++ b/ui/src/views/template/component/ModelCard.vue
@@ -6,9 +6,9 @@
{{ model.name }}
-
+
失败
-
+
@@ -28,9 +28,7 @@
-
-
+
{{ percentage }}%
@@ -44,7 +42,7 @@
-
+
@@ -72,13 +70,31 @@ const props = defineProps<{
}>()
const downModel = ref()
-const progress = computed(() => {
+const currentModel = computed(() => {
if (downModel.value) {
- const down_model_chunk = downModel.value.meta['down_model_chunk']
+ return downModel.value
+ } else {
+ return props.model
+ }
+})
+
+const errMessage = computed(() => {
+ if (currentModel.value.meta && currentModel.value.meta.message) {
+ if (currentModel.value.meta.message === 'pull model manifest: file does not exist') {
+ return `${currentModel.value.model_name} 模型在Ollama不存在`
+ }
+ return currentModel.value.meta.message
+ }
+})
+const progress = computed(() => {
+ if (currentModel.value) {
+ const down_model_chunk = currentModel.value.meta['down_model_chunk']
if (down_model_chunk) {
- const maxObj = down_model_chunk.reduce((prev: any, current: any) => {
- return (prev.index || 0) > (current.index || 0) ? prev : current
- })
+ const maxObj = down_model_chunk
+ .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)
}
return 0
@@ -115,7 +131,7 @@ const icon = computed(() => {
*/
const initInterval = () => {
interval = setInterval(() => {
- if (props.model.status === 'DOWNLOAD') {
+ if (currentModel.value.status === 'DOWNLOAD') {
ModelApi.getModelMetaById(props.model.id).then((ok) => {
downModel.value = ok.data
})