@nocobase/ai 2.2.0-alpha.11 → 2.2.0-alpha.12
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/lib/document-loader/loader.worker.js +3 -4
- package/lib/tools-manager/index.d.ts +1 -0
- package/lib/tools-manager/index.js +1 -0
- package/package.json +7 -7
- package/src/__tests__/document-loader.test.ts +11 -0
- package/src/document-loader/loader.worker.ts +2 -3
- package/src/tools-manager/index.ts +1 -0
|
@@ -33,10 +33,10 @@ const loadDoc = /* @__PURE__ */ __name(async (filePath, type) => {
|
|
|
33
33
|
const loader = new import_docx.DocxLoader(filePath, { type });
|
|
34
34
|
return loader.load();
|
|
35
35
|
}, "loadDoc");
|
|
36
|
-
const
|
|
36
|
+
const loadPptx = /* @__PURE__ */ __name(async (filePath) => {
|
|
37
37
|
const loader = new import_pptx.PPTXLoader(filePath);
|
|
38
38
|
return loader.load();
|
|
39
|
-
}, "
|
|
39
|
+
}, "loadPptx");
|
|
40
40
|
const loadTxt = /* @__PURE__ */ __name(async (filePath) => {
|
|
41
41
|
const loader = new import_text.TextLoader(filePath);
|
|
42
42
|
return loader.load();
|
|
@@ -49,9 +49,8 @@ const loadByExtname = /* @__PURE__ */ __name(async (payload) => {
|
|
|
49
49
|
switch (payload.extname) {
|
|
50
50
|
case ".pdf":
|
|
51
51
|
return loadPdf(payload.filePath);
|
|
52
|
-
case ".ppt":
|
|
53
52
|
case ".pptx":
|
|
54
|
-
return
|
|
53
|
+
return loadPptx(payload.filePath);
|
|
55
54
|
case ".doc":
|
|
56
55
|
return loadDoc(payload.filePath, "doc");
|
|
57
56
|
case ".docx":
|
|
@@ -22,6 +22,7 @@ export declare class DefaultToolsManager implements ToolsManager {
|
|
|
22
22
|
}
|
|
23
23
|
export declare function defineTools(options: ToolsOptions): ToolsOptions;
|
|
24
24
|
export declare const SYSTEM_TOOLS: {
|
|
25
|
+
GET_SKILL: string;
|
|
25
26
|
WEB_SEARCH: string;
|
|
26
27
|
KNOWLEDGE_BASE: string;
|
|
27
28
|
WORK_FLOW_TASK_OUTPUT: string;
|
|
@@ -132,6 +132,7 @@ function defineTools(options) {
|
|
|
132
132
|
}
|
|
133
133
|
__name(defineTools, "defineTools");
|
|
134
134
|
const SYSTEM_TOOLS = {
|
|
135
|
+
GET_SKILL: "getSkill",
|
|
135
136
|
WEB_SEARCH: "subAgentWebSearch",
|
|
136
137
|
KNOWLEDGE_BASE: "knowledge-base-retrieve",
|
|
137
138
|
WORK_FLOW_TASK_OUTPUT: "aiEmployeeWorkflowTaskOutput"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/ai",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"@langchain/mcp-adapters": "1.1.3",
|
|
18
18
|
"@langchain/ollama": "1.2.7",
|
|
19
19
|
"@langchain/openai": "1.4.7",
|
|
20
|
-
"@nocobase/data-source-manager": "2.2.0-alpha.
|
|
21
|
-
"@nocobase/logger": "2.2.0-alpha.
|
|
22
|
-
"@nocobase/resourcer": "2.2.0-alpha.
|
|
23
|
-
"@nocobase/utils": "2.2.0-alpha.
|
|
20
|
+
"@nocobase/data-source-manager": "2.2.0-alpha.12",
|
|
21
|
+
"@nocobase/logger": "2.2.0-alpha.12",
|
|
22
|
+
"@nocobase/resourcer": "2.2.0-alpha.12",
|
|
23
|
+
"@nocobase/utils": "2.2.0-alpha.12",
|
|
24
24
|
"d3-dsv": "2",
|
|
25
25
|
"fast-glob": "^3.3.2",
|
|
26
26
|
"flexsearch": "^0.8.2",
|
|
27
27
|
"gray-matter": "^4.0.3",
|
|
28
28
|
"langchain": "1.2.39",
|
|
29
29
|
"mammoth": "^1.10.0",
|
|
30
|
-
"officeparser": "^
|
|
30
|
+
"officeparser": "^6.0.4",
|
|
31
31
|
"pdf-parse": "^1.1.1",
|
|
32
32
|
"word-extractor": "^1.0.4",
|
|
33
33
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
38
38
|
"directory": "packages/ai"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "96ae69754a6398de63037ead3a4aad5e5d0ab918"
|
|
41
41
|
}
|
|
@@ -60,4 +60,15 @@ describe('Document loader worker', () => {
|
|
|
60
60
|
expect(documents[0].pageContent).toBe('Sheet: Sheet1\nname\tvalue\nalpha\t1');
|
|
61
61
|
expect(documents[0].metadata.source).toBe(filePath);
|
|
62
62
|
});
|
|
63
|
+
|
|
64
|
+
it('does not parse legacy ppt files', async () => {
|
|
65
|
+
const filePath = await createTempFile('source.ppt', 'legacy powerpoint content');
|
|
66
|
+
|
|
67
|
+
const documents = await loadByWorker('.ppt', {
|
|
68
|
+
filePath,
|
|
69
|
+
mimeType: 'application/vnd.ms-powerpoint',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(documents).toEqual([]);
|
|
73
|
+
});
|
|
63
74
|
});
|
|
@@ -45,7 +45,7 @@ const loadDoc = async (filePath: string, type: 'docx' | 'doc'): Promise<Document
|
|
|
45
45
|
return loader.load();
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const loadPptx = async (filePath: string): Promise<Document[]> => {
|
|
49
49
|
const loader = new PPTXLoader(filePath);
|
|
50
50
|
return loader.load();
|
|
51
51
|
};
|
|
@@ -64,9 +64,8 @@ const loadByExtname = async (payload: ParsePayload): Promise<Document[]> => {
|
|
|
64
64
|
switch (payload.extname) {
|
|
65
65
|
case '.pdf':
|
|
66
66
|
return loadPdf(payload.filePath);
|
|
67
|
-
case '.ppt':
|
|
68
67
|
case '.pptx':
|
|
69
|
-
return
|
|
68
|
+
return loadPptx(payload.filePath);
|
|
70
69
|
case '.doc':
|
|
71
70
|
return loadDoc(payload.filePath, 'doc');
|
|
72
71
|
case '.docx':
|
|
@@ -106,6 +106,7 @@ export function defineTools(options: ToolsOptions) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export const SYSTEM_TOOLS = {
|
|
109
|
+
GET_SKILL: 'getSkill',
|
|
109
110
|
WEB_SEARCH: 'subAgentWebSearch',
|
|
110
111
|
KNOWLEDGE_BASE: 'knowledge-base-retrieve',
|
|
111
112
|
WORK_FLOW_TASK_OUTPUT: 'aiEmployeeWorkflowTaskOutput',
|