@nocobase/plugin-ai 2.1.0-beta.24 → 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/ai/ai-employees/dara.js +1 -0
- package/dist/ai/tools/sub-agents/shared.js +3 -1
- package/dist/client/343.6f36d97dd122c5b6.js +10 -0
- package/dist/client/{559.133d286a0a0a1d93.js → 559.39872901b9053629.js} +1 -1
- package/dist/client/646.afa699c92cd556f3.js +10 -0
- package/dist/client/ai-employees/types.d.ts +2 -0
- package/dist/client/components/skill-settings.d.ts +2 -0
- package/dist/client/index.js +3 -3
- package/dist/client/llm-providers/mimo/ModelSettings.d.ts +10 -0
- package/dist/client/llm-providers/mimo/index.d.ts +10 -0
- package/dist/client/llm-providers/xai/ModelSettings.d.ts +10 -0
- package/dist/client/llm-providers/xai/index.d.ts +10 -0
- package/dist/collections/ai-employees.d.ts +7 -0
- package/dist/collections/ai-employees.js +13 -0
- package/dist/externalVersion.js +15 -15
- package/dist/locale/en-US.json +2 -0
- package/dist/locale/zh-CN.json +2 -0
- 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 +20 -10
- package/dist/server/llm-providers/common/reasoning.js +2 -4
- package/dist/server/llm-providers/mimo.d.ts +37 -0
- package/dist/server/llm-providers/mimo.js +156 -0
- package/dist/server/llm-providers/xai.d.ts +17 -0
- package/dist/server/llm-providers/xai.js +88 -0
- package/dist/server/migrations/20260428175558-update-ai-employee-category.d.ts +14 -0
- package/dist/server/migrations/20260428175558-update-ai-employee-category.js +55 -0
- package/dist/server/migrations/20260429175132-ai-employee-deprecated-orin.d.ts +14 -0
- package/dist/server/migrations/20260429175132-ai-employee-deprecated-orin.js +53 -0
- package/dist/server/plugin.js +5 -0
- package/dist/server/resource/aiEmployees.js +10 -1
- package/dist/server/workflow/nodes/employee/files.js +7 -4
- package/dist/server/workflow/nodes/employee/index.js +136 -132
- package/dist/server/workflow/nodes/employee/types.d.ts +1 -1
- package/package.json +3 -2
- package/dist/client/343.83f7d96664e4e038.js +0 -10
- package/dist/client/646.cba98d80e9e6ea74.js +0 -10
|
@@ -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-
|
|
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");
|
|
@@ -327,6 +328,9 @@ class AIEmployee {
|
|
|
327
328
|
const { systemPrompt, tools, middleware } = context;
|
|
328
329
|
const agent = await this.createAgent({ provider, systemPrompt, tools, middleware });
|
|
329
330
|
const input = this.getAgentInput(context, state);
|
|
331
|
+
if (this.from === "sub-agent") {
|
|
332
|
+
delete config.configurable;
|
|
333
|
+
}
|
|
330
334
|
return agent.invoke(input, this.withRunMetadata(config));
|
|
331
335
|
}
|
|
332
336
|
async prepareChatStream({
|
|
@@ -1126,17 +1130,17 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1126
1130
|
var _a;
|
|
1127
1131
|
const tools = await this.listTools({ scope: "GENERAL" });
|
|
1128
1132
|
if (this.webSearch === true) {
|
|
1129
|
-
const subAgentWebSearch = await this.toolsManager.getTools(
|
|
1133
|
+
const subAgentWebSearch = await this.toolsManager.getTools(import_ai.SYSTEM_TOOLS.WEB_SEARCH);
|
|
1130
1134
|
tools.push(subAgentWebSearch);
|
|
1131
1135
|
}
|
|
1132
1136
|
const generalToolsNameSet = new Set(tools.map((x) => x.definition.name));
|
|
1133
1137
|
const toolMap = await this.getToolsMap();
|
|
1134
|
-
const
|
|
1135
|
-
employeeTools
|
|
1138
|
+
const settingsTools = ((_a = this.employee.skillSettings) == null ? void 0 : _a.tools) ?? [];
|
|
1139
|
+
const employeeTools = [...settingsTools, ...this.tools];
|
|
1136
1140
|
if (await this.plugin.knowledgeBaseManager.isEnabledKnowledgeBase(this.employee.toJSON())) {
|
|
1137
|
-
const knowledgeBaseRetrieveTool = await this.toolsManager.getTools(
|
|
1141
|
+
const knowledgeBaseRetrieveTool = await this.toolsManager.getTools(import_ai.SYSTEM_TOOLS.KNOWLEDGE_BASE);
|
|
1138
1142
|
if (knowledgeBaseRetrieveTool) {
|
|
1139
|
-
employeeTools.push({ name:
|
|
1143
|
+
employeeTools.push({ name: import_ai.SYSTEM_TOOLS.KNOWLEDGE_BASE });
|
|
1140
1144
|
}
|
|
1141
1145
|
}
|
|
1142
1146
|
for (const toolSetting of employeeTools) {
|
|
@@ -1149,15 +1153,18 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1149
1153
|
}
|
|
1150
1154
|
tools.push(tool);
|
|
1151
1155
|
}
|
|
1156
|
+
const systemTools = (0, import_ai.listSystemTools)();
|
|
1152
1157
|
if (!this.skillSettings) {
|
|
1153
1158
|
return tools;
|
|
1154
1159
|
} else if (!this.skillSettings.toolsVersion) {
|
|
1155
1160
|
const toolFilter = this.skillSettings.tools ?? [];
|
|
1156
|
-
return tools.filter(
|
|
1161
|
+
return tools.filter(
|
|
1162
|
+
(t) => toolFilter.length === 0 || systemTools.includes(t.definition.name) || toolFilter.includes(t.definition.name)
|
|
1163
|
+
);
|
|
1157
1164
|
} else {
|
|
1158
1165
|
const toolFilter = this.skillSettings.tools;
|
|
1159
1166
|
if (import_lodash.default.isArray(toolFilter)) {
|
|
1160
|
-
return tools.filter((t) => toolFilter.includes(t.definition.name));
|
|
1167
|
+
return tools.filter((t) => systemTools.includes(t.definition.name) || toolFilter.includes(t.definition.name));
|
|
1161
1168
|
} else {
|
|
1162
1169
|
return tools;
|
|
1163
1170
|
}
|
|
@@ -1251,9 +1258,12 @@ If information is missing, clearly state it in the summary.</Important>`;
|
|
|
1251
1258
|
return result;
|
|
1252
1259
|
}
|
|
1253
1260
|
async getAvailableAIEmployees() {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
)
|
|
1261
|
+
var _a, _b;
|
|
1262
|
+
const specifiedToolNames = ((_b = (_a = this.employee.skillSettings) == null ? void 0 : _a.tools) == null ? void 0 : _b.map(({ name }) => name)) ?? [];
|
|
1263
|
+
if (!specifiedToolNames.includes("dispatch-sub-agent-task")) {
|
|
1264
|
+
return [];
|
|
1265
|
+
}
|
|
1266
|
+
const availableAIEmployees = (await (0, import_shared.listAccessibleAIEmployees)(this.ctx)).map((employee) => (0, import_shared.serializeEmployeeSummary)(this.ctx, employee)).filter((it) => it.username !== this.employee.username);
|
|
1257
1267
|
return availableAIEmployees;
|
|
1258
1268
|
}
|
|
1259
1269
|
async getMiddleware(options) {
|
|
@@ -44,7 +44,7 @@ const collectReasoningMap = (messages) => {
|
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
46
|
const reasoningContent = (_a = message.additional_kwargs) == null ? void 0 : _a.reasoning_content;
|
|
47
|
-
if (typeof reasoningContent !== "string"
|
|
47
|
+
if (reasoningContent == null || typeof reasoningContent !== "string") {
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
50
|
reasoningMap.set(String(i), reasoningContent);
|
|
@@ -65,9 +65,7 @@ const patchRequestMessagesReasoning = (request, reasoningMap) => {
|
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
const reasoningContent = reasoningMap.get(String(i));
|
|
68
|
-
|
|
69
|
-
message.reasoning_content = reasoningContent;
|
|
70
|
-
}
|
|
68
|
+
message.reasoning_content = reasoningContent;
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { LLMProvider } from './provider';
|
|
10
|
+
import { LLMProviderMeta } from '../manager/ai-manager';
|
|
11
|
+
import { AIMessageChunk, BaseMessageChunk } from '@langchain/core/messages';
|
|
12
|
+
import { ReasoningChatOpenAI } from './common/reasoning';
|
|
13
|
+
import { AttachmentModel } from '@nocobase/plugin-file-manager';
|
|
14
|
+
import { Model } from '@nocobase/database';
|
|
15
|
+
export declare class MiMoProvider extends LLMProvider {
|
|
16
|
+
chatModel: ReasoningChatOpenAI;
|
|
17
|
+
get baseURL(): string;
|
|
18
|
+
createModel(): ChatMiMoCompletions;
|
|
19
|
+
protected isApiSupportedAttachment(attachment: AttachmentModel): boolean;
|
|
20
|
+
parseResponseMessage(message: Model): {
|
|
21
|
+
key: any;
|
|
22
|
+
createdAt: any;
|
|
23
|
+
content: any;
|
|
24
|
+
role: any;
|
|
25
|
+
};
|
|
26
|
+
parseReasoningContent(chunk: AIMessageChunk): {
|
|
27
|
+
status: string;
|
|
28
|
+
content: string;
|
|
29
|
+
};
|
|
30
|
+
protected builtInTools(): any[];
|
|
31
|
+
isToolConflict(): boolean;
|
|
32
|
+
}
|
|
33
|
+
declare class ChatMiMoCompletions extends ReasoningChatOpenAI {
|
|
34
|
+
_convertCompletionsDeltaToBaseMessageChunk(delta: any, rawResponse: any, defaultRole: any): BaseMessageChunk;
|
|
35
|
+
}
|
|
36
|
+
export declare const mimoProviderOptions: LLMProviderMeta;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
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 __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 mimo_exports = {};
|
|
38
|
+
__export(mimo_exports, {
|
|
39
|
+
MiMoProvider: () => MiMoProvider,
|
|
40
|
+
mimoProviderOptions: () => mimoProviderOptions
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(mimo_exports);
|
|
43
|
+
var import_provider = require("./provider");
|
|
44
|
+
var import_ai_manager = require("../manager/ai-manager");
|
|
45
|
+
var import_lodash = __toESM(require("lodash"));
|
|
46
|
+
var import_openai = require("@langchain/openai");
|
|
47
|
+
var import_messages = require("@langchain/core/messages");
|
|
48
|
+
var import_reasoning = require("./common/reasoning");
|
|
49
|
+
class MiMoProvider extends import_provider.LLMProvider {
|
|
50
|
+
get baseURL() {
|
|
51
|
+
return "https://api.xiaomimimo.com/v1";
|
|
52
|
+
}
|
|
53
|
+
createModel() {
|
|
54
|
+
const { baseURL, apiKey } = this.serviceOptions || {};
|
|
55
|
+
const { responseFormat, structuredOutput } = this.modelOptions || {};
|
|
56
|
+
const { schema } = structuredOutput || {};
|
|
57
|
+
const responseFormatOptions = {
|
|
58
|
+
type: responseFormat ?? "text"
|
|
59
|
+
};
|
|
60
|
+
if (responseFormat === "json_schema" && schema) {
|
|
61
|
+
responseFormatOptions["json_schema"] = schema;
|
|
62
|
+
}
|
|
63
|
+
return new ChatMiMoCompletions({
|
|
64
|
+
apiKey,
|
|
65
|
+
...this.modelOptions,
|
|
66
|
+
modelKwargs: {
|
|
67
|
+
response_format: responseFormatOptions
|
|
68
|
+
},
|
|
69
|
+
configuration: {
|
|
70
|
+
baseURL: baseURL || this.baseURL
|
|
71
|
+
},
|
|
72
|
+
verbose: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
isApiSupportedAttachment(attachment) {
|
|
76
|
+
const media = ["image/"];
|
|
77
|
+
const supportedMedia = media.some((it) => {
|
|
78
|
+
var _a;
|
|
79
|
+
return (_a = attachment == null ? void 0 : attachment.mimetype) == null ? void 0 : _a.startsWith(it);
|
|
80
|
+
});
|
|
81
|
+
return supportedMedia;
|
|
82
|
+
}
|
|
83
|
+
parseResponseMessage(message) {
|
|
84
|
+
var _a;
|
|
85
|
+
const result = super.parseResponseMessage(message);
|
|
86
|
+
if (["user", "tool"].includes(result == null ? void 0 : result.role)) {
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
const { metadata } = (message == null ? void 0 : message.toJSON()) ?? {};
|
|
90
|
+
if (!import_lodash.default.isEmpty((_a = metadata == null ? void 0 : metadata.additional_kwargs) == null ? void 0 : _a.reasoning_content)) {
|
|
91
|
+
result.content = {
|
|
92
|
+
...result.content ?? {},
|
|
93
|
+
reasoning: {
|
|
94
|
+
status: "stop",
|
|
95
|
+
content: metadata == null ? void 0 : metadata.additional_kwargs.reasoning_content
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
parseReasoningContent(chunk) {
|
|
102
|
+
var _a;
|
|
103
|
+
if (!import_lodash.default.isEmpty((_a = chunk == null ? void 0 : chunk.additional_kwargs) == null ? void 0 : _a.reasoning_content)) {
|
|
104
|
+
return {
|
|
105
|
+
status: "streaming",
|
|
106
|
+
content: chunk.additional_kwargs.reasoning_content
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
builtInTools() {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
if (((_b = (_a = this.modelOptions) == null ? void 0 : _a.builtIn) == null ? void 0 : _b.webSearch) === true) {
|
|
114
|
+
return [
|
|
115
|
+
{
|
|
116
|
+
type: "web_search",
|
|
117
|
+
force_search: true
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
isToolConflict() {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
class ChatMiMoCompletions extends import_reasoning.ReasoningChatOpenAI {
|
|
128
|
+
_convertCompletionsDeltaToBaseMessageChunk(delta, rawResponse, defaultRole) {
|
|
129
|
+
const chunk = (0, import_openai.convertCompletionsDeltaToBaseMessageChunk)({
|
|
130
|
+
delta,
|
|
131
|
+
rawResponse,
|
|
132
|
+
includeRawResponse: this.__includeRawResponse,
|
|
133
|
+
defaultRole
|
|
134
|
+
});
|
|
135
|
+
if (chunk instanceof import_messages.AIMessageChunk) {
|
|
136
|
+
if (delta.reasoning_content) {
|
|
137
|
+
chunk.additional_kwargs.reasoning_content = delta.reasoning_content;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return chunk;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const mimoProviderOptions = {
|
|
144
|
+
title: "MiMo",
|
|
145
|
+
supportWebSearch: true,
|
|
146
|
+
supportedModel: [import_ai_manager.SupportedModel.LLM],
|
|
147
|
+
models: {
|
|
148
|
+
[import_ai_manager.SupportedModel.LLM]: ["mimo-v2.5-pro", "mimo-v2.5"]
|
|
149
|
+
},
|
|
150
|
+
provider: MiMoProvider
|
|
151
|
+
};
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
MiMoProvider,
|
|
155
|
+
mimoProviderOptions
|
|
156
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
on: string;
|
|
12
|
+
appVersion: string;
|
|
13
|
+
up(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 update_ai_employee_category_exports = {};
|
|
28
|
+
__export(update_ai_employee_category_exports, {
|
|
29
|
+
default: () => update_ai_employee_category_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(update_ai_employee_category_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
class update_ai_employee_category_default extends import_server.Migration {
|
|
34
|
+
on = "afterSync";
|
|
35
|
+
// 'beforeLoad' or 'afterLoad'
|
|
36
|
+
appVersion = "<2.2.0";
|
|
37
|
+
async up() {
|
|
38
|
+
const repo = this.db.getRepository("aiEmployees");
|
|
39
|
+
if (!repo) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
await repo.update({
|
|
43
|
+
values: {
|
|
44
|
+
category: "developer"
|
|
45
|
+
},
|
|
46
|
+
filter: {
|
|
47
|
+
builtIn: true,
|
|
48
|
+
username: {
|
|
49
|
+
$in: ["orin", "nathan", "dara"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.app.logger.info('Update AI employee orin, nathan, dara`s category to "developer"');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
on: string;
|
|
12
|
+
appVersion: string;
|
|
13
|
+
up(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 ai_employee_deprecated_orin_exports = {};
|
|
28
|
+
__export(ai_employee_deprecated_orin_exports, {
|
|
29
|
+
default: () => ai_employee_deprecated_orin_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(ai_employee_deprecated_orin_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
class ai_employee_deprecated_orin_default extends import_server.Migration {
|
|
34
|
+
on = "afterSync";
|
|
35
|
+
// 'beforeLoad' or 'afterLoad'
|
|
36
|
+
appVersion = "<2.2.0";
|
|
37
|
+
async up() {
|
|
38
|
+
const repo = this.db.getRepository("aiEmployees");
|
|
39
|
+
if (!repo) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
await repo.update({
|
|
43
|
+
values: {
|
|
44
|
+
deprecated: true
|
|
45
|
+
},
|
|
46
|
+
filter: {
|
|
47
|
+
builtIn: true,
|
|
48
|
+
username: "orin"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
this.app.logger.info("Update AI employee orin to deprecated");
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/server/plugin.js
CHANGED
|
@@ -70,8 +70,10 @@ 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");
|
|
76
|
+
var import_mimo = require("./llm-providers/mimo");
|
|
75
77
|
var import_sub_agents = require("./ai-employees/sub-agents");
|
|
76
78
|
var import_employee = require("./workflow/nodes/employee");
|
|
77
79
|
var import_ai_knowledge_base = require("./ai-employees/ai-knowledge-base");
|
|
@@ -141,9 +143,12 @@ class PluginAIServer extends import_server.Plugin {
|
|
|
141
143
|
this.aiManager.registerLLMProvider("anthropic", import_anthropic.anthropicProviderOptions);
|
|
142
144
|
this.aiManager.registerLLMProvider("deepseek", import_deepseek.deepseekProviderOptions);
|
|
143
145
|
this.aiManager.registerLLMProvider("dashscope", import_dashscope.dashscopeProviderOptions);
|
|
146
|
+
this.aiManager.registerLLMProvider("kimi", import_kimi.kimiProviderOptions);
|
|
147
|
+
this.aiManager.registerLLMProvider("mimo", import_mimo.mimoProviderOptions);
|
|
144
148
|
this.aiManager.registerLLMProvider("ollama", import_ollama.ollamaProviderOptions);
|
|
145
149
|
this.aiManager.registerLLMProvider("openai-completions", import_openai2.openaiCompletionsProviderOptions);
|
|
146
150
|
this.aiManager.registerLLMProvider("kimi", import_kimi.kimiProviderOptions);
|
|
151
|
+
this.aiManager.registerLLMProvider("xai", import_xai.xaiProviderOptions);
|
|
147
152
|
}
|
|
148
153
|
registerTools() {
|
|
149
154
|
const toolsManager = this.ai.toolsManager;
|
|
@@ -49,6 +49,13 @@ const list = async (ctx, next) => {
|
|
|
49
49
|
const { paginate } = ctx.action.params || {};
|
|
50
50
|
const plugin = ctx.app.pm.get("ai");
|
|
51
51
|
const builtInManager = plugin.builtInManager;
|
|
52
|
+
const filter = ctx.action.params.filter || {};
|
|
53
|
+
ctx.action.mergeParams({
|
|
54
|
+
filter: {
|
|
55
|
+
...filter,
|
|
56
|
+
deprecated: false
|
|
57
|
+
}
|
|
58
|
+
});
|
|
52
59
|
await import_actions.default.list(ctx, () => {
|
|
53
60
|
});
|
|
54
61
|
let data = ctx.body.rows;
|
|
@@ -146,7 +153,9 @@ const listByUser = async (ctx, next) => {
|
|
|
146
153
|
prompt: (_b = (_a = row.userConfigs) == null ? void 0 : _a[0]) == null ? void 0 : _b.prompt
|
|
147
154
|
},
|
|
148
155
|
skillSettings,
|
|
149
|
-
builtIn: row.builtIn
|
|
156
|
+
builtIn: row.builtIn,
|
|
157
|
+
category: row.category,
|
|
158
|
+
deprecated: row.deprecated
|
|
150
159
|
};
|
|
151
160
|
});
|
|
152
161
|
await next();
|
|
@@ -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
|
});
|