diff --git a/frontend/src/api.js b/frontend/src/api.js index 5449dea..873f5e8 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -11,7 +11,13 @@ const BASE = import.meta.env.VITE_API_BASE || '' export async function api(path, opts = {}) { const headers = { ...(opts.headers || {}) } if (auth.token) headers.Authorization = `Bearer ${auth.token}` - const r = await fetch(`${BASE}/admin/api${path}`, { ...opts, headers }) + // 请求不能无限挂起(比如上传走丢的网关连接)——120s 超时兜底 + let signal = opts.signal + if (typeof AbortSignal !== 'undefined' && AbortSignal.timeout) { + const t = AbortSignal.timeout(120000) + signal = signal && AbortSignal.any ? AbortSignal.any([signal, t]) : t + } + const r = await fetch(`${BASE}/admin/api${path}`, { ...opts, headers, signal }) let data = null try { data = await r.json() diff --git a/frontend/src/components/canvas/CanvasStage.vue b/frontend/src/components/canvas/CanvasStage.vue index 298614d..4adc24e 100644 --- a/frontend/src/components/canvas/CanvasStage.vue +++ b/frontend/src/components/canvas/CanvasStage.vue @@ -766,7 +766,6 @@ defineExpose({
-
拖拽空白平移 · Ctrl+滚轮缩放 · 依次点击连接点连线(拖线调弧度) · 双击笔记编辑
@@ -844,24 +843,4 @@ defineExpose({ pointer-events: none; border-radius: 4px; } -.cv-hint { - position: absolute; - left: 10px; - bottom: 10px; - font-size: 11px; - font-weight: 600; - color: var(--fg-2); - background: var(--surface); - -webkit-backdrop-filter: blur(10px); - backdrop-filter: blur(10px); - border: 1px solid var(--glass-border); - border-radius: 999px; - padding: 3px 14px; - box-shadow: var(--glass-shadow); - pointer-events: none; - white-space: nowrap; - max-width: 92%; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/frontend/src/views/CanvasView.vue b/frontend/src/views/CanvasView.vue index 0f54a41..df4e022 100644 --- a/frontend/src/views/CanvasView.vue +++ b/frontend/src/views/CanvasView.vue @@ -43,6 +43,12 @@ const gen = reactive({ kind: 'image', modelId: '', prompt: '', ratio: '', resolu const runningGens = ref(0) const genBusy = computed(() => runningGens.value > 0) const genMsg = ref('') +// 消息只做短暂 toast 提示,自动消失不常驻 +let genMsgTimer = null +watch(genMsg, (v) => { + clearTimeout(genMsgTimer) + if (v) genMsgTimer = setTimeout(() => { genMsg.value = '' }, 3500) +}) const kindModels = computed(() => (allModels.value || []).filter((m) => m.enabled !== false && m.type === gen.kind), ) @@ -526,7 +532,7 @@ async function uploadImageFile(file, at = null) { genMsg.value = r.data?.detail || `上传失败 (${r.status})` } } catch (e) { - genMsg.value = String(e) + genMsg.value = e?.name === 'AbortError' ? '上传超时,请重试' : String(e) } finally { uploadBusy.value = false }