fix(plugins): 暂时回退提示词插件到稳定版 1.4.10(1.5.0 点击详情回归待修复)
This commit is contained in:
1 parent
a46d874d33
commit
5ccc6c879e
5 files changed
+68
-475
No files matched your search
@@ -39,6 +39,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function fileOp (name) {
|
||||
return function () {
|
||||
const F = (typeof global !== 'undefined' && global.IWBStorageFile) ? global.IWBStorageFile.pluginFiles : null
|
||||
if (!F || typeof F[name] !== 'function') return Promise.reject(new Error('文件能力未就绪'))
|
||||
const args = Array.prototype.slice.call(arguments)
|
||||
try { return Promise.resolve(F[name].apply(F, ['promptlib'].concat(args))) } catch (e) { return Promise.reject(e) }
|
||||
}
|
||||
}
|
||||
const API = {
|
||||
list: call('list'),
|
||||
save: call('save'),
|
||||
@@ -50,11 +58,12 @@
|
||||
coverUrl: call('coverUrl'),
|
||||
removeCover: call('removeCover'),
|
||||
// v3.26.36:封面等插件文件的沙箱读写(挂在 promptlib 能力上,避免新增能力权限面)
|
||||
filePut: call('filePut'),
|
||||
fileGet: call('fileGet'),
|
||||
fileList: call('fileList'),
|
||||
fileRemove: call('fileRemove'),
|
||||
fileStat: call('fileStat'),
|
||||
// 文件沙箱(v3.26.36):直接调宿主 pluginFiles,不占 app.js 行数;插件 id 固定 promptlib。
|
||||
filePut: fileOp('put'),
|
||||
fileGet: fileOp('get'),
|
||||
fileList: fileOp('list'),
|
||||
fileRemove: fileOp('remove'),
|
||||
fileStat: fileOp('stat'),
|
||||
onChanged: function (fn) {
|
||||
if (typeof fn !== 'function') return function () {}
|
||||
listeners.push(fn)
|
||||
|
||||
Reference in new issue
Block a user