plugin-docpixie 1.0.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/client.d.ts +1 -0
- package/client.js +1 -0
- package/dist/client/index.js +10 -0
- package/dist/externalVersion.js +17 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +21 -0
- package/dist/locale/vi-VN.json +21 -0
- package/dist/server/collections/docpixie-config.js +61 -0
- package/dist/server/collections/docpixie-documents.js +71 -0
- package/dist/server/collections/docpixie-pages.js +59 -0
- package/dist/server/exceptions.js +127 -0
- package/dist/server/index.js +49 -0
- package/dist/server/plugin.js +178 -0
- package/dist/server/prompts.js +388 -0
- package/dist/server/providers/index.js +36 -0
- package/dist/server/providers/llm-adapter.js +253 -0
- package/dist/server/services/DocPixieService.js +1300 -0
- package/dist/server/types.js +24 -0
- package/package.json +40 -0
- package/server.d.ts +1 -0
- package/server.js +1 -0
package/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/client';
|
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nocobase/client")):"function"==typeof define&&define.amd?define("plugin-docpixie",["react","@nocobase/client"],t):"object"==typeof exports?exports["plugin-docpixie"]=t(require("react"),require("@nocobase/client")):e["plugin-docpixie"]=t(e.react,e["@nocobase/client"])}(self,function(e,t){return function(){"use strict";var n={772:function(e){e.exports=t},156:function(t){t.exports=e}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.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,{PluginDocPixieClient:function(){return y}});var e=o(156),t=o.n(e),n=o(772);function r(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var u=e.apply(t,n);function c(e){r(u,o,i,c,a,"next",e)}function a(e){r(u,o,i,c,a,"throw",e)}c(void 0)})}}function c(e,t,n){return(c=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&l(o,n.prototype),o}).apply(null,arguments)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=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 c(e,arguments,a(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function s(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var d=function(){return t().createElement("div",{style:{padding:24,maxWidth:800,margin:"0 auto"}},t().createElement("h2",null,"DocPixie Document AI"),t().createElement("p",{style:{color:"#666"}},"Adaptive RAG Agent for document analysis — OCR + LLM Vision + structured extraction."),t().createElement("div",{style:{marginTop:24,padding:16,background:"#f6f6f6",borderRadius:8,border:"1px solid #e8e8e8"}},t().createElement("h3",null,"Configuration"),t().createElement("p",null,"Configure DocPixie via the REST API:"),t().createElement("ul",null,t().createElement("li",null,"POST /api/docpixie:updateConfig — Update plugin settings"),t().createElement("li",null,"GET /api/docpixie:getConfig — View current settings"),t().createElement("li",null,"POST /api/docpixie:processDocument — Ingest a document"),t().createElement("li",null,"POST /api/docpixie:query — Query documents"))),t().createElement("div",{style:{marginTop:16,padding:16,background:"#e6f7ff",borderRadius:8,border:"1px solid #91d5ff"}},t().createElement("p",null,"\uD83D\uDCA1 LLM services are configured in the NocoBase AI Settings page. Set your LLM service name in DocPixie config to use it for document analysis.")))},y=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=a(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,p()?Reflect.construct(e,t||[],a(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&l(n,e),t=[{key:"afterAdd",value:function(){return u(function(){return s(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return u(function(){return s(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return u(function(){return s(this,function(t){return e.app.pluginSettingsManager.add(e.name,{title:'{{t("DocPixie Document AI")}}',icon:"FileSearchOutlined",Component:d}),[2]})})()}}],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)}}(n.prototype,t),n}(f(n.Plugin));i.default=y}(),i}()});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
"react": "18.3.1",
|
|
12
|
+
"@nocobase/client": "2.0.20",
|
|
13
|
+
"@nocobase/server": "2.0.20",
|
|
14
|
+
"@nocobase/database": "2.0.20",
|
|
15
|
+
"@langchain/core": "1.1.36",
|
|
16
|
+
"@nocobase/logger": "2.0.20"
|
|
17
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
default: () => import_server.default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
43
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
44
|
+
var import_server = __toESM(require("./server"));
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
...require("./server")
|
|
48
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DocPixie Document AI": "DocPixie Document AI",
|
|
3
|
+
"Adaptive RAG agent for document analysis": "Adaptive RAG agent for document analysis",
|
|
4
|
+
"LLM Service (Text)": "LLM Service (Text)",
|
|
5
|
+
"LLM Service (Vision)": "LLM Service (Vision)",
|
|
6
|
+
"Analysis Strategy": "Analysis Strategy",
|
|
7
|
+
"OCR Provider": "OCR Provider",
|
|
8
|
+
"OCR API Endpoint": "OCR API Endpoint",
|
|
9
|
+
"OCR API Key": "OCR API Key",
|
|
10
|
+
"Max Pages Per Task": "Max Pages Per Task",
|
|
11
|
+
"Max Tasks Per Plan": "Max Tasks Per Plan",
|
|
12
|
+
"Vision": "Vision",
|
|
13
|
+
"OCR Only": "OCR Only",
|
|
14
|
+
"Hybrid": "Hybrid",
|
|
15
|
+
"External API": "External API",
|
|
16
|
+
"None (Vision Only)": "None (Vision Only)",
|
|
17
|
+
"Document processed successfully": "Document processed successfully",
|
|
18
|
+
"Query completed": "Query completed",
|
|
19
|
+
"No documents found": "No documents found",
|
|
20
|
+
"LLM service not configured": "LLM service not configured"
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DocPixie Document AI": "DocPixie AI Phân Tích Tài Liệu",
|
|
3
|
+
"Adaptive RAG agent for document analysis": "Agent RAG thích ứng cho phân tích tài liệu",
|
|
4
|
+
"LLM Service (Text)": "Dịch vụ LLM (Văn bản)",
|
|
5
|
+
"LLM Service (Vision)": "Dịch vụ LLM (Hình ảnh)",
|
|
6
|
+
"Analysis Strategy": "Chiến lược phân tích",
|
|
7
|
+
"OCR Provider": "Nhà cung cấp OCR",
|
|
8
|
+
"OCR API Endpoint": "Địa chỉ API OCR",
|
|
9
|
+
"OCR API Key": "Khóa API OCR",
|
|
10
|
+
"Max Pages Per Task": "Số trang tối đa mỗi tác vụ",
|
|
11
|
+
"Max Tasks Per Plan": "Số tác vụ tối đa mỗi kế hoạch",
|
|
12
|
+
"Vision": "Hình ảnh",
|
|
13
|
+
"OCR Only": "Chỉ OCR",
|
|
14
|
+
"Hybrid": "Kết hợp",
|
|
15
|
+
"External API": "API bên ngoài",
|
|
16
|
+
"None (Vision Only)": "Không (chỉ Vision)",
|
|
17
|
+
"Document processed successfully": "Tài liệu đã được xử lý thành công",
|
|
18
|
+
"Query completed": "Truy vấn hoàn thành",
|
|
19
|
+
"No documents found": "Không tìm thấy tài liệu",
|
|
20
|
+
"LLM service not configured": "Dịch vụ LLM chưa được cấu hình"
|
|
21
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var docpixie_config_exports = {};
|
|
28
|
+
__export(docpixie_config_exports, {
|
|
29
|
+
default: () => docpixie_config_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(docpixie_config_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var docpixie_config_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "docpixie_config",
|
|
35
|
+
title: "DocPixie Configuration",
|
|
36
|
+
fields: [
|
|
37
|
+
{ type: "bigInt", name: "id", primaryKey: true, autoIncrement: true },
|
|
38
|
+
/**
|
|
39
|
+
* Reference to a row in `llmServices` collection (text model).
|
|
40
|
+
* This is the name field of the llmService, e.g. "my-openai-service".
|
|
41
|
+
*/
|
|
42
|
+
{ type: "string", name: "llmServiceName", length: 100 },
|
|
43
|
+
/**
|
|
44
|
+
* Reference to a row in `llmServices` collection (vision model).
|
|
45
|
+
* Can be the same as llmServiceName for a model that supports both.
|
|
46
|
+
*/
|
|
47
|
+
{ type: "string", name: "visionLlmServiceName", length: 100 },
|
|
48
|
+
/** Analysis strategy: vision, ocr_only, hybrid */
|
|
49
|
+
{ type: "string", name: "analysisStrategy", length: 20, defaultValue: "hybrid" },
|
|
50
|
+
/** OCR provider: external_api or none */
|
|
51
|
+
{ type: "string", name: "ocrProvider", length: 20, defaultValue: "none" },
|
|
52
|
+
/** URL for external OCR API */
|
|
53
|
+
{ type: "string", name: "ocrApiEndpoint", length: 500 },
|
|
54
|
+
/** API key for external OCR */
|
|
55
|
+
{ type: "string", name: "ocrApiKey", length: 500 },
|
|
56
|
+
/** Max pages the LLM may analyze per task */
|
|
57
|
+
{ type: "integer", name: "maxPagesPerTask", defaultValue: 5 },
|
|
58
|
+
/** Max tasks the adaptive planner may create per query */
|
|
59
|
+
{ type: "integer", name: "maxTasksPerPlan", defaultValue: 4 }
|
|
60
|
+
]
|
|
61
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var docpixie_documents_exports = {};
|
|
28
|
+
__export(docpixie_documents_exports, {
|
|
29
|
+
default: () => docpixie_documents_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(docpixie_documents_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var docpixie_documents_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "docpixie_documents",
|
|
35
|
+
title: "DocPixie Documents",
|
|
36
|
+
fields: [
|
|
37
|
+
{ type: "bigInt", name: "id", primaryKey: true, autoIncrement: true },
|
|
38
|
+
{ type: "string", name: "name", length: 500 },
|
|
39
|
+
{ type: "string", name: "originalPath", length: 1e3 },
|
|
40
|
+
{ type: "string", name: "storagePath", length: 1e3 },
|
|
41
|
+
{ type: "string", name: "fileType", length: 20, defaultValue: "pdf" },
|
|
42
|
+
{ type: "integer", name: "pageCount", defaultValue: 0 },
|
|
43
|
+
{ type: "text", name: "summary" },
|
|
44
|
+
{
|
|
45
|
+
type: "string",
|
|
46
|
+
name: "status",
|
|
47
|
+
length: 20,
|
|
48
|
+
defaultValue: "pending"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "string",
|
|
52
|
+
name: "extractionMethod",
|
|
53
|
+
length: 20,
|
|
54
|
+
defaultValue: "external_api"
|
|
55
|
+
},
|
|
56
|
+
{ type: "json", name: "metadata", defaultValue: {} },
|
|
57
|
+
{ type: "date", name: "createdAt" },
|
|
58
|
+
{ type: "date", name: "updatedAt" },
|
|
59
|
+
{
|
|
60
|
+
type: "hasMany",
|
|
61
|
+
name: "pages",
|
|
62
|
+
target: "docpixie_pages",
|
|
63
|
+
foreignKey: "documentId"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: "belongsTo",
|
|
67
|
+
name: "createdBy",
|
|
68
|
+
target: "users"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var docpixie_pages_exports = {};
|
|
28
|
+
__export(docpixie_pages_exports, {
|
|
29
|
+
default: () => docpixie_pages_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(docpixie_pages_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var docpixie_pages_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "docpixie_pages",
|
|
35
|
+
title: "DocPixie Pages",
|
|
36
|
+
fields: [
|
|
37
|
+
{ type: "bigInt", name: "id", primaryKey: true, autoIncrement: true },
|
|
38
|
+
{
|
|
39
|
+
type: "belongsTo",
|
|
40
|
+
name: "document",
|
|
41
|
+
target: "docpixie_documents",
|
|
42
|
+
foreignKey: "documentId"
|
|
43
|
+
},
|
|
44
|
+
{ type: "integer", name: "pageNumber" },
|
|
45
|
+
{ type: "string", name: "imagePath", length: 1e3 },
|
|
46
|
+
{ type: "text", name: "structuredText" },
|
|
47
|
+
{ type: "json", name: "regions", defaultValue: [] },
|
|
48
|
+
{ type: "boolean", name: "hasTables", defaultValue: false },
|
|
49
|
+
{ type: "boolean", name: "hasFigures", defaultValue: false },
|
|
50
|
+
{ type: "json", name: "headings", defaultValue: [] },
|
|
51
|
+
{
|
|
52
|
+
type: "string",
|
|
53
|
+
name: "extractionMethod",
|
|
54
|
+
length: 20,
|
|
55
|
+
defaultValue: "text_layer"
|
|
56
|
+
},
|
|
57
|
+
{ type: "json", name: "metadata", defaultValue: {} }
|
|
58
|
+
]
|
|
59
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var exceptions_exports = {};
|
|
28
|
+
__export(exceptions_exports, {
|
|
29
|
+
ContextProcessingError: () => ContextProcessingError,
|
|
30
|
+
DocPixieError: () => DocPixieError,
|
|
31
|
+
PageSelectionError: () => PageSelectionError,
|
|
32
|
+
PlanUpdateError: () => PlanUpdateError,
|
|
33
|
+
ProcessingError: () => ProcessingError,
|
|
34
|
+
ProviderError: () => ProviderError,
|
|
35
|
+
QueryClassificationError: () => QueryClassificationError,
|
|
36
|
+
QueryReformulationError: () => QueryReformulationError,
|
|
37
|
+
ResponseSynthesisError: () => ResponseSynthesisError,
|
|
38
|
+
TaskAnalysisError: () => TaskAnalysisError,
|
|
39
|
+
TaskPlanningError: () => TaskPlanningError
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(exceptions_exports);
|
|
42
|
+
class DocPixieError extends Error {
|
|
43
|
+
constructor(message) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.name = "DocPixieError";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class ContextProcessingError extends DocPixieError {
|
|
49
|
+
constructor(message) {
|
|
50
|
+
super(message);
|
|
51
|
+
this.name = "ContextProcessingError";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class QueryReformulationError extends DocPixieError {
|
|
55
|
+
constructor(message) {
|
|
56
|
+
super(message);
|
|
57
|
+
this.name = "QueryReformulationError";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class QueryClassificationError extends DocPixieError {
|
|
61
|
+
constructor(message) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.name = "QueryClassificationError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class TaskPlanningError extends DocPixieError {
|
|
67
|
+
constructor(message) {
|
|
68
|
+
super(message);
|
|
69
|
+
this.name = "TaskPlanningError";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class PageSelectionError extends DocPixieError {
|
|
73
|
+
constructor(message) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.name = "PageSelectionError";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
class TaskAnalysisError extends DocPixieError {
|
|
79
|
+
constructor(message) {
|
|
80
|
+
super(message);
|
|
81
|
+
this.name = "TaskAnalysisError";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
class PlanUpdateError extends DocPixieError {
|
|
85
|
+
constructor(message) {
|
|
86
|
+
super(message);
|
|
87
|
+
this.name = "PlanUpdateError";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class ResponseSynthesisError extends DocPixieError {
|
|
91
|
+
constructor(message) {
|
|
92
|
+
super(message);
|
|
93
|
+
this.name = "ResponseSynthesisError";
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
class ProviderError extends DocPixieError {
|
|
97
|
+
provider;
|
|
98
|
+
constructor(message, provider) {
|
|
99
|
+
super(message);
|
|
100
|
+
this.name = "ProviderError";
|
|
101
|
+
this.provider = provider;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
class ProcessingError extends DocPixieError {
|
|
105
|
+
filePath;
|
|
106
|
+
pageNumber;
|
|
107
|
+
constructor(message, filePath, pageNumber) {
|
|
108
|
+
super(message);
|
|
109
|
+
this.name = "ProcessingError";
|
|
110
|
+
this.filePath = filePath;
|
|
111
|
+
this.pageNumber = pageNumber;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
+
0 && (module.exports = {
|
|
116
|
+
ContextProcessingError,
|
|
117
|
+
DocPixieError,
|
|
118
|
+
PageSelectionError,
|
|
119
|
+
PlanUpdateError,
|
|
120
|
+
ProcessingError,
|
|
121
|
+
ProviderError,
|
|
122
|
+
QueryClassificationError,
|
|
123
|
+
QueryReformulationError,
|
|
124
|
+
ResponseSynthesisError,
|
|
125
|
+
TaskAnalysisError,
|
|
126
|
+
TaskPlanningError
|
|
127
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name2 in all)
|
|
18
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var server_exports = {};
|
|
38
|
+
__export(server_exports, {
|
|
39
|
+
default: () => import_plugin.default,
|
|
40
|
+
namespace: () => namespace
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(server_exports);
|
|
43
|
+
var import_package = require("../../package.json");
|
|
44
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
45
|
+
const namespace = import_package.name;
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
namespace
|
|
49
|
+
});
|