feat(canvas): 消息改3.5s自动消失toast,api加120s超时,去掉舞台提示条
This commit is contained in:
+7
-1
@@ -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()
|
||||
|
||||
@@ -766,7 +766,6 @@ defineExpose({
|
||||
</div>
|
||||
|
||||
<div v-if="marquee" class="cv-marquee" :style="marquee" />
|
||||
<div class="cv-hint">拖拽空白平移 · Ctrl+滚轮缩放 · 依次点击连接点连线(拖线调弧度) · 双击笔记编辑</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user