plugin-document-understanding 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +7 -7
- package/dist/server/plugin.js +30 -7
- package/package.json +1 -1
- package/src/server/plugin.ts +37 -11
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@nocobase/client")):"function"==typeof define&&define.amd?define("plugin-document-understanding",["@nocobase/client"],e):"object"==typeof exports?exports["plugin-document-understanding"]=e(require("@nocobase/client")):t["plugin-document-understanding"]=e(t["@nocobase/client"])}(self,function(t){return function(){"use strict";var e={342:function(e){e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.g.importScripts&&(o=r.g.location+"");var o,i=r.g.document;if(!o&&i&&(i.currentScript&&"SCRIPT"===i.currentScript.tagName.toUpperCase()&&(o=i.currentScript.src),!o)){var u=i.getElementsByTagName("script");if(u.length)for(var c=u.length-1;c>-1&&(!o||!/^http(s?):/.test(o));)o=u[c--].src}if(!o)throw Error("Automatic publicPath is not supported in this browser");r.p=o.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var a={};return!function(){var t="",e="u">typeof document?document.currentScript:null;if(e&&e.src
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@nocobase/client")):"function"==typeof define&&define.amd?define("plugin-document-understanding",["@nocobase/client"],e):"object"==typeof exports?exports["plugin-document-understanding"]=e(require("@nocobase/client")):t["plugin-document-understanding"]=e(t["@nocobase/client"])}(self,function(t){return function(){"use strict";var e={342:function(e){e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.g.importScripts&&(o=r.g.location+"");var o,i=r.g.document;if(!o&&i&&(i.currentScript&&"SCRIPT"===i.currentScript.tagName.toUpperCase()&&(o=i.currentScript.src),!o)){var u=i.getElementsByTagName("script");if(u.length)for(var c=u.length-1;c>-1&&(!o||!/^http(s?):/.test(o));)o=u[c--].src}if(!o)throw Error("Automatic publicPath is not supported in this browser");r.p=o.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var a={};return!function(){var t="",e="u">typeof document?document.currentScript:null;if(e&&e.src){var n=e.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-document-understanding/dist/client/")>=0&&(t=n.replace(/\/[^\/]+$/,"/"))}if(!t){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),t=o+"static/plugins/plugin-document-understanding/dist/client/")}if(!t){var i=window.__nocobase_modern_client_prefix__||"v",u="/"+(i=String(i).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(t=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",a=c.indexOf(u);t=a>=0?c.slice(0,a+1):"/"}t&&(t=t.replace(RegExp("/"+i+"/?$"),"/")),t||(t="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t+="static/plugins/plugin-document-understanding/dist/client/"}r.p=t}(),!function(){r.r(a),r.d(a,{PluginDocumentUnderstandingClient:function(){return l}});var t=r(342);function e(t,e,n,r,o,i,u){try{var c=t[i](u),a=c.value}catch(t){n(t);return}c.done?e(a):Promise.resolve(a).then(r,o)}function n(t,e,r){return(n=c()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return n(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(c=function(){return!!t})()}var l=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var t,e;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,e=arguments,t=o(t),function(t,e){var n;if(e&&("object"==((n=e)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,c()?Reflect.construct(t,e||[],o(this).constructor):t.apply(this,e))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&i(r,t),n=[{key:"load",value:function(){var t;return(t=function(){return function(t,e){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(t){l=[6,t],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return[2]})},function(){var n=this,r=arguments;return new Promise(function(o,i){var u=t.apply(n,r);function c(t){e(u,o,i,c,a,"next",t)}function a(t){e(u,o,i,c,a,"throw",t)}c(void 0)})})()}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(r.prototype,n),r}(u(t.Plugin));a.default=l}(),a}()});
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-document-understanding/client-v2",["@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-document-understanding/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["plugin-document-understanding/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o){return function(){"use strict";var i,u,c,a={375:function(e){e.exports=r},485:function(t){t.exports=e},694:function(e){e.exports=o},59:function(e){e.exports=n},155:function(e){e.exports=t}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return a[e](n,n.exports,s),n.exports}s.m=a,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+".9b984a25b2fc7c14.js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},s.l=function(e,t,n,r){if(f[e])return void f[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="plugin-document-understanding/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","plugin-document-understanding/client-v2:"+n),o.src=e),f[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var f,p,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var b=d.getElementsByTagName("script");if(b.length)for(var g=b.length-1;g>-1&&(!p||!/^http(s?):/.test(p));)p=b[g--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},s.f.j=function(e,t){var n=s.o(i,e)?i[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}},u=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)s.o(u,n)&&(s.m[n]=u[n]);c&&c(s)}for(e&&e(t);a<o.length;a++)r=o[a],s.o(i,r)&&i[r]&&i[r][0](),i[r]=0},(c=self.webpackChunkplugin_document_understanding_client_v2=self.webpackChunkplugin_document_understanding_client_v2||[]).forEach(u.bind(null,0)),c.push=u.bind(null,c.push.bind(c));var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-document-understanding/client-v2",["@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-document-understanding/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["plugin-document-understanding/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o){return function(){"use strict";var i,u,c,a={375:function(e){e.exports=r},485:function(t){t.exports=e},694:function(e){e.exports=o},59:function(e){e.exports=n},155:function(e){e.exports=t}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return a[e](n,n.exports,s),n.exports}s.m=a,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+".9b984a25b2fc7c14.js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},s.l=function(e,t,n,r){if(f[e])return void f[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="plugin-document-understanding/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","plugin-document-understanding/client-v2:"+n),o.src=e),f[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var f,p,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var b=d.getElementsByTagName("script");if(b.length)for(var g=b.length-1;g>-1&&(!p||!/^http(s?):/.test(p));)p=b[g--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},s.f.j=function(e,t){var n=s.o(i,e)?i[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}},u=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)s.o(u,n)&&(s.m[n]=u[n]);c&&c(s)}for(e&&e(t);a<o.length;a++)r=o[a],s.o(i,r)&&i[r]&&i[r][0](),i[r]=0},(c=self.webpackChunkplugin_document_understanding_client_v2=self.webpackChunkplugin_document_understanding_client_v2||[]).forEach(u.bind(null,0)),c.push=u.bind(null,c.push.bind(c));var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-document-understanding/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-document-understanding/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-document-understanding/dist/client-v2/"}s.p=e}(),!function(){s.r(v),s.d(v,{default:function(){return c}});var e=s(485);function t(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function n(e,t,r){return(n=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return n(e,arguments,r(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,e)})(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var c=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=r(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(e,t||[],r(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&o(i,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.pluginSettingsManager.addMenuItem({key:"document-understanding",title:this.t("Document Understanding"),icon:"FileSearchOutlined",aclSnippet:"pm.document-understanding"}),this.pluginSettingsManager.addPageTabItem({menuKey:"document-understanding",key:"index",title:this.t("Document Understanding"),componentLoader:function(){return s.e("794").then(s.bind(s,441))}}),[2]})},function(){var n=this,r=arguments;return new Promise(function(o,i){var u=e.apply(n,r);function c(e){t(u,o,i,c,a,"next",e)}function a(e){t(u,o,i,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,n),i}(i(e.Plugin))}(),v}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.
|
|
12
|
-
"@nocobase/flow-engine": "2.1.
|
|
13
|
-
"@nocobase/client-v2": "2.1.
|
|
14
|
-
"@nocobase/actions": "2.1.
|
|
15
|
-
"@nocobase/server": "2.1.
|
|
11
|
+
"@nocobase/client": "2.1.23",
|
|
12
|
+
"@nocobase/flow-engine": "2.1.23",
|
|
13
|
+
"@nocobase/client-v2": "2.1.23",
|
|
14
|
+
"@nocobase/actions": "2.1.23",
|
|
15
|
+
"@nocobase/server": "2.1.23",
|
|
16
16
|
"react": "18.2.0",
|
|
17
17
|
"antd": "5.24.2",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
|
-
"@nocobase/database": "2.1.
|
|
20
|
-
"axios": "1.18.
|
|
19
|
+
"@nocobase/database": "2.1.23",
|
|
20
|
+
"axios": "1.18.1"
|
|
21
21
|
};
|
package/dist/server/plugin.js
CHANGED
|
@@ -35,13 +35,15 @@ var import_path = require("path");
|
|
|
35
35
|
var import_DocumentUnderstandingService = require("./services/DocumentUnderstandingService");
|
|
36
36
|
var import_actions = require("./actions");
|
|
37
37
|
var import_document_understanding_tool = require("./tools/document-understanding-tool");
|
|
38
|
-
const
|
|
39
|
-
var _a
|
|
40
|
-
const candidate =
|
|
41
|
-
return typeof ((
|
|
38
|
+
const isAiManagerLike = (manager) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const candidate = manager;
|
|
41
|
+
return typeof ((_a = candidate == null ? void 0 : candidate.toolsManager) == null ? void 0 : _a.registerDynamicTools) === "function";
|
|
42
42
|
};
|
|
43
43
|
class PluginDocumentUnderstandingServer extends import_server.Plugin {
|
|
44
44
|
service;
|
|
45
|
+
aiToolsRegistered = false;
|
|
46
|
+
registerAIToolsAfterStart = () => this.registerAITools();
|
|
45
47
|
async afterAdd() {
|
|
46
48
|
}
|
|
47
49
|
async beforeLoad() {
|
|
@@ -60,6 +62,7 @@ class PluginDocumentUnderstandingServer extends import_server.Plugin {
|
|
|
60
62
|
});
|
|
61
63
|
this.registerActions();
|
|
62
64
|
this.registerAITools();
|
|
65
|
+
this.app.on("afterStart", this.registerAIToolsAfterStart);
|
|
63
66
|
this.app.acl.registerSnippet({
|
|
64
67
|
name: `pm.${this.name}`,
|
|
65
68
|
actions: ["docUnderstanding:*"]
|
|
@@ -89,13 +92,24 @@ class PluginDocumentUnderstandingServer extends import_server.Plugin {
|
|
|
89
92
|
});
|
|
90
93
|
}
|
|
91
94
|
registerAITools() {
|
|
95
|
+
if (this.aiToolsRegistered) return;
|
|
92
96
|
try {
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
97
|
+
const aiManager = this.app.aiManager;
|
|
98
|
+
if (!isAiManagerLike(aiManager)) {
|
|
95
99
|
this.app.logger.warn("Document Understanding: plugin-ai not available, skip AI tool registration.");
|
|
96
100
|
return;
|
|
97
101
|
}
|
|
98
|
-
|
|
102
|
+
const runtimeState = this.app;
|
|
103
|
+
runtimeState.documentUnderstandingService = this.service;
|
|
104
|
+
if (!runtimeState.documentUnderstandingToolProviderRegistered) {
|
|
105
|
+
aiManager.toolsManager.registerDynamicTools(async (register) => {
|
|
106
|
+
const currentService = runtimeState.documentUnderstandingService;
|
|
107
|
+
if (!currentService) return;
|
|
108
|
+
await (0, import_document_understanding_tool.createDynamicPipelineToolsProvider)(currentService)(register);
|
|
109
|
+
});
|
|
110
|
+
runtimeState.documentUnderstandingToolProviderRegistered = true;
|
|
111
|
+
}
|
|
112
|
+
this.aiToolsRegistered = true;
|
|
99
113
|
this.app.logger.info("Document Understanding: Dynamic pipeline tools provider registered.");
|
|
100
114
|
} catch (err) {
|
|
101
115
|
this.app.logger.warn("Document Understanding: Failed to register AI tools, continue without it.", err);
|
|
@@ -109,6 +123,15 @@ class PluginDocumentUnderstandingServer extends import_server.Plugin {
|
|
|
109
123
|
}
|
|
110
124
|
async remove() {
|
|
111
125
|
}
|
|
126
|
+
async beforeStop() {
|
|
127
|
+
var _a, _b, _c, _d;
|
|
128
|
+
(_b = (_a = this.app).off) == null ? void 0 : _b.call(_a, "afterStart", this.registerAIToolsAfterStart);
|
|
129
|
+
(_d = (_c = this.app).removeListener) == null ? void 0 : _d.call(_c, "afterStart", this.registerAIToolsAfterStart);
|
|
130
|
+
const runtimeState = this.app;
|
|
131
|
+
if (runtimeState.documentUnderstandingService === this.service) {
|
|
132
|
+
runtimeState.documentUnderstandingService = void 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
112
135
|
}
|
|
113
136
|
var plugin_default = PluginDocumentUnderstandingServer;
|
|
114
137
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Document Understanding",
|
|
4
4
|
"displayName.zh-CN": "文档理解",
|
|
5
5
|
"description": "Configure external document processing endpoints, chain them into pipelines, and expose enabled pipelines as AI tools.",
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.8",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "dist/server/index.js",
|
|
9
9
|
"files": [
|
package/src/server/plugin.ts
CHANGED
|
@@ -6,21 +6,26 @@ import { createDynamicPipelineToolsProvider } from './tools/document-understandi
|
|
|
6
6
|
|
|
7
7
|
type DynamicToolsProvider = ReturnType<typeof createDynamicPipelineToolsProvider>;
|
|
8
8
|
|
|
9
|
-
interface
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
registerDynamicTools: (provider: DynamicToolsProvider) => void;
|
|
13
|
-
};
|
|
9
|
+
interface AiManagerLike {
|
|
10
|
+
toolsManager?: {
|
|
11
|
+
registerDynamicTools: (provider: DynamicToolsProvider) => void;
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
interface DocumentToolRuntimeState {
|
|
16
|
+
documentUnderstandingToolProviderRegistered?: boolean;
|
|
17
|
+
documentUnderstandingService?: DocumentUnderstandingService;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const isAiManagerLike = (manager: unknown): manager is AiManagerLike => {
|
|
21
|
+
const candidate = manager as AiManagerLike;
|
|
22
|
+
return typeof candidate?.toolsManager?.registerDynamicTools === 'function';
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
export class PluginDocumentUnderstandingServer extends Plugin {
|
|
23
26
|
public service!: DocumentUnderstandingService;
|
|
27
|
+
private aiToolsRegistered = false;
|
|
28
|
+
private readonly registerAIToolsAfterStart = () => this.registerAITools();
|
|
24
29
|
|
|
25
30
|
async afterAdd() {}
|
|
26
31
|
|
|
@@ -49,6 +54,7 @@ export class PluginDocumentUnderstandingServer extends Plugin {
|
|
|
49
54
|
|
|
50
55
|
// 4. Register AI tool (graceful)
|
|
51
56
|
this.registerAITools();
|
|
57
|
+
this.app.on('afterStart', this.registerAIToolsAfterStart);
|
|
52
58
|
|
|
53
59
|
// 5. ACL
|
|
54
60
|
this.app.acl.registerSnippet({
|
|
@@ -83,13 +89,24 @@ export class PluginDocumentUnderstandingServer extends Plugin {
|
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
private registerAITools() {
|
|
92
|
+
if (this.aiToolsRegistered) return;
|
|
86
93
|
try {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
94
|
+
const aiManager = (this.app as typeof this.app & { aiManager?: unknown }).aiManager;
|
|
95
|
+
if (!isAiManagerLike(aiManager)) {
|
|
89
96
|
this.app.logger.warn('Document Understanding: plugin-ai not available, skip AI tool registration.');
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
92
|
-
|
|
99
|
+
const runtimeState = this.app as typeof this.app & DocumentToolRuntimeState;
|
|
100
|
+
runtimeState.documentUnderstandingService = this.service;
|
|
101
|
+
if (!runtimeState.documentUnderstandingToolProviderRegistered) {
|
|
102
|
+
aiManager.toolsManager.registerDynamicTools(async (register) => {
|
|
103
|
+
const currentService = runtimeState.documentUnderstandingService;
|
|
104
|
+
if (!currentService) return;
|
|
105
|
+
await createDynamicPipelineToolsProvider(currentService)(register);
|
|
106
|
+
});
|
|
107
|
+
runtimeState.documentUnderstandingToolProviderRegistered = true;
|
|
108
|
+
}
|
|
109
|
+
this.aiToolsRegistered = true;
|
|
93
110
|
this.app.logger.info('Document Understanding: Dynamic pipeline tools provider registered.');
|
|
94
111
|
} catch (err) {
|
|
95
112
|
this.app.logger.warn('Document Understanding: Failed to register AI tools, continue without it.', err);
|
|
@@ -103,6 +120,15 @@ export class PluginDocumentUnderstandingServer extends Plugin {
|
|
|
103
120
|
async afterDisable() {}
|
|
104
121
|
|
|
105
122
|
async remove() {}
|
|
123
|
+
|
|
124
|
+
async beforeStop() {
|
|
125
|
+
this.app.off?.('afterStart', this.registerAIToolsAfterStart);
|
|
126
|
+
this.app.removeListener?.('afterStart', this.registerAIToolsAfterStart);
|
|
127
|
+
const runtimeState = this.app as typeof this.app & DocumentToolRuntimeState;
|
|
128
|
+
if (runtimeState.documentUnderstandingService === this.service) {
|
|
129
|
+
runtimeState.documentUnderstandingService = undefined;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
106
132
|
}
|
|
107
133
|
|
|
108
134
|
export default PluginDocumentUnderstandingServer;
|