From 2b1e7385e03ba4e2687796f99ee2204ffcb10e87 Mon Sep 17 00:00:00 2001 From: WangLeo <690854599@qq.com> Date: Wed, 3 Jun 2026 17:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8A=A0=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E9=A2=84=E8=AF=B7=E6=B1=82=E5=B9=B3=E5=8F=B0=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E9=81=BF=E5=85=8D=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E7=82=B9=E5=87=BB"=E5=8F=91=E9=80=81"=E6=97=B6=E6=89=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialogBox/index.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/dialogBox/index.vue b/src/components/dialogBox/index.vue index baa84df..d30662f 100644 --- a/src/components/dialogBox/index.vue +++ b/src/components/dialogBox/index.vue @@ -87,7 +87,7 @@ import { useDisplayStore } from '@/stores' import { generate } from '@/utils/websocket' import { useRouter } from 'vue-router' import { fetchModelConfig } from '@/utils/modelConfig' -import { getModelId } from '@/utils/modelApi' +import { getModelId, fetchPlatformModels, getPlatformCode } from '@/utils/modelApi' const props = defineProps({ isGenerate: { @@ -292,14 +292,25 @@ watch([() => model.value, () => modelType.value], async ([newModel, newModelType } }) +// 预加载平台模型列表,避免首次点击"发送"时才请求接口 +const prefetchModels = () => { + const code = getPlatformCode(props.type) + fetchPlatformModels(code) +} + watch(() => props.type, (newType) => { if (newType === 'Video') { model.value = 'LTX2.0' } else { model.value = 'flux' } + prefetchModels() }, { immediate: true }) +onMounted(() => { + prefetchModels() +}) +