plugin-document-understanding 1.0.1 → 1.1.0
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/README.md +366 -366
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +6 -6
- package/dist/locale/en-US.json +121 -121
- package/dist/locale/vi-VN.json +121 -121
- package/dist/server/plugin.js +3 -1
- package/dist/server/tools/document-understanding-tool.js +19 -6
- package/package.json +1 -1
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(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("plugin-document-understanding",["react","@nocobase/client","@ant-design/icons","antd"],t):"object"==typeof exports?exports["plugin-document-understanding"]=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):e["plugin-document-understanding"]=t(e.react,e["@nocobase/client"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,r){return function(){"use strict";var l={482:function(e){e.exports=n},772:function(e){e.exports=t},721:function(e){e.exports=r},156:function(t){t.exports=e}},a={};function o(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return l[e](n,n.exports,o),n.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return!function(){o.r(i),o.d(i,{default:function(){return X}});var e=o(772),t={},n=o(156),r=o.n(n),l=o(721),a=o(482);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=function(){var t,o,i=s(l.Form.useForm(),1)[0],u=(0,e.useAPIClient)(),p=s((0,n.useState)(!0),2),d=p[0],m=p[1],f=s((0,n.useState)(!1),2),y=f[0],h=f[1];(0,n.useEffect)(function(){u.request({url:"docUnderstanding:getConfig"}).then(function(e){var t=e.data;i.setFieldsValue((null==t?void 0:t.data)||{}),m(!1)}).catch(function(){return m(!1)})},[]);var b=(t=function(e){return function(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:h(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,u.request({url:"docUnderstanding:updateConfig",method:"POST",data:e})];case 2:return t.sent(),l.message.success("Configuration saved successfully"),[3,5];case 3:return t.sent(),l.message.error("Failed to save config"),[3,5];case 4:return h(!1),[7];case 5:return[2]}})},o=function(){var e=this,n=arguments;return new Promise(function(r,l){var a=t.apply(e,n);function o(e){c(a,r,l,o,i,"next",e)}function i(e){c(a,r,l,o,i,"throw",e)}o(void 0)})},function(e){return o.apply(this,arguments)});return d?r().createElement(l.Spin,{style:{marginTop:40}}):r().createElement(l.Form,{form:i,layout:"vertical",onFinish:b,style:{maxWidth:600}},r().createElement(l.Alert,{message:"Service Connection",description:"Configure the connection to your external document processing service. All endpoints will use this base URL and authentication.",type:"info",showIcon:!0,style:{marginBottom:24}}),r().createElement(l.Form.Item,{name:"baseUrl",label:"Base URL",rules:[{required:!0,message:"Base URL is required"}],help:"The root URL of your document processing API"},r().createElement(l.Input,{prefix:r().createElement(a.LinkOutlined,null),placeholder:"http://my-ocr-service:8000"})),r().createElement(l.Form.Item,{name:"authType",label:"Authentication Type",initialValue:"none"},r().createElement(l.Select,null,r().createElement(l.Select.Option,{value:"none"},"None"),r().createElement(l.Select.Option,{value:"api_key"},"API Key"),r().createElement(l.Select.Option,{value:"bearer"},"Bearer Token"),r().createElement(l.Select.Option,{value:"custom_header"},"Custom Header"))),r().createElement(l.Form.Item,{noStyle:!0,dependencies:["authType"]},function(){var e=i.getFieldValue("authType");return"none"===e?null:r().createElement(r().Fragment,null,"custom_header"===e&&r().createElement(l.Form.Item,{name:"authHeaderName",label:"Custom Header Name",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"X-Api-Key"})),r().createElement(l.Form.Item,{name:"authKey",label:"bearer"===e?"Bearer Token":"API Key",rules:[{required:!0}]},r().createElement(l.Input.Password,{placeholder:"Enter key or token"})))}),r().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"}},r().createElement(l.Form.Item,{name:"defaultTimeout",label:"Request Timeout (ms)",initialValue:3e4},r().createElement(l.InputNumber,{style:{width:"100%"},min:1e3,step:1e3})),r().createElement(l.Form.Item,{name:"defaultRetries",label:"Default Retries",initialValue:2},r().createElement(l.InputNumber,{style:{width:"100%"},min:0,max:10})),r().createElement(l.Form.Item,{name:"pollInterval",label:"Poll Interval (ms)",initialValue:5e3},r().createElement(l.InputNumber,{style:{width:"100%"},min:1e3,step:1e3})),r().createElement(l.Form.Item,{name:"pollTimeout",label:"Poll Timeout (ms)",initialValue:3e5},r().createElement(l.InputNumber,{style:{width:"100%"},min:5e3,step:5e3}))),r().createElement(l.Form.Item,{name:"webhookSecret",label:"Webhook Secret",help:"Used to verify HMAC-SHA256 signatures on incoming webhook callbacks"},r().createElement(l.Input.Password,{placeholder:"Optional: secret for webhook signature verification"})),r().createElement(l.Form.Item,null,r().createElement(l.Button,{type:"primary",htmlType:"submit",icon:r().createElement(a.SaveOutlined,null),loading:y},"Save Configuration")))};function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){m(a,r,l,o,i,"next",e)}function i(e){m(a,r,l,o,i,"throw",e)}o(void 0)})}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||b(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}function g(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var E=l.Input.TextArea,v=function(e){var t=e.value,n=void 0===t?{}:t,o=e.onChange,i=Object.entries(n),u=function(e,t,n){var r=h(i);r[e]=[t,n],null==o||o(Object.fromEntries(r))},c=function(e){var t=h(i);t.splice(e,1),null==o||o(Object.fromEntries(t))};return r().createElement("div",null,i.map(function(e,t){var n=y(e,2),o=n[0],i=n[1];return r().createElement(l.Space,{key:t,style:{display:"flex",marginBottom:4}},r().createElement(l.Input,{placeholder:"Header name",value:o,onChange:function(e){return u(t,e.target.value,i)},style:{width:180}}),r().createElement(l.Input,{placeholder:"Value",value:i,onChange:function(e){return u(t,o,e.target.value)},style:{width:220}}),r().createElement(l.Button,{size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null),onClick:function(){return c(t)}}))}),r().createElement(l.Button,{size:"small",type:"dashed",icon:r().createElement(a.PlusOutlined,null),onClick:function(){var e,t;return null==o?void 0:o((e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},n),t=t={"":""},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))}},"Add Header"))},S=function(e){var t=e.value,l=e.onChange,a=e.placeholder,o=y((0,n.useState)(""),2),i=o[0],u=o[1],c=y((0,n.useState)(""),2),s=c[0],p=c[1];return(0,n.useEffect)(function(){u(t?JSON.stringify(t,null,2):"")},[]),r().createElement("div",null,r().createElement(E,{rows:6,value:i,onChange:function(e){return u(e.target.value)},onBlur:function(){if(!i.trim()){p(""),null==l||l(null);return}try{var e=JSON.parse(i);p(""),null==l||l(e)}catch(e){p("Invalid JSON")}},placeholder:a||"{}",style:{fontFamily:"monospace",fontSize:12}}),s&&r().createElement("div",{style:{color:"#ff4d4f",fontSize:12}},s))},w=function(){var t,o,i,u=(0,e.useAPIClient)(),c=y((0,n.useState)([]),2),s=c[0],p=c[1],d=y((0,n.useState)(!1),2),m=d[0],h=d[1],b=y((0,n.useState)(!1),2),w=b[0],O=b[1],I=y(l.Form.useForm(),1)[0],k=y((0,n.useState)(null),2),T=k[0],x=k[1],P=(t=f(function(){var e;return g(this,function(t){switch(t.label){case 0:h(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,u.request({url:"docUnderstanding:listEndpoints"})];case 2:return p((null==(e=t.sent().data)?void 0:e.data)||[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})}),function(){return t.apply(this,arguments)});(0,n.useEffect)(function(){P()},[]);var C=function(e){x(e.id),I.setFieldsValue(e),O(!0)},F=(o=f(function(e){return g(this,function(t){switch(t.label){case 0:return[4,u.request({url:"docUnderstanding:deleteEndpoint",method:"POST",params:{filterByTk:e}})];case 1:return t.sent(),l.message.success("Deleted"),P(),[2]}})}),function(e){return o.apply(this,arguments)}),A=(i=f(function(){var e;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),[4,I.validateFields()];case 1:if(e=t.sent(),!T)return[3,3];return[4,u.request({url:"docUnderstanding:updateEndpoint",method:"POST",params:{filterByTk:T},data:e})];case 2:return t.sent(),[3,5];case 3:return[4,u.request({url:"docUnderstanding:createEndpoint",method:"POST",data:e})];case 4:t.sent(),t.label=5;case 5:return l.message.success("Saved"),O(!1),P(),[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}})}),function(){return i.apply(this,arguments)}),j=[{title:"Name",dataIndex:"name",width:150},{title:"Subpath",dataIndex:"subpath",width:200},{title:"Method",dataIndex:"method",width:80,render:function(e){return r().createElement(l.Tag,null,e)}},{title:"Execution",dataIndex:"executionMode",width:100,render:function(e){return r().createElement(l.Tag,{color:{sync:"green",polling:"blue",webhook:"purple"}[e]},e)}},{title:"File",dataIndex:"fileInputMode",width:90,render:function(e){return"none"===e?"-":e}},{title:"Enabled",dataIndex:"enabled",width:70,render:function(e){return e?r().createElement(l.Tag,{color:"success"},"Yes"):r().createElement(l.Tag,null,"No")}},{title:"Action",width:120,render:function(e,t){return r().createElement(l.Space,null,r().createElement(l.Button,{type:"link",size:"small",icon:r().createElement(a.EditOutlined,null),onClick:function(){return C(t)}},"Edit"),r().createElement(l.Popconfirm,{title:"Delete this endpoint?",onConfirm:function(){return F(t.id)}},r().createElement(l.Button,{type:"link",size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null)},"Delete")))}}];return r().createElement("div",null,r().createElement("div",{style:{marginBottom:16}},r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),onClick:function(){x(null),I.resetFields(),O(!0)}},"Add Endpoint")),r().createElement(l.Table,{rowKey:"id",columns:j,dataSource:s,loading:m,size:"small"}),r().createElement(l.Modal,{title:T?"Edit Endpoint":"Add Endpoint",open:w,onOk:A,onCancel:function(){return O(!1)},width:680,destroyOnClose:!0},r().createElement(l.Form,{form:I,layout:"vertical",preserve:!1},r().createElement(l.Tabs,{size:"small",items:[{key:"basic",label:"Basic",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"name",label:"Unique Name",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"ocr, classify, extract..."})),r().createElement(l.Form.Item,{name:"subpath",label:"Subpath",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"/api/v1/ocr"})),r().createElement(l.Form.Item,{name:"description",label:"Description"},r().createElement(E,{rows:2,placeholder:"What this endpoint does"})),r().createElement(l.Space,{size:"large"},r().createElement(l.Form.Item,{name:"method",label:"HTTP Method",initialValue:"POST"},r().createElement(l.Select,{style:{width:120}},r().createElement(l.Select.Option,{value:"GET"},"GET"),r().createElement(l.Select.Option,{value:"POST"},"POST"),r().createElement(l.Select.Option,{value:"PUT"},"PUT"))),r().createElement(l.Form.Item,{name:"enabled",label:"Enabled",valuePropName:"checked",initialValue:!0},r().createElement(l.Switch,null))))},{key:"file",label:"File Input",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"fileInputMode",label:"File Input Mode",initialValue:"none"},r().createElement(l.Select,{style:{width:200}},r().createElement(l.Select.Option,{value:"none"},"None"),r().createElement(l.Select.Option,{value:"multipart"},"Multipart Upload"),r().createElement(l.Select.Option,{value:"base64"},"Base64 in JSON"))),r().createElement(l.Form.Item,{noStyle:!0,dependencies:["fileInputMode"]},function(){return"none"!==I.getFieldValue("fileInputMode")?r().createElement(l.Form.Item,{name:"maxFiles",label:"Max Files",initialValue:1},r().createElement(l.InputNumber,{min:1,max:20,style:{width:120}})):null}))},{key:"async",label:"Async Config",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"executionMode",label:"Execution Mode",initialValue:"sync"},r().createElement(l.Select,{style:{width:200}},r().createElement(l.Select.Option,{value:"sync"},"Synchronous"),r().createElement(l.Select.Option,{value:"polling"},"Polling"),r().createElement(l.Select.Option,{value:"webhook"},"Webhook"))),r().createElement(l.Form.Item,{noStyle:!0,dependencies:["executionMode"]},function(){var e=I.getFieldValue("executionMode");return"sync"===e?null:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"pollTaskIdField",label:"Task ID Field",help:"Field in response containing the async task ID",initialValue:"task_id"},r().createElement(l.Input,{placeholder:"task_id"})),"polling"===e&&r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"pollResultSubpath",label:"Poll Result Subpath",help:"URL to poll for result. Use {taskId} as placeholder.",rules:[{required:!0,message:"Required for polling mode"}]},r().createElement(l.Input,{placeholder:"/api/v1/tasks/{taskId}/result"})),r().createElement(l.Form.Item,{name:"pollResultField",label:"Result Field",help:"Field in poll response containing the actual result"},r().createElement(l.Input,{placeholder:"result"})),r().createElement(l.Form.Item,{name:"pollStatusField",label:"Status Field (optional)",help:"Field to check completion status. If empty, any non-null result = complete."},r().createElement(l.Input,{placeholder:"status"})),r().createElement(l.Form.Item,{name:"pollCompletedValue",label:"Completed Value",help:"Value of status field that means 'done'",initialValue:"completed"},r().createElement(l.Input,{placeholder:"completed"})),r().createElement(l.Space,{size:"large"},r().createElement(l.Form.Item,{name:"pollInterval",label:"Poll Interval (ms)",help:"Override default"},r().createElement(l.InputNumber,{min:1e3,step:1e3,placeholder:"5000",style:{width:150}})),r().createElement(l.Form.Item,{name:"pollTimeout",label:"Poll Timeout (ms)",help:"Override default"},r().createElement(l.InputNumber,{min:5e3,step:5e3,placeholder:"300000",style:{width:150}})))))}))},{key:"schema",label:"Schema",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"requestBodySchema",label:"Request Body Schema (JSON Schema)"},r().createElement(S,{placeholder:'{ "type": "object", "properties": { ... } }'})),r().createElement(l.Form.Item,{name:"responseSchema",label:"Response Schema (JSON Schema)"},r().createElement(S,{placeholder:'{ "type": "object", "properties": { ... } }'})))},{key:"headers",label:"Custom Headers",children:r().createElement(l.Form.Item,{name:"customHeaders",label:"Additional Headers"},r().createElement(v,null))}]}))))};function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function I(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function k(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){I(a,r,l,o,i,"next",e)}function i(e){I(a,r,l,o,i,"throw",e)}o(void 0)})}}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function x(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||F(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||F(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}}function A(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var j=l.Input.TextArea,B=l.Collapse.Panel,M=function(e){var t=e.value,l=e.onChange,a=e.placeholder,o=e.rows,i=P((0,n.useState)(""),2),u=i[0],c=i[1],s=P((0,n.useState)(""),2),p=s[0],d=s[1];return(0,n.useEffect)(function(){c(t?JSON.stringify(t,null,2):"")},[]),r().createElement("div",null,r().createElement(j,{rows:void 0===o?5:o,value:u,onChange:function(e){return c(e.target.value)},onBlur:function(){if(!u.trim()){d(""),null==l||l(null);return}try{var e=JSON.parse(u);d(""),null==l||l(e)}catch(e){d("Invalid JSON")}},placeholder:a||"{}",style:{fontFamily:"monospace",fontSize:12}}),p&&r().createElement("div",{style:{color:"#ff4d4f",fontSize:12}},p))},N=function(e){var t=e.steps,n=e.endpoints,o=e.onChange,i=function(e,n){var r,l=C(t),a=e+n;a<0||a>=l.length||(r=[l[a],l[e]],l[e]=r[0],l[a]=r[1],l.forEach(function(e,t){return e.stepOrder=t+1}),o(l))},u=function(e,n,r){var l=C(t);l[e][n]=r,o(l)},c=function(e){var n=t.filter(function(t,n){return n!==e});n.forEach(function(e,t){return e.stepOrder=t+1}),o(n)},s=function(){var e;o(C(t).concat([(e=t.length+1,{_key:"new_".concat(Date.now(),"_").concat(Math.random()),stepOrder:e,name:"",endpointId:null,inputMapping:null,outputAlias:"",condition:null,onError:"fail",retryCount:0})]))};return 0===t.length?r().createElement("div",{style:{textAlign:"center",padding:"20px 0"}},r().createElement(l.Empty,{description:"No steps yet",imageStyle:{height:40}}),r().createElement(l.Button,{type:"dashed",icon:r().createElement(a.PlusOutlined,null),onClick:s,style:{marginTop:8}},"Add First Step")):r().createElement("div",null,r().createElement(l.Collapse,{size:"small",defaultActiveKey:t.map(function(e){return e._key})},t.map(function(e,o){var s=n.find(function(t){return t.id===e.endpointId}),p=r().createElement(l.Space,{size:4,onClick:function(e){return e.stopPropagation()}},r().createElement(l.Button,{size:"small",disabled:0===o,icon:r().createElement(a.ArrowUpOutlined,null),onClick:function(){return i(o,-1)}}),r().createElement(l.Button,{size:"small",disabled:o===t.length-1,icon:r().createElement(a.ArrowDownOutlined,null),onClick:function(){return i(o,1)}}),r().createElement(l.Popconfirm,{title:"Remove step?",onConfirm:function(){return c(o)}},r().createElement(l.Button,{size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null)}))),d=r().createElement(l.Space,null,r().createElement(l.Badge,{count:e.stepOrder,style:{backgroundColor:"#1677ff"}}),r().createElement("span",null,e.name||"(unnamed)"),s&&r().createElement(l.Tag,null,s.name),"skip"===e.onError&&r().createElement(l.Tooltip,{title:"Step can be skipped on error"},r().createElement(l.Tag,{color:"orange"},"skip on error")),e.condition&&r().createElement(l.Tooltip,{title:"Has condition"},r().createElement(l.Tag,{color:"purple"},"conditional")));return r().createElement(B,{key:e._key,header:d,extra:p},r().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"}},r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Step Name *"),r().createElement(l.Input,{value:e.name,onChange:function(e){return u(o,"name",e.target.value)},placeholder:"OCR, Classify, Extract..."})),r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Endpoint *"),r().createElement(l.Select,{value:e.endpointId,onChange:function(e){return u(o,"endpointId",e)},placeholder:"Select endpoint",style:{width:"100%"},options:n.map(function(e){return{value:e.id,label:"".concat(e.name," (").concat(e.method," ").concat(e.subpath,")")}})})),r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4,marginTop:12}},"Output Alias"),r().createElement(l.Input,{value:e.outputAlias,onChange:function(e){return u(o,"outputAlias",e.target.value)},placeholder:"ocr_result"}),r().createElement("div",{style:{color:"#888",fontSize:11}},"Other steps reference this as: $step[",e.outputAlias||e.stepOrder,"].response.field")),r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4,marginTop:12}},"On Error"),r().createElement(l.Space,null,r().createElement(l.Select,{value:e.onError,onChange:function(e){return u(o,"onError",e)},style:{width:120}},r().createElement(l.Select.Option,{value:"fail"},"Fail"),r().createElement(l.Select.Option,{value:"skip"},"Skip"),r().createElement(l.Select.Option,{value:"retry"},"Retry")),"retry"===e.onError&&r().createElement(l.InputNumber,{value:e.retryCount,onChange:function(e){return u(o,"retryCount",e||0)},min:1,max:10,addonBefore:"x",style:{width:100}})))),r().createElement("div",{style:{marginTop:12}},r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Input Mapping (JSON)",r().createElement(l.Tooltip,{title:"Map endpoint input fields. Use $input.field, $step[alias].response.field, $files, or literal values."},r().createElement("span",{style:{fontWeight:"normal",color:"#888",marginLeft:6,cursor:"help"}},"?"))),r().createElement(M,{value:e.inputMapping,onChange:function(e){return u(o,"inputMapping",e)},placeholder:'{ "text": "$step[ocr_result].response.text", "lang": "vi" }',rows:3})),r().createElement("div",{style:{marginTop:12}},r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Condition (optional JSON)",r().createElement(l.Tooltip,{title:'Only run this step if condition matches. Format: { "field": "$step[x].response.y", "op": "eq", "value": "..." }'},r().createElement("span",{style:{fontWeight:"normal",color:"#888",marginLeft:6,cursor:"help"}},"?"))),r().createElement(M,{value:e.condition,onChange:function(e){return u(o,"condition",e)},placeholder:'{ "field": "$step[classify].response.type", "op": "eq", "value": "invoice" }',rows:2})))})),r().createElement(l.Button,{type:"dashed",icon:r().createElement(a.PlusOutlined,null),onClick:s,style:{marginTop:8,width:"100%"}},"Add Step"))},q=function(){var t,o,i=(0,e.useAPIClient)(),u=P((0,n.useState)([]),2),c=u[0],s=u[1],p=P((0,n.useState)([]),2),d=p[0],m=p[1],f=P((0,n.useState)(!1),2),y=f[0],h=f[1],b=P((0,n.useState)(!1),2),g=b[0],E=b[1],v=P(l.Form.useForm(),1)[0],S=P((0,n.useState)(null),2),w=S[0],O=S[1],I=P((0,n.useState)([]),2),F=I[0],q=I[1],R=(0,n.useCallback)(k(function(){var e,t,n,r,l;return A(this,function(a){switch(a.label){case 0:h(!0),a.label=1;case 1:return a.trys.push([1,,3,4]),[4,Promise.all([i.request({url:"docUnderstanding:listPipelines"}),i.request({url:"docUnderstanding:listEndpoints"})])];case 2:return r=(n=P.apply(void 0,[a.sent(),2]))[0],l=n[1],s((null==(e=r.data)?void 0:e.data)||[]),m((null==(t=l.data)?void 0:t.data)||[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})}),[i]);(0,n.useEffect)(function(){R()},[R]);var D=function(e){O(e.id),v.setFieldsValue({name:e.name,description:e.description,enabled:e.enabled,inputSchema:e.inputSchema,outputMapping:e.outputMapping}),q(C(e.steps||[]).sort(function(e,t){return e.stepOrder-t.stepOrder}).map(function(e){return{_key:"srv_".concat(e.id),id:e.id,stepOrder:e.stepOrder,name:e.name,endpointId:e.endpointId,inputMapping:e.inputMapping,outputAlias:e.outputAlias||"",condition:e.condition,onError:e.onError||"fail",retryCount:e.retryCount||0}})),E(!0)},U=(t=k(function(e){return A(this,function(t){switch(t.label){case 0:return[4,i.request({url:"docUnderstanding:deletePipeline",method:"POST",params:{filterByTk:e}})];case 1:return t.sent(),l.message.success("Deleted"),R(),[2]}})}),function(e){return t.apply(this,arguments)}),z=(o=k(function(){var e,t,n,r,a,o,u,c,s;return A(this,function(p){switch(p.label){case 0:return p.trys.push([0,6,,7]),[4,v.validateFields()];case 1:e=p.sent(),t=!0,n=!1,r=void 0;try{for(a=F[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){if(!(u=o.value).name)return l.message.error("All steps must have a name"),[2];if(!u.endpointId)return l.message.error('Step "'.concat(u.name||u.stepOrder,'" must have an endpoint')),[2]}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}if(new Set(c=F.map(function(e){return e.outputAlias}).filter(Boolean)).size!==c.length)return l.message.error("Step output aliases must be unique"),[2];if(s=x(T({},e),{steps:F.map(function(e){return x(T({},e.id?{id:e.id}:{}),{stepOrder:e.stepOrder,name:e.name,endpointId:e.endpointId,inputMapping:e.inputMapping,outputAlias:e.outputAlias||void 0,condition:e.condition,onError:e.onError,retryCount:"retry"===e.onError?e.retryCount:0})})}),!w)return[3,3];return[4,i.request({url:"docUnderstanding:updatePipeline",method:"POST",params:{filterByTk:w},data:s})];case 2:return p.sent(),[3,5];case 3:return[4,i.request({url:"docUnderstanding:createPipeline",method:"POST",data:s})];case 4:p.sent(),p.label=5;case 5:return l.message.success("Saved"),E(!1),R(),[3,7];case 6:return p.sent(),[3,7];case 7:return[2]}})}),function(){return o.apply(this,arguments)}),_=[{title:"Name",dataIndex:"name",width:200},{title:"Steps",dataIndex:"steps",width:300,render:function(e){if(!e||0===e.length)return r().createElement(l.Tag,null,"0 steps");var t=C(e).sort(function(e,t){return e.stepOrder-t.stepOrder});return r().createElement(l.Space,{size:2,wrap:!0},t.map(function(e,t){return r().createElement(r().Fragment,{key:e.id},t>0&&r().createElement("span",{style:{color:"#ccc"}},"→"),r().createElement(l.Tag,null,e.name||"Step ".concat(e.stepOrder)))}))}},{title:"Enabled",dataIndex:"enabled",width:80,render:function(e){return e?r().createElement(l.Tag,{color:"success"},"Yes"):r().createElement(l.Tag,null,"No")}},{title:"AI Tool",width:100,render:function(e,t){var n;return t.enabled?r().createElement(l.Tooltip,{title:"Registered as: doc_understanding.".concat(null==(n=t.name)?void 0:n.toLowerCase().replace(/[^a-z0-9_]/g,"_"))},r().createElement(l.Tag,{color:"blue",icon:r().createElement(a.ThunderboltOutlined,null)},"Active")):r().createElement(l.Tag,null,"Inactive")}},{title:"Action",width:120,render:function(e,t){return r().createElement(l.Space,null,r().createElement(l.Button,{type:"link",size:"small",icon:r().createElement(a.EditOutlined,null),onClick:function(){return D(t)}},"Edit"),r().createElement(l.Popconfirm,{title:"Delete this pipeline?",onConfirm:function(){return U(t.id)}},r().createElement(l.Button,{type:"link",size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null)},"Delete")))}}];return r().createElement("div",null,r().createElement("div",{style:{marginBottom:16}},r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),onClick:function(){O(null),v.resetFields(),q([]),E(!0)}},"Add Pipeline")),r().createElement(l.Table,{rowKey:"id",columns:_,dataSource:c,loading:y,size:"small"}),r().createElement(l.Modal,{title:w?"Edit Pipeline":"New Pipeline",open:g,onOk:z,onCancel:function(){return E(!1)},width:800,destroyOnClose:!0},r().createElement(l.Form,{form:v,layout:"vertical",preserve:!1},r().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"}},r().createElement(l.Form.Item,{name:"name",label:"Pipeline Name",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"full_document_processing"})),r().createElement(l.Form.Item,{name:"enabled",label:"Enabled",valuePropName:"checked",initialValue:!0},r().createElement(l.Switch,null))),r().createElement(l.Form.Item,{name:"description",label:"Description"},r().createElement(j,{rows:2,placeholder:"What this pipeline does"})),r().createElement(l.Card,{title:"Pipeline Steps",size:"small",style:{marginBottom:16},extra:r().createElement(l.Tag,{color:"blue"},F.length," step(s)")},r().createElement(N,{steps:F,endpoints:d,onChange:q})),r().createElement(l.Collapse,{size:"small",ghost:!0},r().createElement(B,{header:"Advanced: Input Schema & Output Mapping",key:"advanced"},r().createElement(l.Form.Item,{name:"inputSchema",label:"Input Schema (JSON Schema)",help:"Defines what input this pipeline accepts. Used by AI tool schema."},r().createElement(M,{placeholder:'{ "type": "object", "properties": { "document_url": { "type": "string" } }, "required": ["document_url"] }'})),r().createElement(l.Form.Item,{name:"outputMapping",label:"Output Mapping (JSON)",help:"Map final step results to pipeline output. If empty, all step results are returned."},r().createElement(M,{placeholder:'{ "text": "$step[ocr_result].response.text", "category": "$step[classify].response.category" }'})))))))};function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function D(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function U(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){D(a,r,l,o,i,"next",e)}function i(e){D(a,r,l,o,i,"throw",e)}o(void 0)})}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var V={pending:{color:"default",label:"Pending"},running:{color:"processing",label:"Running"},polling:{color:"processing",label:"Polling"},completed:{color:"success",label:"Completed"},failed:{color:"error",label:"Failed"},timeout:{color:"error",label:"Timeout"}},J=function(){var t,o,i=(0,e.useAPIClient)(),u=z((0,n.useState)([]),2),c=u[0],s=u[1],p=z((0,n.useState)([]),2),d=p[0],m=p[1],f=z((0,n.useState)(!1),2),y=f[0],h=f[1],b=z((0,n.useState)(!1),2),g=b[0],E=b[1],v=z((0,n.useState)(null),2),S=v[0],w=v[1],O=z((0,n.useState)(void 0),2),I=O[0],k=O[1],T=z((0,n.useState)(void 0),2),x=T[0],P=T[1],C=(0,n.useCallback)(U(function(){var e,t;return _(this,function(n){switch(n.label){case 0:h(!0),n.label=1;case 1:return n.trys.push([1,,3,4]),t={},I&&(t.status=I),x&&(t.pipelineId=x),[4,i.request({url:"docUnderstanding:listJobs",params:{filter:Object.keys(t).length>0?t:void 0}})];case 2:return s((null==(e=n.sent().data)?void 0:e.data)||[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})}),[i,I,x]),F=(0,n.useCallback)(U(function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,i.request({url:"docUnderstanding:listPipelines"})];case 1:return m((null==(e=t.sent().data)?void 0:e.data)||[]),[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}})}),[i]);(0,n.useEffect)(function(){F()},[F]),(0,n.useEffect)(function(){C();var e=setInterval(C,1e4);return function(){return clearInterval(e)}},[C]);var A=new Map(d.map(function(e){return[e.id,e.name]})),j=(t=U(function(e){var t;return _(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,i.request({url:"docUnderstanding:getJobStatus",params:{filterByTk:e.id}})];case 1:return w((null==(t=n.sent().data)?void 0:t.data)||e),[3,3];case 2:return n.sent(),w(e),[3,3];case 3:return E(!0),[2]}})}),function(e){return t.apply(this,arguments)}),B=[{title:"ID",dataIndex:"id",width:60},{title:"Pipeline",dataIndex:"pipelineId",width:180,render:function(e){return A.get(e)||"#".concat(e)}},{title:"Status",dataIndex:"status",width:100,render:function(e){var t=V[e]||{color:"default",label:e};return r().createElement(l.Tag,{color:t.color},t.label)}},{title:"Current Step",dataIndex:"currentStep",width:90,render:function(e,t){return"completed"===t.status?r().createElement(l.Tag,{color:"success"},"Done"):"failed"===t.status?r().createElement(l.Tag,{color:"error"},"Step ",e):r().createElement(l.Badge,{status:"processing",text:"Step ".concat(e)})}},{title:"Started",dataIndex:"startedAt",width:160,render:function(e){return e?new Date(e).toLocaleString():"-"}},{title:"Completed",dataIndex:"completedAt",width:160,render:function(e){return e?new Date(e).toLocaleString():"-"}},{title:"Action",width:80,render:function(e,t){return r().createElement(l.Button,{size:"small",icon:r().createElement(a.EyeOutlined,null),onClick:function(){return j(t)}},"View")}}];return r().createElement("div",null,r().createElement(l.Space,{style:{marginBottom:16},wrap:!0},r().createElement(l.Select,{allowClear:!0,placeholder:"Filter by status",value:I,onChange:k,style:{width:160},options:Object.entries(V).map(function(e){var t=z(e,2);return{value:t[0],label:t[1].label}})}),r().createElement(l.Select,{allowClear:!0,placeholder:"Filter by pipeline",value:x,onChange:P,style:{width:200},options:d.map(function(e){return{value:e.id,label:e.name}})}),r().createElement(l.Button,{icon:r().createElement(a.ReloadOutlined,null),onClick:C},"Refresh")),r().createElement(l.Table,{rowKey:"id",columns:B,dataSource:c,loading:y,size:"small",pagination:{pageSize:20}}),r().createElement(l.Drawer,{title:S?"Job #".concat(S.id," — ").concat(A.get(S.pipelineId)||"Unknown"):"Job Details",width:640,open:g,onClose:function(){return E(!1)}},S&&r().createElement("div",null,r().createElement("div",{style:{marginBottom:16}},r().createElement(l.Space,null,r().createElement(l.Tag,{color:null==(o=V[S.status])?void 0:o.color},S.status),S.startedAt&&r().createElement("span",null,"Started: ",new Date(S.startedAt).toLocaleString()),S.completedAt&&r().createElement("span",null,"Completed: ",new Date(S.completedAt).toLocaleString()))),S.error&&r().createElement("div",{style:{background:"#fff2f0",border:"1px solid #ffccc7",borderRadius:6,padding:12,marginBottom:16}},r().createElement("strong",{style:{color:"#cf1322"}},"Error:"),r().createElement("pre",{style:{margin:"4px 0 0",whiteSpace:"pre-wrap",color:"#cf1322"}},S.error)),r().createElement("h4",null,"Input"),r().createElement("pre",{style:{background:"#f5f5f5",padding:12,borderRadius:6,fontSize:12,maxHeight:200,overflow:"auto"}},JSON.stringify(S.input,null,2)),r().createElement("h4",{style:{marginTop:16}},"Step Results"),S.stepResults&&Object.keys(S.stepResults).length>0?Object.entries(S.stepResults).map(function(e){var t=z(e,2),n=t[0],a=t[1];return r().createElement("div",{key:n,style:{marginBottom:8}},r().createElement(l.Tag,{color:"blue"},n),r().createElement("pre",{style:{background:"#f5f5f5",padding:8,borderRadius:4,fontSize:11,maxHeight:150,overflow:"auto",marginTop:4}},JSON.stringify(a,null,2)))}):r().createElement("div",{style:{color:"#999"}},"No step results yet"),r().createElement("h4",{style:{marginTop:16}},"Final Result"),r().createElement("pre",{style:{background:"#f0f5ff",padding:12,borderRadius:6,fontSize:12,maxHeight:300,overflow:"auto"}},S.finalResult?JSON.stringify(S.finalResult,null,2):"(not yet available)"),S.externalTaskIds&&Object.keys(S.externalTaskIds).length>0&&r().createElement(r().Fragment,null,r().createElement("h4",{style:{marginTop:16}},"External Task IDs"),r().createElement("pre",{style:{background:"#f5f5f5",padding:8,borderRadius:4,fontSize:11}},JSON.stringify(S.externalTaskIds,null,2))))))},H=function(){return r().createElement("div",{style:{backgroundColor:"var(--nb-box-bg)",minHeight:"100vh"}},r().createElement("div",{style:{padding:"16px 24px",backgroundColor:"#fff",borderBottom:"1px solid #f0f0f0"}},r().createElement("h2",{style:{margin:0,fontSize:20,fontWeight:500}},"Document Understanding - Pipeline Orchestrator")),r().createElement("div",{style:{padding:"0 24px 24px"}},r().createElement(l.Tabs,{defaultActiveKey:"config",items:[{key:"config",label:"Service Config",children:r().createElement(p,null)},{key:"endpoints",label:"Endpoints",children:r().createElement(w,null)},{key:"pipelines",label:"Pipelines",children:r().createElement(q,null)},{key:"jobs",label:"Jobs history",children:r().createElement(J,null)}]})))};function W(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function L(e,t,n){return(L=Y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var l=new(Function.bind.apply(e,r));return n&&K(l,n.prototype),l}).apply(null,arguments)}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t="function"==typeof Map?new Map:void 0;return(G=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,n)}function n(){return L(e,arguments,$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),K(n,e)})(e)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}var X=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=$(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,Y()?Reflect.construct(e,t||[],$(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&K(r,e),n=[{key:"load",value:function(){var e,n=this;return(e=function(){var e;return function(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(r){return null==(e=n.flowEngine)||e.registerModels(t),n.app.pluginSettingsManager.add("@nocobase/plugin-document-understanding",{title:n.t("Document Understanding"),icon:"FileSearchOutlined",Component:H,aclSnippet:"pm.@nocobase/plugin-document-understanding"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){W(a,r,l,o,i,"next",e)}function i(e){W(a,r,l,o,i,"throw",e)}o(void 0)})})()}}],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)}}(r.prototype,n),r}(G(e.Plugin))}(),i}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("plugin-document-understanding",["react","@nocobase/client","@ant-design/icons","antd"],t):"object"==typeof exports?exports["plugin-document-understanding"]=t(require("react"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):e["plugin-document-understanding"]=t(e.react,e["@nocobase/client"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,r){return function(){"use strict";var l={482:function(e){e.exports=n},772:function(e){e.exports=t},721:function(e){e.exports=r},156:function(t){t.exports=e}},a={};function o(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return l[e](n,n.exports,o),n.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return!function(){o.r(i),o.d(i,{default:function(){return X}});var e=o(772),t={},n=o(156),r=o.n(n),l=o(721),a=o(482);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=function(){var t,o,i=s(l.Form.useForm(),1)[0],u=(0,e.useAPIClient)(),p=s((0,n.useState)(!0),2),d=p[0],m=p[1],f=s((0,n.useState)(!1),2),y=f[0],h=f[1];(0,n.useEffect)(function(){u.request({url:"docUnderstanding:getConfig"}).then(function(e){var t=e.data;i.setFieldsValue((null==t?void 0:t.data)||{}),m(!1)}).catch(function(){return m(!1)})},[]);var b=(t=function(e){return function(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:h(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,u.request({url:"docUnderstanding:updateConfig",method:"POST",data:e})];case 2:return t.sent(),l.message.success("Configuration saved successfully"),[3,5];case 3:return t.sent(),l.message.error("Failed to save config"),[3,5];case 4:return h(!1),[7];case 5:return[2]}})},o=function(){var e=this,n=arguments;return new Promise(function(r,l){var a=t.apply(e,n);function o(e){c(a,r,l,o,i,"next",e)}function i(e){c(a,r,l,o,i,"throw",e)}o(void 0)})},function(e){return o.apply(this,arguments)});return d?r().createElement(l.Spin,{style:{marginTop:40}}):r().createElement(l.Form,{form:i,layout:"vertical",onFinish:b,style:{maxWidth:600}},r().createElement(l.Alert,{message:"Service Connection",description:"Configure the connection to your external document processing service. All endpoints will use this base URL and authentication.",type:"info",showIcon:!0,style:{marginBottom:24}}),r().createElement(l.Form.Item,{name:"baseUrl",label:"Base URL",rules:[{required:!0,message:"Base URL is required"}],help:"The root URL of your document processing API"},r().createElement(l.Input,{prefix:r().createElement(a.LinkOutlined,null),placeholder:"http://my-ocr-service:8000"})),r().createElement(l.Form.Item,{name:"authType",label:"Authentication Type",initialValue:"none"},r().createElement(l.Select,null,r().createElement(l.Select.Option,{value:"none"},"None"),r().createElement(l.Select.Option,{value:"api_key"},"API Key"),r().createElement(l.Select.Option,{value:"bearer"},"Bearer Token"),r().createElement(l.Select.Option,{value:"custom_header"},"Custom Header"))),r().createElement(l.Form.Item,{noStyle:!0,dependencies:["authType"]},function(){var e=i.getFieldValue("authType");return"none"===e?null:r().createElement(r().Fragment,null,"custom_header"===e&&r().createElement(l.Form.Item,{name:"authHeaderName",label:"Custom Header Name",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"X-Api-Key"})),r().createElement(l.Form.Item,{name:"authKey",label:"bearer"===e?"Bearer Token":"API Key",rules:[{required:!0}]},r().createElement(l.Input.Password,{placeholder:"Enter key or token"})))}),r().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"}},r().createElement(l.Form.Item,{name:"defaultTimeout",label:"Request Timeout (ms)",initialValue:3e4},r().createElement(l.InputNumber,{style:{width:"100%"},min:1e3,step:1e3})),r().createElement(l.Form.Item,{name:"defaultRetries",label:"Default Retries",initialValue:2},r().createElement(l.InputNumber,{style:{width:"100%"},min:0,max:10})),r().createElement(l.Form.Item,{name:"pollInterval",label:"Poll Interval (ms)",initialValue:5e3},r().createElement(l.InputNumber,{style:{width:"100%"},min:1e3,step:1e3})),r().createElement(l.Form.Item,{name:"pollTimeout",label:"Poll Timeout (ms)",initialValue:3e5},r().createElement(l.InputNumber,{style:{width:"100%"},min:5e3,step:5e3}))),r().createElement(l.Form.Item,{name:"webhookSecret",label:"Webhook Secret",help:"Used to verify HMAC-SHA256 signatures on incoming webhook callbacks"},r().createElement(l.Input.Password,{placeholder:"Optional: secret for webhook signature verification"})),r().createElement(l.Form.Item,null,r().createElement(l.Button,{type:"primary",htmlType:"submit",icon:r().createElement(a.SaveOutlined,null),loading:y},"Save Configuration")))};function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){m(a,r,l,o,i,"next",e)}function i(e){m(a,r,l,o,i,"throw",e)}o(void 0)})}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||b(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}function g(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var E=l.Input.TextArea,v=function(e){var t=e.value,n=void 0===t?{}:t,o=e.onChange,i=Object.entries(n),u=function(e,t,n){var r=h(i);r[e]=[t,n],null==o||o(Object.fromEntries(r))},c=function(e){var t=h(i);t.splice(e,1),null==o||o(Object.fromEntries(t))};return r().createElement("div",null,i.map(function(e,t){var n=y(e,2),o=n[0],i=n[1];return r().createElement(l.Space,{key:t,style:{display:"flex",marginBottom:4}},r().createElement(l.Input,{placeholder:"Header name",value:o,onChange:function(e){return u(t,e.target.value,i)},style:{width:180}}),r().createElement(l.Input,{placeholder:"Value",value:i,onChange:function(e){return u(t,o,e.target.value)},style:{width:220}}),r().createElement(l.Button,{size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null),onClick:function(){return c(t)}}))}),r().createElement(l.Button,{size:"small",type:"dashed",icon:r().createElement(a.PlusOutlined,null),onClick:function(){var e,t;return null==o?void 0:o((e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},n),t=t={"":""},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))}},"Add Header"))},S=function(e){var t=e.value,l=e.onChange,a=e.placeholder,o=y((0,n.useState)(""),2),i=o[0],u=o[1],c=y((0,n.useState)(""),2),s=c[0],p=c[1];return(0,n.useEffect)(function(){if(!t)return void u("");try{u("string"==typeof t?JSON.stringify(JSON.parse(t),null,2):JSON.stringify(t,null,2))}catch(e){u("string"==typeof t?t:"")}},[t]),r().createElement("div",null,r().createElement(E,{rows:6,value:i,onChange:function(e){return u(e.target.value)},onBlur:function(){if(!i.trim()){p(""),null==l||l(null);return}try{var e=JSON.parse(i);p(""),null==l||l(e)}catch(e){p("Invalid JSON")}},placeholder:a||"{}",style:{fontFamily:"monospace",fontSize:12}}),s&&r().createElement("div",{style:{color:"#ff4d4f",fontSize:12}},s))},w=function(){var t,o,i,u=(0,e.useAPIClient)(),c=y((0,n.useState)([]),2),s=c[0],p=c[1],d=y((0,n.useState)(!1),2),m=d[0],h=d[1],b=y((0,n.useState)(!1),2),w=b[0],O=b[1],I=y(l.Form.useForm(),1)[0],k=y((0,n.useState)(null),2),T=k[0],x=k[1],P=(t=f(function(){var e;return g(this,function(t){switch(t.label){case 0:h(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,u.request({url:"docUnderstanding:listEndpoints"})];case 2:return p((null==(e=t.sent().data)?void 0:e.data)||[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})}),function(){return t.apply(this,arguments)});(0,n.useEffect)(function(){P()},[]);var C=function(e){x(e.id),I.setFieldsValue(e),O(!0)},F=(o=f(function(e){return g(this,function(t){switch(t.label){case 0:return[4,u.request({url:"docUnderstanding:deleteEndpoint",method:"POST",params:{filterByTk:e}})];case 1:return t.sent(),l.message.success("Deleted"),P(),[2]}})}),function(e){return o.apply(this,arguments)}),A=(i=f(function(){var e;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),[4,I.validateFields()];case 1:if(e=t.sent(),!T)return[3,3];return[4,u.request({url:"docUnderstanding:updateEndpoint",method:"POST",params:{filterByTk:T},data:e})];case 2:return t.sent(),[3,5];case 3:return[4,u.request({url:"docUnderstanding:createEndpoint",method:"POST",data:e})];case 4:t.sent(),t.label=5;case 5:return l.message.success("Saved"),O(!1),P(),[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}})}),function(){return i.apply(this,arguments)}),j=[{title:"Name",dataIndex:"name",width:150},{title:"Subpath",dataIndex:"subpath",width:200},{title:"Method",dataIndex:"method",width:80,render:function(e){return r().createElement(l.Tag,null,e)}},{title:"Execution",dataIndex:"executionMode",width:100,render:function(e){return r().createElement(l.Tag,{color:{sync:"green",polling:"blue",webhook:"purple"}[e]},e)}},{title:"File",dataIndex:"fileInputMode",width:90,render:function(e){return"none"===e?"-":e}},{title:"Enabled",dataIndex:"enabled",width:70,render:function(e){return e?r().createElement(l.Tag,{color:"success"},"Yes"):r().createElement(l.Tag,null,"No")}},{title:"Action",width:120,render:function(e,t){return r().createElement(l.Space,null,r().createElement(l.Button,{type:"link",size:"small",icon:r().createElement(a.EditOutlined,null),onClick:function(){return C(t)}},"Edit"),r().createElement(l.Popconfirm,{title:"Delete this endpoint?",onConfirm:function(){return F(t.id)}},r().createElement(l.Button,{type:"link",size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null)},"Delete")))}}];return r().createElement("div",null,r().createElement("div",{style:{marginBottom:16}},r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),onClick:function(){x(null),I.resetFields(),O(!0)}},"Add Endpoint")),r().createElement(l.Table,{rowKey:"id",columns:j,dataSource:s,loading:m,size:"small"}),r().createElement(l.Modal,{title:T?"Edit Endpoint":"Add Endpoint",open:w,onOk:A,onCancel:function(){return O(!1)},width:680,destroyOnClose:!0},r().createElement(l.Form,{form:I,layout:"vertical",preserve:!1},r().createElement(l.Tabs,{size:"small",items:[{key:"basic",label:"Basic",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"name",label:"Unique Name",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"ocr, classify, extract..."})),r().createElement(l.Form.Item,{name:"subpath",label:"Subpath",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"/api/v1/ocr"})),r().createElement(l.Form.Item,{name:"description",label:"Description"},r().createElement(E,{rows:2,placeholder:"What this endpoint does"})),r().createElement(l.Space,{size:"large"},r().createElement(l.Form.Item,{name:"method",label:"HTTP Method",initialValue:"POST"},r().createElement(l.Select,{style:{width:120}},r().createElement(l.Select.Option,{value:"GET"},"GET"),r().createElement(l.Select.Option,{value:"POST"},"POST"),r().createElement(l.Select.Option,{value:"PUT"},"PUT"))),r().createElement(l.Form.Item,{name:"enabled",label:"Enabled",valuePropName:"checked",initialValue:!0},r().createElement(l.Switch,null))))},{key:"file",label:"File Input",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"fileInputMode",label:"File Input Mode",initialValue:"none"},r().createElement(l.Select,{style:{width:200}},r().createElement(l.Select.Option,{value:"none"},"None"),r().createElement(l.Select.Option,{value:"multipart"},"Multipart Upload"),r().createElement(l.Select.Option,{value:"base64"},"Base64 in JSON"))),r().createElement(l.Form.Item,{noStyle:!0,dependencies:["fileInputMode"]},function(){return"none"!==I.getFieldValue("fileInputMode")?r().createElement(l.Form.Item,{name:"maxFiles",label:"Max Files",initialValue:1},r().createElement(l.InputNumber,{min:1,max:20,style:{width:120}})):null}))},{key:"async",label:"Async Config",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"executionMode",label:"Execution Mode",initialValue:"sync"},r().createElement(l.Select,{style:{width:200}},r().createElement(l.Select.Option,{value:"sync"},"Synchronous"),r().createElement(l.Select.Option,{value:"polling"},"Polling"),r().createElement(l.Select.Option,{value:"webhook"},"Webhook"))),r().createElement(l.Form.Item,{noStyle:!0,dependencies:["executionMode"]},function(){var e=I.getFieldValue("executionMode");return"sync"===e?null:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"pollTaskIdField",label:"Task ID Field",help:"Field in response containing the async task ID",initialValue:"task_id"},r().createElement(l.Input,{placeholder:"task_id"})),"polling"===e&&r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"pollResultSubpath",label:"Poll Result Subpath",help:"URL to poll for result. Use {taskId} as placeholder.",rules:[{required:!0,message:"Required for polling mode"}]},r().createElement(l.Input,{placeholder:"/api/v1/tasks/{taskId}/result"})),r().createElement(l.Form.Item,{name:"pollResultField",label:"Result Field",help:"Field in poll response containing the actual result"},r().createElement(l.Input,{placeholder:"result"})),r().createElement(l.Form.Item,{name:"pollStatusField",label:"Status Field (optional)",help:"Field to check completion status. If empty, any non-null result = complete."},r().createElement(l.Input,{placeholder:"status"})),r().createElement(l.Form.Item,{name:"pollCompletedValue",label:"Completed Value",help:"Value of status field that means 'done'",initialValue:"completed"},r().createElement(l.Input,{placeholder:"completed"})),r().createElement(l.Space,{size:"large"},r().createElement(l.Form.Item,{name:"pollInterval",label:"Poll Interval (ms)",help:"Override default"},r().createElement(l.InputNumber,{min:1e3,step:1e3,placeholder:"5000",style:{width:150}})),r().createElement(l.Form.Item,{name:"pollTimeout",label:"Poll Timeout (ms)",help:"Override default"},r().createElement(l.InputNumber,{min:5e3,step:5e3,placeholder:"300000",style:{width:150}})))))}))},{key:"schema",label:"Schema",children:r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"requestBodySchema",label:"Request Body Schema (JSON Schema)"},r().createElement(S,{placeholder:'{ "type": "object", "properties": { ... } }'})),r().createElement(l.Form.Item,{name:"responseSchema",label:"Response Schema (JSON Schema)"},r().createElement(S,{placeholder:'{ "type": "object", "properties": { ... } }'})))},{key:"headers",label:"Custom Headers",children:r().createElement(l.Form.Item,{name:"customHeaders",label:"Additional Headers"},r().createElement(v,null))}]}))))};function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function I(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function k(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){I(a,r,l,o,i,"next",e)}function i(e){I(a,r,l,o,i,"throw",e)}o(void 0)})}}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function x(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||F(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||F(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}}function A(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var j=l.Input.TextArea,B=l.Collapse.Panel,M=function(e){var t=e.value,l=e.onChange,a=e.placeholder,o=e.rows,i=P((0,n.useState)(""),2),u=i[0],c=i[1],s=P((0,n.useState)(""),2),p=s[0],d=s[1];return(0,n.useEffect)(function(){if(!t)return void c("");try{c("string"==typeof t?JSON.stringify(JSON.parse(t),null,2):JSON.stringify(t,null,2))}catch(e){c("string"==typeof t?t:"")}},[t]),r().createElement("div",null,r().createElement(j,{rows:void 0===o?5:o,value:u,onChange:function(e){return c(e.target.value)},onBlur:function(){if(!u.trim()){d(""),null==l||l(null);return}try{var e=JSON.parse(u);d(""),null==l||l(e)}catch(e){d("Invalid JSON")}},placeholder:a||"{}",style:{fontFamily:"monospace",fontSize:12}}),p&&r().createElement("div",{style:{color:"#ff4d4f",fontSize:12}},p))},N=function(e){var t=e.steps,n=e.endpoints,o=e.onChange,i=function(e,n){var r,l=C(t),a=e+n;a<0||a>=l.length||(r=[l[a],l[e]],l[e]=r[0],l[a]=r[1],l.forEach(function(e,t){return e.stepOrder=t+1}),o(l))},u=function(e,n,r){var l=C(t);l[e][n]=r,o(l)},c=function(e){var n=t.filter(function(t,n){return n!==e});n.forEach(function(e,t){return e.stepOrder=t+1}),o(n)},s=function(){var e;o(C(t).concat([(e=t.length+1,{_key:"new_".concat(Date.now(),"_").concat(Math.random()),stepOrder:e,name:"",endpointId:null,inputMapping:null,outputAlias:"",condition:null,onError:"fail",retryCount:0})]))};return 0===t.length?r().createElement("div",{style:{textAlign:"center",padding:"20px 0"}},r().createElement(l.Empty,{description:"No steps yet",imageStyle:{height:40}}),r().createElement(l.Button,{type:"dashed",icon:r().createElement(a.PlusOutlined,null),onClick:s,style:{marginTop:8}},"Add First Step")):r().createElement("div",null,r().createElement(l.Collapse,{size:"small",defaultActiveKey:t.map(function(e){return e._key})},t.map(function(e,o){var s=n.find(function(t){return t.id===e.endpointId}),p=r().createElement(l.Space,{size:4,onClick:function(e){return e.stopPropagation()}},r().createElement(l.Button,{size:"small",disabled:0===o,icon:r().createElement(a.ArrowUpOutlined,null),onClick:function(){return i(o,-1)}}),r().createElement(l.Button,{size:"small",disabled:o===t.length-1,icon:r().createElement(a.ArrowDownOutlined,null),onClick:function(){return i(o,1)}}),r().createElement(l.Popconfirm,{title:"Remove step?",onConfirm:function(){return c(o)}},r().createElement(l.Button,{size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null)}))),d=r().createElement(l.Space,null,r().createElement(l.Badge,{count:e.stepOrder,style:{backgroundColor:"#1677ff"}}),r().createElement("span",null,e.name||"(unnamed)"),s&&r().createElement(l.Tag,null,s.name),"skip"===e.onError&&r().createElement(l.Tooltip,{title:"Step can be skipped on error"},r().createElement(l.Tag,{color:"orange"},"skip on error")),e.condition&&r().createElement(l.Tooltip,{title:"Has condition"},r().createElement(l.Tag,{color:"purple"},"conditional")));return r().createElement(B,{key:e._key,header:d,extra:p},r().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"}},r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Step Name *"),r().createElement(l.Input,{value:e.name,onChange:function(e){return u(o,"name",e.target.value)},placeholder:"OCR, Classify, Extract..."})),r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Endpoint *"),r().createElement(l.Select,{value:e.endpointId,onChange:function(e){return u(o,"endpointId",e)},placeholder:"Select endpoint",style:{width:"100%"},options:n.map(function(e){return{value:e.id,label:"".concat(e.name," (").concat(e.method," ").concat(e.subpath,")")}})})),r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4,marginTop:12}},"Output Alias"),r().createElement(l.Input,{value:e.outputAlias,onChange:function(e){return u(o,"outputAlias",e.target.value)},placeholder:"ocr_result"}),r().createElement("div",{style:{color:"#888",fontSize:11}},"Other steps reference this as: $step[",e.outputAlias||e.stepOrder,"].response.field")),r().createElement("div",null,r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4,marginTop:12}},"On Error"),r().createElement(l.Space,null,r().createElement(l.Select,{value:e.onError,onChange:function(e){return u(o,"onError",e)},style:{width:120}},r().createElement(l.Select.Option,{value:"fail"},"Fail"),r().createElement(l.Select.Option,{value:"skip"},"Skip"),r().createElement(l.Select.Option,{value:"retry"},"Retry")),"retry"===e.onError&&r().createElement(l.InputNumber,{value:e.retryCount,onChange:function(e){return u(o,"retryCount",e||0)},min:1,max:10,addonBefore:"x",style:{width:100}})))),r().createElement("div",{style:{marginTop:12}},r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Input Mapping (JSON)",r().createElement(l.Tooltip,{title:"Map endpoint input fields. Use $input.field, $step[alias].response.field, $files, or literal values."},r().createElement("span",{style:{fontWeight:"normal",color:"#888",marginLeft:6,cursor:"help"}},"?"))),r().createElement(M,{value:e.inputMapping,onChange:function(e){return u(o,"inputMapping",e)},placeholder:'{ "text": "$step[ocr_result].response.text", "lang": "vi" }',rows:3})),r().createElement("div",{style:{marginTop:12}},r().createElement("label",{style:{fontWeight:500,display:"block",marginBottom:4}},"Condition (optional JSON)",r().createElement(l.Tooltip,{title:'Only run this step if condition matches. Format: { "field": "$step[x].response.y", "op": "eq", "value": "..." }'},r().createElement("span",{style:{fontWeight:"normal",color:"#888",marginLeft:6,cursor:"help"}},"?"))),r().createElement(M,{value:e.condition,onChange:function(e){return u(o,"condition",e)},placeholder:'{ "field": "$step[classify].response.type", "op": "eq", "value": "invoice" }',rows:2})))})),r().createElement(l.Button,{type:"dashed",icon:r().createElement(a.PlusOutlined,null),onClick:s,style:{marginTop:8,width:"100%"}},"Add Step"))},q=function(){var t,o,i=(0,e.useAPIClient)(),u=P((0,n.useState)([]),2),c=u[0],s=u[1],p=P((0,n.useState)([]),2),d=p[0],m=p[1],f=P((0,n.useState)(!1),2),y=f[0],h=f[1],b=P((0,n.useState)(!1),2),g=b[0],E=b[1],v=P(l.Form.useForm(),1)[0],S=P((0,n.useState)(null),2),w=S[0],O=S[1],I=P((0,n.useState)([]),2),F=I[0],q=I[1],R=(0,n.useCallback)(k(function(){var e,t,n,r,l;return A(this,function(a){switch(a.label){case 0:h(!0),a.label=1;case 1:return a.trys.push([1,,3,4]),[4,Promise.all([i.request({url:"docUnderstanding:listPipelines"}),i.request({url:"docUnderstanding:listEndpoints"})])];case 2:return r=(n=P.apply(void 0,[a.sent(),2]))[0],l=n[1],s((null==(e=r.data)?void 0:e.data)||[]),m((null==(t=l.data)?void 0:t.data)||[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})}),[i]);(0,n.useEffect)(function(){R()},[R]);var D=function(e){O(e.id),v.setFieldsValue({name:e.name,description:e.description,enabled:e.enabled,inputSchema:e.inputSchema,outputMapping:e.outputMapping}),q(C(e.steps||[]).sort(function(e,t){return e.stepOrder-t.stepOrder}).map(function(e){return{_key:"srv_".concat(e.id),id:e.id,stepOrder:e.stepOrder,name:e.name,endpointId:e.endpointId,inputMapping:e.inputMapping,outputAlias:e.outputAlias||"",condition:e.condition,onError:e.onError||"fail",retryCount:e.retryCount||0}})),E(!0)},U=(t=k(function(e){return A(this,function(t){switch(t.label){case 0:return[4,i.request({url:"docUnderstanding:deletePipeline",method:"POST",params:{filterByTk:e}})];case 1:return t.sent(),l.message.success("Deleted"),R(),[2]}})}),function(e){return t.apply(this,arguments)}),z=(o=k(function(){var e,t,n,r,a,o,u,c,s;return A(this,function(p){switch(p.label){case 0:return p.trys.push([0,6,,7]),[4,v.validateFields()];case 1:e=p.sent(),t=!0,n=!1,r=void 0;try{for(a=F[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){if(!(u=o.value).name)return l.message.error("All steps must have a name"),[2];if(!u.endpointId)return l.message.error('Step "'.concat(u.name||u.stepOrder,'" must have an endpoint')),[2]}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}if(new Set(c=F.map(function(e){return e.outputAlias}).filter(Boolean)).size!==c.length)return l.message.error("Step output aliases must be unique"),[2];if(s=x(T({},e),{steps:F.map(function(e){return x(T({},e.id?{id:e.id}:{}),{stepOrder:e.stepOrder,name:e.name,endpointId:e.endpointId,inputMapping:e.inputMapping,outputAlias:e.outputAlias||void 0,condition:e.condition,onError:e.onError,retryCount:"retry"===e.onError?e.retryCount:0})})}),!w)return[3,3];return[4,i.request({url:"docUnderstanding:updatePipeline",method:"POST",params:{filterByTk:w},data:s})];case 2:return p.sent(),[3,5];case 3:return[4,i.request({url:"docUnderstanding:createPipeline",method:"POST",data:s})];case 4:p.sent(),p.label=5;case 5:return l.message.success("Saved"),E(!1),R(),[3,7];case 6:return p.sent(),[3,7];case 7:return[2]}})}),function(){return o.apply(this,arguments)}),_=[{title:"Name",dataIndex:"name",width:200},{title:"Steps",dataIndex:"steps",width:300,render:function(e){if(!e||0===e.length)return r().createElement(l.Tag,null,"0 steps");var t=C(e).sort(function(e,t){return e.stepOrder-t.stepOrder});return r().createElement(l.Space,{size:2,wrap:!0},t.map(function(e,t){return r().createElement(r().Fragment,{key:e.id},t>0&&r().createElement("span",{style:{color:"#ccc"}},"→"),r().createElement(l.Tag,null,e.name||"Step ".concat(e.stepOrder)))}))}},{title:"Enabled",dataIndex:"enabled",width:80,render:function(e){return e?r().createElement(l.Tag,{color:"success"},"Yes"):r().createElement(l.Tag,null,"No")}},{title:"AI Tool",width:100,render:function(e,t){var n;return t.enabled?r().createElement(l.Tooltip,{title:"Registered as: doc_understanding.".concat(null==(n=t.name)?void 0:n.toLowerCase().replace(/[^a-z0-9_]/g,"_"))},r().createElement(l.Tag,{color:"blue",icon:r().createElement(a.ThunderboltOutlined,null)},"Active")):r().createElement(l.Tag,null,"Inactive")}},{title:"Action",width:120,render:function(e,t){return r().createElement(l.Space,null,r().createElement(l.Button,{type:"link",size:"small",icon:r().createElement(a.EditOutlined,null),onClick:function(){return D(t)}},"Edit"),r().createElement(l.Popconfirm,{title:"Delete this pipeline?",onConfirm:function(){return U(t.id)}},r().createElement(l.Button,{type:"link",size:"small",danger:!0,icon:r().createElement(a.DeleteOutlined,null)},"Delete")))}}];return r().createElement("div",null,r().createElement("div",{style:{marginBottom:16}},r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),onClick:function(){O(null),v.resetFields(),q([]),E(!0)}},"Add Pipeline")),r().createElement(l.Table,{rowKey:"id",columns:_,dataSource:c,loading:y,size:"small"}),r().createElement(l.Modal,{title:w?"Edit Pipeline":"New Pipeline",open:g,onOk:z,onCancel:function(){return E(!1)},width:800,destroyOnClose:!0},r().createElement(l.Form,{form:v,layout:"vertical",preserve:!1},r().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"}},r().createElement(l.Form.Item,{name:"name",label:"Pipeline Name",rules:[{required:!0}]},r().createElement(l.Input,{placeholder:"full_document_processing"})),r().createElement(l.Form.Item,{name:"enabled",label:"Enabled",valuePropName:"checked",initialValue:!0},r().createElement(l.Switch,null))),r().createElement(l.Form.Item,{name:"description",label:"Description"},r().createElement(j,{rows:2,placeholder:"What this pipeline does"})),r().createElement(l.Card,{title:"Pipeline Steps",size:"small",style:{marginBottom:16},extra:r().createElement(l.Tag,{color:"blue"},F.length," step(s)")},r().createElement(N,{steps:F,endpoints:d,onChange:q})),r().createElement(l.Collapse,{size:"small",ghost:!0},r().createElement(B,{header:"Advanced: Input Schema & Output Mapping",key:"advanced"},r().createElement(l.Form.Item,{name:"inputSchema",label:"Input Schema (JSON Schema)",help:"Defines what input this pipeline accepts. Used by AI tool schema."},r().createElement(M,{placeholder:'{ "type": "object", "properties": { "document_url": { "type": "string" } }, "required": ["document_url"] }'})),r().createElement(l.Form.Item,{name:"outputMapping",label:"Output Mapping (JSON)",help:"Map final step results to pipeline output. If empty, all step results are returned."},r().createElement(M,{placeholder:'{ "text": "$step[ocr_result].response.text", "category": "$step[classify].response.category" }'})))))))};function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function D(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function U(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){D(a,r,l,o,i,"next",e)}function i(e){D(a,r,l,o,i,"throw",e)}o(void 0)})}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var J={pending:{color:"default",label:"Pending"},running:{color:"processing",label:"Running"},polling:{color:"processing",label:"Polling"},completed:{color:"success",label:"Completed"},failed:{color:"error",label:"Failed"},timeout:{color:"error",label:"Timeout"}},V=function(){var t,o,i=(0,e.useAPIClient)(),u=z((0,n.useState)([]),2),c=u[0],s=u[1],p=z((0,n.useState)([]),2),d=p[0],m=p[1],f=z((0,n.useState)(!1),2),y=f[0],h=f[1],b=z((0,n.useState)(!1),2),g=b[0],E=b[1],v=z((0,n.useState)(null),2),S=v[0],w=v[1],O=z((0,n.useState)(void 0),2),I=O[0],k=O[1],T=z((0,n.useState)(void 0),2),x=T[0],P=T[1],C=(0,n.useCallback)(U(function(){var e,t;return _(this,function(n){switch(n.label){case 0:h(!0),n.label=1;case 1:return n.trys.push([1,,3,4]),t={},I&&(t.status=I),x&&(t.pipelineId=x),[4,i.request({url:"docUnderstanding:listJobs",params:{filter:Object.keys(t).length>0?t:void 0}})];case 2:return s((null==(e=n.sent().data)?void 0:e.data)||[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})}),[i,I,x]),F=(0,n.useCallback)(U(function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,i.request({url:"docUnderstanding:listPipelines"})];case 1:return m((null==(e=t.sent().data)?void 0:e.data)||[]),[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}})}),[i]);(0,n.useEffect)(function(){F()},[F]),(0,n.useEffect)(function(){C();var e=setInterval(C,1e4);return function(){return clearInterval(e)}},[C]);var A=new Map(d.map(function(e){return[e.id,e.name]})),j=(t=U(function(e){var t;return _(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,i.request({url:"docUnderstanding:getJobStatus",params:{filterByTk:e.id}})];case 1:return w((null==(t=n.sent().data)?void 0:t.data)||e),[3,3];case 2:return n.sent(),w(e),[3,3];case 3:return E(!0),[2]}})}),function(e){return t.apply(this,arguments)}),B=[{title:"ID",dataIndex:"id",width:60},{title:"Pipeline",dataIndex:"pipelineId",width:180,render:function(e){return A.get(e)||"#".concat(e)}},{title:"Status",dataIndex:"status",width:100,render:function(e){var t=J[e]||{color:"default",label:e};return r().createElement(l.Tag,{color:t.color},t.label)}},{title:"Current Step",dataIndex:"currentStep",width:90,render:function(e,t){return"completed"===t.status?r().createElement(l.Tag,{color:"success"},"Done"):"failed"===t.status?r().createElement(l.Tag,{color:"error"},"Step ",e):r().createElement(l.Badge,{status:"processing",text:"Step ".concat(e)})}},{title:"Started",dataIndex:"startedAt",width:160,render:function(e){return e?new Date(e).toLocaleString():"-"}},{title:"Completed",dataIndex:"completedAt",width:160,render:function(e){return e?new Date(e).toLocaleString():"-"}},{title:"Action",width:80,render:function(e,t){return r().createElement(l.Button,{size:"small",icon:r().createElement(a.EyeOutlined,null),onClick:function(){return j(t)}},"View")}}];return r().createElement("div",null,r().createElement(l.Space,{style:{marginBottom:16},wrap:!0},r().createElement(l.Select,{allowClear:!0,placeholder:"Filter by status",value:I,onChange:k,style:{width:160},options:Object.entries(J).map(function(e){var t=z(e,2);return{value:t[0],label:t[1].label}})}),r().createElement(l.Select,{allowClear:!0,placeholder:"Filter by pipeline",value:x,onChange:P,style:{width:200},options:d.map(function(e){return{value:e.id,label:e.name}})}),r().createElement(l.Button,{icon:r().createElement(a.ReloadOutlined,null),onClick:C},"Refresh")),r().createElement(l.Table,{rowKey:"id",columns:B,dataSource:c,loading:y,size:"small",pagination:{pageSize:20}}),r().createElement(l.Drawer,{title:S?"Job #".concat(S.id," — ").concat(A.get(S.pipelineId)||"Unknown"):"Job Details",width:640,open:g,onClose:function(){return E(!1)}},S&&r().createElement("div",null,r().createElement("div",{style:{marginBottom:16}},r().createElement(l.Space,null,r().createElement(l.Tag,{color:null==(o=J[S.status])?void 0:o.color},S.status),S.startedAt&&r().createElement("span",null,"Started: ",new Date(S.startedAt).toLocaleString()),S.completedAt&&r().createElement("span",null,"Completed: ",new Date(S.completedAt).toLocaleString()))),S.error&&r().createElement("div",{style:{background:"#fff2f0",border:"1px solid #ffccc7",borderRadius:6,padding:12,marginBottom:16}},r().createElement("strong",{style:{color:"#cf1322"}},"Error:"),r().createElement("pre",{style:{margin:"4px 0 0",whiteSpace:"pre-wrap",color:"#cf1322"}},S.error)),r().createElement("h4",null,"Input"),r().createElement("pre",{style:{background:"#f5f5f5",padding:12,borderRadius:6,fontSize:12,maxHeight:200,overflow:"auto"}},JSON.stringify(S.input,null,2)),r().createElement("h4",{style:{marginTop:16}},"Step Results"),S.stepResults&&Object.keys(S.stepResults).length>0?Object.entries(S.stepResults).map(function(e){var t=z(e,2),n=t[0],a=t[1];return r().createElement("div",{key:n,style:{marginBottom:8}},r().createElement(l.Tag,{color:"blue"},n),r().createElement("pre",{style:{background:"#f5f5f5",padding:8,borderRadius:4,fontSize:11,maxHeight:150,overflow:"auto",marginTop:4}},JSON.stringify(a,null,2)))}):r().createElement("div",{style:{color:"#999"}},"No step results yet"),r().createElement("h4",{style:{marginTop:16}},"Final Result"),r().createElement("pre",{style:{background:"#f0f5ff",padding:12,borderRadius:6,fontSize:12,maxHeight:300,overflow:"auto"}},S.finalResult?JSON.stringify(S.finalResult,null,2):"(not yet available)"),S.externalTaskIds&&Object.keys(S.externalTaskIds).length>0&&r().createElement(r().Fragment,null,r().createElement("h4",{style:{marginTop:16}},"External Task IDs"),r().createElement("pre",{style:{background:"#f5f5f5",padding:8,borderRadius:4,fontSize:11}},JSON.stringify(S.externalTaskIds,null,2))))))},H=function(){return r().createElement("div",{style:{backgroundColor:"var(--nb-box-bg)",minHeight:"100vh"}},r().createElement("div",{style:{padding:"16px 24px",backgroundColor:"#fff",borderBottom:"1px solid #f0f0f0"}},r().createElement("h2",{style:{margin:0,fontSize:20,fontWeight:500}},"Document Understanding - Pipeline Orchestrator")),r().createElement("div",{style:{padding:"0 24px 24px"}},r().createElement(l.Tabs,{defaultActiveKey:"config",items:[{key:"config",label:"Service Config",children:r().createElement(p,null)},{key:"endpoints",label:"Endpoints",children:r().createElement(w,null)},{key:"pipelines",label:"Pipelines",children:r().createElement(q,null)},{key:"jobs",label:"Jobs history",children:r().createElement(V,null)}]})))};function W(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function L(e,t,n){return(L=Y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var l=new(Function.bind.apply(e,r));return n&&K(l,n.prototype),l}).apply(null,arguments)}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t="function"==typeof Map?new Map:void 0;return(G=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,n)}function n(){return L(e,arguments,$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),K(n,e)})(e)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}var X=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=$(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,Y()?Reflect.construct(e,t||[],$(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&K(r,e),n=[{key:"load",value:function(){var e,n=this;return(e=function(){var e;return function(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(r){return null==(e=n.flowEngine)||e.registerModels(t),n.app.pluginSettingsManager.add("document-understanding",{title:n.t("Document Understanding"),icon:"FileSearchOutlined",Component:H,aclSnippet:"pm.document-understanding"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){W(a,r,l,o,i,"next",e)}function i(e){W(a,r,l,o,i,"throw",e)}o(void 0)})})()}}],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)}}(r.prototype,n),r}(G(e.Plugin))}(),i}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/flow-engine": "2.0.
|
|
12
|
-
"@nocobase/client": "2.0.
|
|
13
|
-
"@nocobase/actions": "2.0.
|
|
14
|
-
"@nocobase/server": "2.0.
|
|
11
|
+
"@nocobase/flow-engine": "2.0.38",
|
|
12
|
+
"@nocobase/client": "2.0.38",
|
|
13
|
+
"@nocobase/actions": "2.0.38",
|
|
14
|
+
"@nocobase/server": "2.0.38",
|
|
15
15
|
"react": "18.2.0",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
|
-
"@nocobase/database": "2.0.
|
|
19
|
-
"axios": "1.
|
|
18
|
+
"@nocobase/database": "2.0.38",
|
|
19
|
+
"axios": "1.15.0"
|
|
20
20
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Document Understanding": "Document Understanding",
|
|
3
|
-
"Document Understanding - Pipeline Orchestrator": "Document Understanding - Pipeline Orchestrator",
|
|
4
|
-
"Service Connection": "Service Connection",
|
|
5
|
-
"Service Config": "Service Config",
|
|
6
|
-
"Endpoints": "Endpoints",
|
|
7
|
-
"Pipelines": "Pipelines",
|
|
8
|
-
"Jobs history": "Jobs history",
|
|
9
|
-
"Base URL": "Base URL",
|
|
10
|
-
"Authentication Type": "Authentication Type",
|
|
11
|
-
"Auth Type": "Auth Type",
|
|
12
|
-
"None": "None",
|
|
13
|
-
"API Key": "API Key",
|
|
14
|
-
"Bearer Token": "Bearer Token",
|
|
15
|
-
"Custom Header": "Custom Header",
|
|
16
|
-
"Custom Header Name": "Custom Header Name",
|
|
17
|
-
"API Key / Token": "API Key / Token",
|
|
18
|
-
"Request Timeout (ms)": "Request Timeout (ms)",
|
|
19
|
-
"Default Retries": "Default Retries",
|
|
20
|
-
"Poll Interval (ms)": "Poll Interval (ms)",
|
|
21
|
-
"Poll Timeout (ms)": "Poll Timeout (ms)",
|
|
22
|
-
"Webhook Secret": "Webhook Secret",
|
|
23
|
-
"Save Configuration": "Save Configuration",
|
|
24
|
-
"Configuration saved successfully": "Configuration saved successfully",
|
|
25
|
-
"Failed to save config": "Failed to save config",
|
|
26
|
-
"Add Endpoint": "Add Endpoint",
|
|
27
|
-
"Edit Endpoint": "Edit Endpoint",
|
|
28
|
-
"Basic": "Basic",
|
|
29
|
-
"File Input": "File Input",
|
|
30
|
-
"Async Config": "Async Config",
|
|
31
|
-
"Schema": "Schema",
|
|
32
|
-
"Custom Headers": "Custom Headers",
|
|
33
|
-
"Unique Name": "Unique Name",
|
|
34
|
-
"Subpath": "Subpath",
|
|
35
|
-
"HTTP Method": "HTTP Method",
|
|
36
|
-
"Execution Mode": "Execution Mode",
|
|
37
|
-
"Synchronous": "Synchronous",
|
|
38
|
-
"Polling": "Polling",
|
|
39
|
-
"Webhook": "Webhook",
|
|
40
|
-
"File Input Mode": "File Input Mode",
|
|
41
|
-
"Multipart Upload": "Multipart Upload",
|
|
42
|
-
"Base64 in JSON": "Base64 in JSON",
|
|
43
|
-
"Max Files": "Max Files",
|
|
44
|
-
"Task ID Field": "Task ID Field",
|
|
45
|
-
"Poll Result Subpath": "Poll Result Subpath",
|
|
46
|
-
"Result Field": "Result Field",
|
|
47
|
-
"Status Field": "Status Field",
|
|
48
|
-
"Completed Value": "Completed Value",
|
|
49
|
-
"Poll Task ID Field": "Poll Task ID Field",
|
|
50
|
-
"Poll Result Field": "Poll Result Field",
|
|
51
|
-
"Poll Status Field": "Poll Status Field",
|
|
52
|
-
"Poll Completed Value": "Poll Completed Value",
|
|
53
|
-
"Request Body Schema (JSON Schema)": "Request Body Schema (JSON Schema)",
|
|
54
|
-
"Response Schema (JSON Schema)": "Response Schema (JSON Schema)",
|
|
55
|
-
"Additional Headers": "Additional Headers",
|
|
56
|
-
"Add Header": "Add Header",
|
|
57
|
-
"Enabled": "Enabled",
|
|
58
|
-
"Action": "Action",
|
|
59
|
-
"Edit": "Edit",
|
|
60
|
-
"Delete": "Delete",
|
|
61
|
-
"Deleted": "Deleted",
|
|
62
|
-
"Saved": "Saved",
|
|
63
|
-
"Add Pipeline": "Add Pipeline",
|
|
64
|
-
"Edit Pipeline": "Edit Pipeline",
|
|
65
|
-
"New Pipeline": "New Pipeline",
|
|
66
|
-
"Pipeline Name": "Pipeline Name",
|
|
67
|
-
"Description": "Description",
|
|
68
|
-
"Pipeline Steps": "Pipeline Steps",
|
|
69
|
-
"Add Step": "Add Step",
|
|
70
|
-
"Add First Step": "Add First Step",
|
|
71
|
-
"No steps yet": "No steps yet",
|
|
72
|
-
"Step Name": "Step Name",
|
|
73
|
-
"Endpoint": "Endpoint",
|
|
74
|
-
"Output Alias": "Output Alias",
|
|
75
|
-
"On Error": "On Error",
|
|
76
|
-
"Fail": "Fail",
|
|
77
|
-
"Skip": "Skip",
|
|
78
|
-
"Retry": "Retry",
|
|
79
|
-
"Input Mapping (JSON)": "Input Mapping (JSON)",
|
|
80
|
-
"Condition (optional JSON)": "Condition (optional JSON)",
|
|
81
|
-
"Input Schema (JSON Schema)": "Input Schema (JSON Schema)",
|
|
82
|
-
"Output Mapping (JSON)": "Output Mapping (JSON)",
|
|
83
|
-
"Advanced: Input Schema & Output Mapping": "Advanced: Input Schema & Output Mapping",
|
|
84
|
-
"AI Tool": "AI Tool",
|
|
85
|
-
"Active": "Active",
|
|
86
|
-
"Inactive": "Inactive",
|
|
87
|
-
"Steps": "Steps",
|
|
88
|
-
"Job Details": "Job Details",
|
|
89
|
-
"Status": "Status",
|
|
90
|
-
"Current Step": "Current Step",
|
|
91
|
-
"Started": "Started",
|
|
92
|
-
"Completed": "Completed",
|
|
93
|
-
"Error": "Error",
|
|
94
|
-
"Input": "Input",
|
|
95
|
-
"Step Results": "Step Results",
|
|
96
|
-
"Final Result": "Final Result",
|
|
97
|
-
"External Task IDs": "External Task IDs",
|
|
98
|
-
"View": "View",
|
|
99
|
-
"Refresh": "Refresh",
|
|
100
|
-
"Filter by status": "Filter by status",
|
|
101
|
-
"Filter by pipeline": "Filter by pipeline",
|
|
102
|
-
"Pipeline": "Pipeline",
|
|
103
|
-
"ID": "ID",
|
|
104
|
-
"Name": "Name",
|
|
105
|
-
"Method": "Method",
|
|
106
|
-
"Execution": "Execution",
|
|
107
|
-
"File": "File",
|
|
108
|
-
"Done": "Done",
|
|
109
|
-
"Pending": "Pending",
|
|
110
|
-
"Running": "Running",
|
|
111
|
-
"Failed": "Failed",
|
|
112
|
-
"Timeout": "Timeout",
|
|
113
|
-
"All steps must have a name": "All steps must have a name",
|
|
114
|
-
"Step output aliases must be unique": "Step output aliases must be unique",
|
|
115
|
-
"Delete this endpoint?": "Delete this endpoint?",
|
|
116
|
-
"Delete this pipeline?": "Delete this pipeline?",
|
|
117
|
-
"Remove step?": "Remove step?",
|
|
118
|
-
"skip on error": "skip on error",
|
|
119
|
-
"conditional": "conditional",
|
|
120
|
-
"Invalid JSON": "Invalid JSON"
|
|
121
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"Document Understanding": "Document Understanding",
|
|
3
|
+
"Document Understanding - Pipeline Orchestrator": "Document Understanding - Pipeline Orchestrator",
|
|
4
|
+
"Service Connection": "Service Connection",
|
|
5
|
+
"Service Config": "Service Config",
|
|
6
|
+
"Endpoints": "Endpoints",
|
|
7
|
+
"Pipelines": "Pipelines",
|
|
8
|
+
"Jobs history": "Jobs history",
|
|
9
|
+
"Base URL": "Base URL",
|
|
10
|
+
"Authentication Type": "Authentication Type",
|
|
11
|
+
"Auth Type": "Auth Type",
|
|
12
|
+
"None": "None",
|
|
13
|
+
"API Key": "API Key",
|
|
14
|
+
"Bearer Token": "Bearer Token",
|
|
15
|
+
"Custom Header": "Custom Header",
|
|
16
|
+
"Custom Header Name": "Custom Header Name",
|
|
17
|
+
"API Key / Token": "API Key / Token",
|
|
18
|
+
"Request Timeout (ms)": "Request Timeout (ms)",
|
|
19
|
+
"Default Retries": "Default Retries",
|
|
20
|
+
"Poll Interval (ms)": "Poll Interval (ms)",
|
|
21
|
+
"Poll Timeout (ms)": "Poll Timeout (ms)",
|
|
22
|
+
"Webhook Secret": "Webhook Secret",
|
|
23
|
+
"Save Configuration": "Save Configuration",
|
|
24
|
+
"Configuration saved successfully": "Configuration saved successfully",
|
|
25
|
+
"Failed to save config": "Failed to save config",
|
|
26
|
+
"Add Endpoint": "Add Endpoint",
|
|
27
|
+
"Edit Endpoint": "Edit Endpoint",
|
|
28
|
+
"Basic": "Basic",
|
|
29
|
+
"File Input": "File Input",
|
|
30
|
+
"Async Config": "Async Config",
|
|
31
|
+
"Schema": "Schema",
|
|
32
|
+
"Custom Headers": "Custom Headers",
|
|
33
|
+
"Unique Name": "Unique Name",
|
|
34
|
+
"Subpath": "Subpath",
|
|
35
|
+
"HTTP Method": "HTTP Method",
|
|
36
|
+
"Execution Mode": "Execution Mode",
|
|
37
|
+
"Synchronous": "Synchronous",
|
|
38
|
+
"Polling": "Polling",
|
|
39
|
+
"Webhook": "Webhook",
|
|
40
|
+
"File Input Mode": "File Input Mode",
|
|
41
|
+
"Multipart Upload": "Multipart Upload",
|
|
42
|
+
"Base64 in JSON": "Base64 in JSON",
|
|
43
|
+
"Max Files": "Max Files",
|
|
44
|
+
"Task ID Field": "Task ID Field",
|
|
45
|
+
"Poll Result Subpath": "Poll Result Subpath",
|
|
46
|
+
"Result Field": "Result Field",
|
|
47
|
+
"Status Field": "Status Field",
|
|
48
|
+
"Completed Value": "Completed Value",
|
|
49
|
+
"Poll Task ID Field": "Poll Task ID Field",
|
|
50
|
+
"Poll Result Field": "Poll Result Field",
|
|
51
|
+
"Poll Status Field": "Poll Status Field",
|
|
52
|
+
"Poll Completed Value": "Poll Completed Value",
|
|
53
|
+
"Request Body Schema (JSON Schema)": "Request Body Schema (JSON Schema)",
|
|
54
|
+
"Response Schema (JSON Schema)": "Response Schema (JSON Schema)",
|
|
55
|
+
"Additional Headers": "Additional Headers",
|
|
56
|
+
"Add Header": "Add Header",
|
|
57
|
+
"Enabled": "Enabled",
|
|
58
|
+
"Action": "Action",
|
|
59
|
+
"Edit": "Edit",
|
|
60
|
+
"Delete": "Delete",
|
|
61
|
+
"Deleted": "Deleted",
|
|
62
|
+
"Saved": "Saved",
|
|
63
|
+
"Add Pipeline": "Add Pipeline",
|
|
64
|
+
"Edit Pipeline": "Edit Pipeline",
|
|
65
|
+
"New Pipeline": "New Pipeline",
|
|
66
|
+
"Pipeline Name": "Pipeline Name",
|
|
67
|
+
"Description": "Description",
|
|
68
|
+
"Pipeline Steps": "Pipeline Steps",
|
|
69
|
+
"Add Step": "Add Step",
|
|
70
|
+
"Add First Step": "Add First Step",
|
|
71
|
+
"No steps yet": "No steps yet",
|
|
72
|
+
"Step Name": "Step Name",
|
|
73
|
+
"Endpoint": "Endpoint",
|
|
74
|
+
"Output Alias": "Output Alias",
|
|
75
|
+
"On Error": "On Error",
|
|
76
|
+
"Fail": "Fail",
|
|
77
|
+
"Skip": "Skip",
|
|
78
|
+
"Retry": "Retry",
|
|
79
|
+
"Input Mapping (JSON)": "Input Mapping (JSON)",
|
|
80
|
+
"Condition (optional JSON)": "Condition (optional JSON)",
|
|
81
|
+
"Input Schema (JSON Schema)": "Input Schema (JSON Schema)",
|
|
82
|
+
"Output Mapping (JSON)": "Output Mapping (JSON)",
|
|
83
|
+
"Advanced: Input Schema & Output Mapping": "Advanced: Input Schema & Output Mapping",
|
|
84
|
+
"AI Tool": "AI Tool",
|
|
85
|
+
"Active": "Active",
|
|
86
|
+
"Inactive": "Inactive",
|
|
87
|
+
"Steps": "Steps",
|
|
88
|
+
"Job Details": "Job Details",
|
|
89
|
+
"Status": "Status",
|
|
90
|
+
"Current Step": "Current Step",
|
|
91
|
+
"Started": "Started",
|
|
92
|
+
"Completed": "Completed",
|
|
93
|
+
"Error": "Error",
|
|
94
|
+
"Input": "Input",
|
|
95
|
+
"Step Results": "Step Results",
|
|
96
|
+
"Final Result": "Final Result",
|
|
97
|
+
"External Task IDs": "External Task IDs",
|
|
98
|
+
"View": "View",
|
|
99
|
+
"Refresh": "Refresh",
|
|
100
|
+
"Filter by status": "Filter by status",
|
|
101
|
+
"Filter by pipeline": "Filter by pipeline",
|
|
102
|
+
"Pipeline": "Pipeline",
|
|
103
|
+
"ID": "ID",
|
|
104
|
+
"Name": "Name",
|
|
105
|
+
"Method": "Method",
|
|
106
|
+
"Execution": "Execution",
|
|
107
|
+
"File": "File",
|
|
108
|
+
"Done": "Done",
|
|
109
|
+
"Pending": "Pending",
|
|
110
|
+
"Running": "Running",
|
|
111
|
+
"Failed": "Failed",
|
|
112
|
+
"Timeout": "Timeout",
|
|
113
|
+
"All steps must have a name": "All steps must have a name",
|
|
114
|
+
"Step output aliases must be unique": "Step output aliases must be unique",
|
|
115
|
+
"Delete this endpoint?": "Delete this endpoint?",
|
|
116
|
+
"Delete this pipeline?": "Delete this pipeline?",
|
|
117
|
+
"Remove step?": "Remove step?",
|
|
118
|
+
"skip on error": "skip on error",
|
|
119
|
+
"conditional": "conditional",
|
|
120
|
+
"Invalid JSON": "Invalid JSON"
|
|
121
|
+
}
|