@nocobase/plugin-ai 2.1.0-beta.25 → 2.1.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/{559.c119db3f985a695f.js → 559.39872901b9053629.js} +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/llm-providers/xai/ModelSettings.d.ts +10 -0
- package/dist/client/llm-providers/xai/index.d.ts +10 -0
- package/dist/externalVersion.js +15 -15
- package/dist/node_modules/@langchain/xai/LICENSE +21 -0
- package/dist/node_modules/@langchain/xai/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.cjs +568 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.d.cts +619 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.d.ts +619 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.js +566 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/index.cjs +2 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/index.d.ts +3 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/index.js +2 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses-types.d.cts +1178 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses-types.d.ts +1178 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.cjs +233 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.d.cts +70 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.d.ts +70 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.js +232 -0
- package/dist/node_modules/@langchain/xai/dist/converters/responses.cjs +168 -0
- package/dist/node_modules/@langchain/xai/dist/converters/responses.js +164 -0
- package/dist/node_modules/@langchain/xai/dist/index.cjs +7 -0
- package/dist/node_modules/@langchain/xai/dist/index.d.cts +5 -0
- package/dist/node_modules/@langchain/xai/dist/index.d.ts +6 -0
- package/dist/node_modules/@langchain/xai/dist/index.js +6 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.cjs +54 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.d.cts +145 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.d.ts +145 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.js +51 -0
- package/dist/node_modules/@langchain/xai/dist/profiles.cjs +289 -0
- package/dist/node_modules/@langchain/xai/dist/profiles.js +288 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.cjs +52 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.d.cts +64 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.d.ts +64 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.js +50 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.cjs +60 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.d.cts +90 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.d.ts +90 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.js +58 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.cjs +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.d.cts +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.d.ts +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.js +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.cjs +94 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.d.cts +149 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.d.ts +149 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.js +91 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.cjs +57 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.d.cts +104 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.d.ts +104 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.js +55 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.cjs +63 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.d.cts +145 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.d.ts +145 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.js +61 -0
- package/dist/node_modules/@langchain/xai/package.json +1 -0
- package/dist/node_modules/fast-glob/package.json +1 -1
- package/dist/node_modules/flexsearch/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/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.js +11 -7
- package/dist/server/llm-providers/xai.d.ts +17 -0
- package/dist/server/llm-providers/xai.js +88 -0
- package/dist/server/plugin.js +3 -0
- package/dist/server/workflow/nodes/employee/files.js +7 -4
- package/dist/server/workflow/nodes/employee/index.js +4 -3
- package/dist/server/workflow/nodes/employee/types.d.ts +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-05-07T16:22:32.226Z"}
|
|
@@ -46,6 +46,7 @@ var import_prompts = require("./prompts");
|
|
|
46
46
|
var import_lodash = __toESM(require("lodash"));
|
|
47
47
|
var import_ai_chat_conversation = require("../manager/ai-chat-conversation");
|
|
48
48
|
var import_middleware = require("./middleware");
|
|
49
|
+
var import_ai = require("@nocobase/ai");
|
|
49
50
|
var import_checkpoints = require("./checkpoints");
|
|
50
51
|
var import_langchain = require("langchain");
|
|
51
52
|
var import_langgraph = require("@langchain/langgraph");
|
|
@@ -1129,17 +1130,17 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1129
1130
|
var _a;
|
|
1130
1131
|
const tools = await this.listTools({ scope: "GENERAL" });
|
|
1131
1132
|
if (this.webSearch === true) {
|
|
1132
|
-
const subAgentWebSearch = await this.toolsManager.getTools(
|
|
1133
|
+
const subAgentWebSearch = await this.toolsManager.getTools(import_ai.SYSTEM_TOOLS.WEB_SEARCH);
|
|
1133
1134
|
tools.push(subAgentWebSearch);
|
|
1134
1135
|
}
|
|
1135
1136
|
const generalToolsNameSet = new Set(tools.map((x) => x.definition.name));
|
|
1136
1137
|
const toolMap = await this.getToolsMap();
|
|
1137
|
-
const
|
|
1138
|
-
employeeTools
|
|
1138
|
+
const settingsTools = ((_a = this.employee.skillSettings) == null ? void 0 : _a.tools) ?? [];
|
|
1139
|
+
const employeeTools = [...settingsTools, ...this.tools];
|
|
1139
1140
|
if (await this.plugin.knowledgeBaseManager.isEnabledKnowledgeBase(this.employee.toJSON())) {
|
|
1140
|
-
const knowledgeBaseRetrieveTool = await this.toolsManager.getTools(
|
|
1141
|
+
const knowledgeBaseRetrieveTool = await this.toolsManager.getTools(import_ai.SYSTEM_TOOLS.KNOWLEDGE_BASE);
|
|
1141
1142
|
if (knowledgeBaseRetrieveTool) {
|
|
1142
|
-
employeeTools.push({ name:
|
|
1143
|
+
employeeTools.push({ name: import_ai.SYSTEM_TOOLS.KNOWLEDGE_BASE });
|
|
1143
1144
|
}
|
|
1144
1145
|
}
|
|
1145
1146
|
for (const toolSetting of employeeTools) {
|
|
@@ -1152,15 +1153,18 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1152
1153
|
}
|
|
1153
1154
|
tools.push(tool);
|
|
1154
1155
|
}
|
|
1156
|
+
const systemTools = (0, import_ai.listSystemTools)();
|
|
1155
1157
|
if (!this.skillSettings) {
|
|
1156
1158
|
return tools;
|
|
1157
1159
|
} else if (!this.skillSettings.toolsVersion) {
|
|
1158
1160
|
const toolFilter = this.skillSettings.tools ?? [];
|
|
1159
|
-
return tools.filter(
|
|
1161
|
+
return tools.filter(
|
|
1162
|
+
(t) => toolFilter.length === 0 || systemTools.includes(t.definition.name) || toolFilter.includes(t.definition.name)
|
|
1163
|
+
);
|
|
1160
1164
|
} else {
|
|
1161
1165
|
const toolFilter = this.skillSettings.tools;
|
|
1162
1166
|
if (import_lodash.default.isArray(toolFilter)) {
|
|
1163
|
-
return tools.filter((t) => toolFilter.includes(t.definition.name));
|
|
1167
|
+
return tools.filter((t) => systemTools.includes(t.definition.name) || toolFilter.includes(t.definition.name));
|
|
1164
1168
|
} else {
|
|
1165
1169
|
return tools;
|
|
1166
1170
|
}
|
|
@@ -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
|
+
import { ChatXAI } from '@langchain/xai';
|
|
10
|
+
import { LLMProvider } from './provider';
|
|
11
|
+
import { LLMProviderMeta } from '../manager/ai-manager';
|
|
12
|
+
export declare class XAIProvider extends LLMProvider {
|
|
13
|
+
chatModel: ChatXAI;
|
|
14
|
+
get baseURL(): string;
|
|
15
|
+
createModel(): ChatXAI;
|
|
16
|
+
}
|
|
17
|
+
export declare const xaiProviderOptions: LLMProviderMeta;
|
|
@@ -0,0 +1,88 @@
|
|
|
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 xai_exports = {};
|
|
28
|
+
__export(xai_exports, {
|
|
29
|
+
XAIProvider: () => XAIProvider,
|
|
30
|
+
xaiProviderOptions: () => xaiProviderOptions
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(xai_exports);
|
|
33
|
+
var import_xai = require("@langchain/xai");
|
|
34
|
+
var import_provider = require("./provider");
|
|
35
|
+
var import_ai_manager = require("../manager/ai-manager");
|
|
36
|
+
class XAIProvider extends import_provider.LLMProvider {
|
|
37
|
+
get baseURL() {
|
|
38
|
+
return "https://api.x.ai/v1";
|
|
39
|
+
}
|
|
40
|
+
createModel() {
|
|
41
|
+
const { baseURL, apiKey } = this.serviceOptions || {};
|
|
42
|
+
const { responseFormat, structuredOutput, ...restModelOptions } = this.modelOptions || {};
|
|
43
|
+
const { schema } = structuredOutput || {};
|
|
44
|
+
const responseFormatOptions = {
|
|
45
|
+
type: responseFormat ?? "text"
|
|
46
|
+
};
|
|
47
|
+
if (responseFormat === "json_schema" && schema) {
|
|
48
|
+
responseFormatOptions["json_schema"] = schema;
|
|
49
|
+
}
|
|
50
|
+
return new import_xai.ChatXAI({
|
|
51
|
+
apiKey,
|
|
52
|
+
...restModelOptions,
|
|
53
|
+
baseURL: baseURL || this.baseURL,
|
|
54
|
+
modelKwargs: {
|
|
55
|
+
response_format: responseFormatOptions
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const xaiProviderOptions = {
|
|
61
|
+
title: "xAI",
|
|
62
|
+
supportedModel: [import_ai_manager.SupportedModel.LLM],
|
|
63
|
+
models: {
|
|
64
|
+
[import_ai_manager.SupportedModel.LLM]: [
|
|
65
|
+
"grok-4",
|
|
66
|
+
"grok-4-1",
|
|
67
|
+
"grok-4-1-fast",
|
|
68
|
+
"grok-4-1-fast-non-reasoning",
|
|
69
|
+
"grok-3",
|
|
70
|
+
"grok-3-fast",
|
|
71
|
+
"grok-3-fast-beta",
|
|
72
|
+
"grok-3-beta",
|
|
73
|
+
"grok-3-mini",
|
|
74
|
+
"grok-3-mini-fast",
|
|
75
|
+
"grok-3-mini-beta",
|
|
76
|
+
"grok-3-mini-fast-beta",
|
|
77
|
+
"grok-2",
|
|
78
|
+
"grok-2-vision",
|
|
79
|
+
"grok-vision-beta"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
provider: XAIProvider
|
|
83
|
+
};
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
XAIProvider,
|
|
87
|
+
xaiProviderOptions
|
|
88
|
+
});
|
package/dist/server/plugin.js
CHANGED
|
@@ -70,6 +70,7 @@ var import_aiMcpClients = __toESM(require("./resource/aiMcpClients"));
|
|
|
70
70
|
var import_work_context_handler = require("./manager/work-context-handler");
|
|
71
71
|
var import_ai_coding_manager = require("./manager/ai-coding-manager");
|
|
72
72
|
var import_kimi = require("./llm-providers/kimi");
|
|
73
|
+
var import_xai = require("./llm-providers/xai");
|
|
73
74
|
var import_document_loader = require("./document-loader");
|
|
74
75
|
var import_checkpoints = require("./ai-employees/checkpoints");
|
|
75
76
|
var import_mimo = require("./llm-providers/mimo");
|
|
@@ -146,6 +147,8 @@ class PluginAIServer extends import_server.Plugin {
|
|
|
146
147
|
this.aiManager.registerLLMProvider("mimo", import_mimo.mimoProviderOptions);
|
|
147
148
|
this.aiManager.registerLLMProvider("ollama", import_ollama.ollamaProviderOptions);
|
|
148
149
|
this.aiManager.registerLLMProvider("openai-completions", import_openai2.openaiCompletionsProviderOptions);
|
|
150
|
+
this.aiManager.registerLLMProvider("kimi", import_kimi.kimiProviderOptions);
|
|
151
|
+
this.aiManager.registerLLMProvider("xai", import_xai.xaiProviderOptions);
|
|
149
152
|
}
|
|
150
153
|
registerTools() {
|
|
151
154
|
const toolsManager = this.ai.toolsManager;
|
|
@@ -57,7 +57,9 @@ class Files {
|
|
|
57
57
|
if (!repository) {
|
|
58
58
|
throw new Error(`Attachment collection [${collection}] not existed`);
|
|
59
59
|
}
|
|
60
|
-
const attachmentKeys = (_a = attachmentGroup[collection]) == null ? void 0 : _a.
|
|
60
|
+
const attachmentKeys = (_a = attachmentGroup[collection]) == null ? void 0 : _a.flatMap(
|
|
61
|
+
(it) => import_lodash.default.isArray(it.value) ? it.value : [it.value]
|
|
62
|
+
);
|
|
61
63
|
const attachmentModels = await repository.find({
|
|
62
64
|
filter: {
|
|
63
65
|
id: {
|
|
@@ -77,13 +79,14 @@ class Files {
|
|
|
77
79
|
};
|
|
78
80
|
const resolveUrls = async (files) => {
|
|
79
81
|
var _a;
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
+
const attachmentFiles = files.filter((it) => it.type === "file_url");
|
|
83
|
+
if (attachmentFiles.length) {
|
|
84
|
+
const urls = attachmentFiles.flatMap(({ value }) => import_lodash.default.isArray(value) ? value : [value]);
|
|
82
85
|
const fileManager = plugin.pm.get("file-manager");
|
|
83
86
|
const settings = await plugin.db.getRepository("aiSettings").findOne();
|
|
84
87
|
const storageName = (_a = settings == null ? void 0 : settings.options) == null ? void 0 : _a.storage;
|
|
85
88
|
const attachments = await Promise.all(
|
|
86
|
-
urls.map(async (
|
|
89
|
+
urls.map(async (url) => {
|
|
87
90
|
const response = await import_axios.default.get(url, {
|
|
88
91
|
responseType: "arraybuffer"
|
|
89
92
|
});
|
|
@@ -45,6 +45,7 @@ var import_plugin = __toESM(require("../../../plugin"));
|
|
|
45
45
|
var import_ai_employee = require("../../../ai-employees/ai-employee");
|
|
46
46
|
var import_files = require("./files");
|
|
47
47
|
var import_utils = require("@nocobase/utils");
|
|
48
|
+
var import_ai = require("@nocobase/ai");
|
|
48
49
|
__reExport(employee_exports, require("./handler"), module.exports);
|
|
49
50
|
__reExport(employee_exports, require("./tools"), module.exports);
|
|
50
51
|
class AIEmployeeInstruction extends import_plugin_workflow.Instruction {
|
|
@@ -59,7 +60,7 @@ class AIEmployeeInstruction extends import_plugin_workflow.Instruction {
|
|
|
59
60
|
userId,
|
|
60
61
|
files
|
|
61
62
|
} = processor.getParsedValue(node.config, node.id);
|
|
62
|
-
const toolName =
|
|
63
|
+
const toolName = import_ai.SYSTEM_TOOLS.WORK_FLOW_TASK_OUTPUT;
|
|
63
64
|
const workflowSystemPrompt = `
|
|
64
65
|
You are operating inside a workflow.
|
|
65
66
|
Your job is to complete the workflow task and return the final outcome to the workflow, not to reply freely as a normal assistant.
|
|
@@ -181,8 +182,8 @@ ${typeof message.system === "object" ? JSON.stringify(message.system) : message.
|
|
|
181
182
|
role: "user",
|
|
182
183
|
content: {
|
|
183
184
|
type: "text",
|
|
184
|
-
content: `You failed to call the required tool "
|
|
185
|
-
Call "
|
|
185
|
+
content: `You failed to call the required tool "${import_ai.SYSTEM_TOOLS.WORK_FLOW_TASK_OUTPUT}" in your previous response.
|
|
186
|
+
Call "${import_ai.SYSTEM_TOOLS.WORK_FLOW_TASK_OUTPUT}" now to submit the workflow outcome.
|
|
186
187
|
Do not send another normal assistant response without invoking it.
|
|
187
188
|
`
|
|
188
189
|
}
|
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.0-beta.
|
|
9
|
+
"version": "2.1.0-beta.26",
|
|
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",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@langchain/langgraph-checkpoint": "^1.0.0",
|
|
43
43
|
"@langchain/ollama": "^1.2.2",
|
|
44
44
|
"@langchain/openai": "^1.2.7",
|
|
45
|
+
"@langchain/xai": "1.3.3",
|
|
45
46
|
"@nocobase/ai-employee-avatars": "^1.0.2",
|
|
46
47
|
"@xyflow/react": "^12.7.0",
|
|
47
48
|
"echarts": "^5.5.0",
|
|
@@ -61,5 +62,5 @@
|
|
|
61
62
|
"keywords": [
|
|
62
63
|
"AI"
|
|
63
64
|
],
|
|
64
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "b17e1a72057813fa27d8435bf0f2af67ea4b059f"
|
|
65
66
|
}
|