@nocobase/plugin-ai 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/dev/external-knowledge-base.md +318 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +76 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/hit-tests.md +66 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +73 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/segments.md +93 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +77 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/rag.md +1 -1
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +79 -0
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/delete-document.md +71 -0
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/index.md +84 -0
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/retrieve-document.md +87 -0
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/update-document.md +70 -0
- package/dist/ai/docs/nocobase/api/cli/skills/install.md +1 -0
- package/dist/ai/docs/nocobase/api/cli/skills/update.md +1 -0
- package/dist/ai/docs/nocobase/development/index.md +3 -0
- package/dist/ai/docs/nocobase/get-started/deployment/how-to-deploy-nocobase-faster.mdx +2 -2
- package/dist/ai/docs/nocobase/ops-management/backup-manager/index.mdx +9 -7
- package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +423 -0
- package/dist/ai/docs/nocobase/ops-management/migration-manager/index.md +12 -9
- package/dist/ai/docs/nocobase/ops-management/release-management/index.md +111 -24
- package/dist/client/ai-employees/ProfileCard.d.ts +1 -0
- package/dist/client/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +2 -3
- package/dist/client/ai-employees/form-filler/tools/index.d.ts +8 -0
- package/dist/client/index.js +3 -3
- package/dist/externalVersion.js +16 -16
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-employee.d.ts +0 -9
- package/dist/server/ai-employees/ai-employee.js +0 -84
- package/dist/server/ai-employees/ai-knowledge-base.d.ts +0 -4
- package/dist/server/ai-employees/ai-knowledge-base.js +25 -89
- package/dist/server/collections/lc-checkpoint-blobs.js +1 -1
- package/dist/server/collections/lc-checkpoint-writes.js +1 -1
- package/dist/server/collections/lc-checkpoints.js +1 -1
- package/dist/server/features/index.d.ts +1 -1
- package/dist/server/features/knowledge-base.d.ts +2 -1
- package/dist/server/features/vector-store-provider.d.ts +1 -9
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +31 -0
- package/dist/server/types/knowledge-base.type.d.ts +14 -0
- package/package.json +2 -2
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base.md +0 -82
package/dist/server/plugin.js
CHANGED
|
@@ -128,6 +128,37 @@ class PluginAIServer extends import_server.Plugin {
|
|
|
128
128
|
await this.ai.employeeManager.init();
|
|
129
129
|
await this.ai.mcpManager.init();
|
|
130
130
|
});
|
|
131
|
+
this.app.on("afterUpgrade", async () => {
|
|
132
|
+
await this.resetConversationThreadsWhenCheckpointsEmpty();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async resetConversationThreadsWhenCheckpointsEmpty() {
|
|
136
|
+
const [checkpointCount, checkpointWriteCount, checkpointBlobCount, conversationsWithThreadCount] = await Promise.all([
|
|
137
|
+
this.db.getRepository("lcCheckpoints").count(),
|
|
138
|
+
this.db.getRepository("lcCheckpointWrites").count(),
|
|
139
|
+
this.db.getRepository("lcCheckpointBlobs").count(),
|
|
140
|
+
this.db.getRepository("aiConversations").count({
|
|
141
|
+
filter: {
|
|
142
|
+
thread: {
|
|
143
|
+
$gt: 0
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
]);
|
|
148
|
+
if (checkpointCount > 0 || checkpointWriteCount > 0 || checkpointBlobCount > 0 || conversationsWithThreadCount <= 1) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
await this.db.getRepository("aiConversations").update({
|
|
152
|
+
filter: {
|
|
153
|
+
thread: {
|
|
154
|
+
$gt: 0
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
values: {
|
|
158
|
+
thread: 0
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
this.app.logger.info(`Reset ${conversationsWithThreadCount} AI conversation threads after empty checkpoints`);
|
|
131
162
|
}
|
|
132
163
|
async load() {
|
|
133
164
|
this.registerLLMProviders();
|
|
@@ -32,3 +32,17 @@ export type KnowledgeBaseGroup = {
|
|
|
32
32
|
knowledgeBaseType: KnowledgeBaseType;
|
|
33
33
|
knowledgeBaseList: KnowledgeBase[];
|
|
34
34
|
};
|
|
35
|
+
export type DocumentSegmented = {
|
|
36
|
+
content: string;
|
|
37
|
+
metadata: Record<string, any>;
|
|
38
|
+
id?: string;
|
|
39
|
+
};
|
|
40
|
+
export type DocumentSegmentedWithScore = DocumentSegmented & {
|
|
41
|
+
score: number;
|
|
42
|
+
};
|
|
43
|
+
export type SearchOptions = {
|
|
44
|
+
knowledgeBaseKeys: string[];
|
|
45
|
+
query: string;
|
|
46
|
+
topK?: number;
|
|
47
|
+
score?: string;
|
|
48
|
+
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Create AI employees with diverse skills to collaborate with humans, build systems, and handle business operations.",
|
|
7
7
|
"description.ru-RU": "Поддержка интеграции с AI-сервисами: предоставляются AI-узлы для рабочих процессов, расширяя возможности бизнес-обработки.",
|
|
8
8
|
"description.zh-CN": "创建各种技能的 AI 员工,与人类协同,搭建系统,处理业务。",
|
|
9
|
-
"version": "2.1.
|
|
9
|
+
"version": "2.1.7",
|
|
10
10
|
"main": "dist/server/index.js",
|
|
11
11
|
"homepage": "https://docs.nocobase.com/handbook/action-ai",
|
|
12
12
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/action-ai",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"keywords": [
|
|
66
66
|
"AI"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fc3bc8bf6ef0c185a456cb5241abc4716af8c20c"
|
|
69
69
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# Knowledge Base
|
|
2
|
-
|
|
3
|
-
## Introduction
|
|
4
|
-
|
|
5
|
-
The knowledge base is the foundation of RAG retrieval. It organizes documents by category and builds an index. When an AI employee answers a question, it will prioritize searching for answers from the knowledge base.
|
|
6
|
-
|
|
7
|
-
## Knowledge Base Management
|
|
8
|
-
|
|
9
|
-
Go to the AI employee plugin configuration page, click the `Knowledge base` tab to enter the knowledge base management page.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Click the `Add new` button in the upper right corner to add a `Local` knowledge base.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-

|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Enter the necessary information for the new knowledge base:
|
|
22
|
-
|
|
23
|
-
- In the `Name` input box, enter the knowledge base name;
|
|
24
|
-
- In `File storage`, select the file storage location;
|
|
25
|
-
- In `Vector store`, select the vector store, refer to [Vector Store](/ai-employees/knowledge-base/vector-store);
|
|
26
|
-
- In the `Description` input box, enter the knowledge base description;
|
|
27
|
-
|
|
28
|
-
Click the `Submit` button to create the knowledge base.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-

|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Knowledge Base Document Management
|
|
35
|
-
|
|
36
|
-
After creating the knowledge base, on the knowledge base list page, click the newly created knowledge base to enter the knowledge base document management page.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-

|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-

|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Click the `Upload` button to upload documents. After the documents are uploaded, vectorization will start automatically. Wait for the `Status` to change from `Pending` to `Success`.
|
|
47
|
-
|
|
48
|
-
Currently, the knowledge base supports the following document types: txt, md, json, cvs, xls, xlsx, pdf, doc, docx, ppt, pptx; pdf only supports plain text.
|
|
49
|
-
|
|
50
|
-
If you need to upload files in bulk, you can create a zip archive and upload it to the knowledge base. The backend will extract the zip archive and automatically import and vectorize the documents.
|
|
51
|
-
|
|
52
|
-

|
|
53
|
-
|
|
54
|
-
If uploading a zip archive fails because the file is too large, you can adjust the upload file size limit in the File Manager module.
|
|
55
|
-
|
|
56
|
-

|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Knowledge Base Types
|
|
60
|
-
|
|
61
|
-
### Local Knowledge Base
|
|
62
|
-
|
|
63
|
-
A Local knowledge base is a knowledge base stored locally in NocoBase. The documents and their vector data are all stored locally by NocoBase.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-

|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
### Readonly Knowledge Base
|
|
70
|
-
|
|
71
|
-
A Readonly knowledge base is a read-only knowledge base. The documents and vector data are maintained externally. Only a vector database connection is created in NocoBase (currently only PGVector is supported).
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-

|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### External Knowledge Base
|
|
78
|
-
|
|
79
|
-
An External knowledge base is an external knowledge base where documents and vector data are maintained externally. Vector database retrieval needs to be extended by developers, allowing the use of vector databases not currently supported by NocoBase.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-

|