Split model get list (#74)

Get the model list separately by model type and defer the request.
This commit is contained in:
Hayden
2024-12-03 14:05:18 +08:00
committed by GitHub
parent 6d67b00b17
commit dc46f498be
7 changed files with 114 additions and 64 deletions

View File

@@ -15,16 +15,18 @@ import { useStoreProvider } from 'hooks/store'
import { useToast } from 'hooks/toast'
import GlobalConfirm from 'primevue/confirmdialog'
import { $el, app, ComfyButton } from 'scripts/comfyAPI'
import { onMounted } from 'vue'
import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const { dialog, models, config, download } = useStoreProvider()
const { toast } = useToast()
const firstOpenManager = ref(true)
onMounted(() => {
const refreshModelsAndConfig = async () => {
await Promise.all([models.refresh(), config.refresh()])
await Promise.all([models.refresh(true)])
toast.add({
severity: 'success',
summary: 'Refreshed Models',
@@ -50,6 +52,11 @@ onMounted(() => {
const openManagerDialog = () => {
const { cardWidth, gutter, aspect } = config
if (firstOpenManager.value) {
models.refresh(true)
firstOpenManager.value = false
}
dialog.open({
key: 'model-manager',
title: t('modelManager'),