fix(promptlib): 1.6.6 节点封面/参考图统一走 fileApi(迁移后 {img} 可解析)

This commit is contained in:
qiqi committed 2026-11-22 19:54:05 +08:00
1 parent 928ffa0de0
commit 06fa7f0a9b
1 file changed
+3 -3
+3 -3
View File
@@ -60,7 +60,7 @@
function fileApi (ctx) {
if (ctx.files && typeof ctx.files.put === 'function') return ctx.files
var P = ctx.promptlib
if (P && typeof P.filePut === 'function') {
if (P && typeof P.fileGet === 'function') {
return {
put: function (n, d) { return P.filePut(n, d) },
get: function (n) { return P.fileGet(n) },
@@ -1598,7 +1598,7 @@
}
if (!on || !key) { done(''); return }
if (typeof cover === 'string' && cover.indexOf('data:') === 0) { done(cover); return }
if (ctx.files) Promise.resolve(ctx.files.get(key)).then(function (r) { done(r && r.ok ? r.url : '') }).catch(function () { done('') })
if (fileApi(ctx)) Promise.resolve(fileApi(ctx).get(key)).then(function (r) { done(r && r.ok ? r.url : '') }).catch(function () { done('') })
else done('')
})
return st
@@ -1644,7 +1644,7 @@
if (url) { st.thumb.src = url; st.thumb.style.display = '' } else st.thumb.style.display = 'none'
}
if (typeof cover === 'string' && cover.indexOf('data:') === 0) show(cover)
else if (coverKey && ctx.files) Promise.resolve(ctx.files.get(coverKey)).then(function (r) { show(r && r.ok ? r.url : '') }).catch(function () { show('') })
else if (coverKey && fileApi(ctx)) Promise.resolve(fileApi(ctx).get(coverKey)).then(function (r) { show(r && r.ok ? r.url : '') }).catch(function () { show('') })
else show('')
}
if (!coverKey) st.thumb.style.display = 'none'