@dj1029/plugin-smart-sl 0.0.4 → 0.0.6
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/lib/smart.strategy.d.ts +52 -0
- package/dist/lib/smart.strategy.d.ts.map +1 -0
- package/dist/lib/smart.strategy.js +56 -0
- package/dist/lib/smartBI.module.d.ts.map +1 -1
- package/dist/lib/smartBI.module.js +3 -1
- package/dist/lib/tool.d.ts +18 -0
- package/dist/lib/tool.d.ts.map +1 -0
- package/dist/lib/tool.js +22 -0
- package/dist/lib/toolset.d.ts +7 -0
- package/dist/lib/toolset.d.ts.map +1 -0
- package/dist/lib/toolset.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BuiltinToolset, IToolsetStrategy } from '@xpert-ai/plugin-sdk';
|
|
2
|
+
export declare class SmartStrategy implements IToolsetStrategy<any> {
|
|
3
|
+
meta: {
|
|
4
|
+
author: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
name: string;
|
|
7
|
+
label: {
|
|
8
|
+
en_US: string;
|
|
9
|
+
zh_Hans: string;
|
|
10
|
+
};
|
|
11
|
+
description: {
|
|
12
|
+
en_US: string;
|
|
13
|
+
zh_Hans: string;
|
|
14
|
+
};
|
|
15
|
+
icon: {
|
|
16
|
+
color: string;
|
|
17
|
+
png: string;
|
|
18
|
+
};
|
|
19
|
+
configSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
properties: {
|
|
22
|
+
userName: {
|
|
23
|
+
type: string;
|
|
24
|
+
title: string;
|
|
25
|
+
};
|
|
26
|
+
passWord: {
|
|
27
|
+
type: string;
|
|
28
|
+
title: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
validateConfig(config: any): Promise<void>;
|
|
34
|
+
create(config: any): Promise<BuiltinToolset>;
|
|
35
|
+
createTools(): import("@langchain/core/tools").DynamicStructuredTool<import("zod").ZodObject<{
|
|
36
|
+
userName: import("zod").ZodString;
|
|
37
|
+
passWord: import("zod").ZodString;
|
|
38
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
39
|
+
userName?: string;
|
|
40
|
+
passWord?: string;
|
|
41
|
+
}, {
|
|
42
|
+
userName?: string;
|
|
43
|
+
passWord?: string;
|
|
44
|
+
}>, {
|
|
45
|
+
userName?: string;
|
|
46
|
+
passWord?: string;
|
|
47
|
+
}, {
|
|
48
|
+
userName?: string;
|
|
49
|
+
passWord?: string;
|
|
50
|
+
}, string>[];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=smart.strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart.strategy.d.ts","sourceRoot":"","sources":["../../src/lib/smart.strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAmB,MAAM,sBAAsB,CAAA;AAKxF,qBAEa,aAAc,YAAW,gBAAgB,CAAC,GAAG,CAAC;IAEvD,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BH;IACD,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAGpC,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;IAIlD,WAAW;;;;;;;;;;;;;;;;CAKd"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { ToolsetStrategy } from '@xpert-ai/plugin-sdk';
|
|
4
|
+
import { SmartBIName, iconImage } from './types.js';
|
|
5
|
+
import { SmartToolset } from "./toolset.js";
|
|
6
|
+
import { buildSmartTool } from "./tool.js";
|
|
7
|
+
let SmartStrategy = class SmartStrategy {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.meta = {
|
|
10
|
+
author: 'dengjin',
|
|
11
|
+
tags: ['smartBI'],
|
|
12
|
+
name: SmartBIName,
|
|
13
|
+
label: {
|
|
14
|
+
en_US: 'SmartBI',
|
|
15
|
+
zh_Hans: 'SmartBI'
|
|
16
|
+
},
|
|
17
|
+
description: {
|
|
18
|
+
en_US: 'SmartBI is a powerful BI tool',
|
|
19
|
+
zh_Hans: 'SmartBI 是一个强大的 BI 工具'
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
color: '#14b8a6',
|
|
23
|
+
png: iconImage
|
|
24
|
+
},
|
|
25
|
+
configSchema: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
userName: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
title: 'userName1',
|
|
31
|
+
},
|
|
32
|
+
passWord: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
title: 'passWord1',
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
validateConfig(config) {
|
|
41
|
+
throw new Error('Method not implemented.');
|
|
42
|
+
}
|
|
43
|
+
async create(config) {
|
|
44
|
+
return new SmartToolset(config);
|
|
45
|
+
}
|
|
46
|
+
createTools() {
|
|
47
|
+
return [
|
|
48
|
+
buildSmartTool()
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
SmartStrategy = __decorate([
|
|
53
|
+
Injectable(),
|
|
54
|
+
ToolsetStrategy(SmartBIName)
|
|
55
|
+
], SmartStrategy);
|
|
56
|
+
export { SmartStrategy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartBI.module.d.ts","sourceRoot":"","sources":["../../src/lib/smartBI.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"smartBI.module.d.ts","sourceRoot":"","sources":["../../src/lib/smartBI.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM/F,qBAwBa,aAAc,YAAW,kBAAkB,EAAE,gBAAgB;IACtE;;;SAGK;IACL,OAAO,CAAC,UAAU,CAAQ;IAE1B;;;OAGG;IACH,iBAAiB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzC;;;OAGG;IACH,eAAe,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAK1C"}
|
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { XpertServerPlugin } from '@xpert-ai/plugin-sdk';
|
|
5
5
|
import { SmartBIIntegrationStrategy } from './integrationStrategy.js';
|
|
6
6
|
import { SmartBIController } from "./lark.controller.js";
|
|
7
|
+
import { SmartStrategy } from "./smart.strategy.js";
|
|
7
8
|
let smartBIModule = smartBIModule_1 = class smartBIModule {
|
|
8
9
|
constructor() {
|
|
9
10
|
/**
|
|
@@ -51,7 +52,8 @@ smartBIModule = smartBIModule_1 = __decorate([
|
|
|
51
52
|
* 提供的 services 方法
|
|
52
53
|
*/
|
|
53
54
|
providers: [
|
|
54
|
-
SmartBIIntegrationStrategy
|
|
55
|
+
SmartBIIntegrationStrategy,
|
|
56
|
+
SmartStrategy
|
|
55
57
|
]
|
|
56
58
|
})
|
|
57
59
|
], smartBIModule);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare function buildSmartTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
3
|
+
userName: z.ZodString;
|
|
4
|
+
passWord: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
userName?: string;
|
|
7
|
+
passWord?: string;
|
|
8
|
+
}, {
|
|
9
|
+
userName?: string;
|
|
10
|
+
passWord?: string;
|
|
11
|
+
}>, {
|
|
12
|
+
userName?: string;
|
|
13
|
+
passWord?: string;
|
|
14
|
+
}, {
|
|
15
|
+
userName?: string;
|
|
16
|
+
passWord?: string;
|
|
17
|
+
}, string>;
|
|
18
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/lib/tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,wBAAgB,cAAc;;;;;;;;;;;;;;;WAoB7B"}
|
package/dist/lib/tool.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tool } from '@langchain/core/tools';
|
|
2
|
+
import { getErrorMessage } from '@xpert-ai/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export function buildSmartTool() {
|
|
5
|
+
return tool(async (input) => {
|
|
6
|
+
try {
|
|
7
|
+
console.log("input ---------- ", input);
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return "I don't know how to do that because: " + getErrorMessage(error);
|
|
12
|
+
}
|
|
13
|
+
}, {
|
|
14
|
+
name: 'smart',
|
|
15
|
+
description: `Smart Connect`,
|
|
16
|
+
/** 这里决定了 测试的参数 */
|
|
17
|
+
schema: z.object({
|
|
18
|
+
userName: z.string().describe('连接用户名'),
|
|
19
|
+
passWord: z.string().describe('连接密码')
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StructuredToolInterface, ToolSchemaBase } from '@langchain/core/tools';
|
|
2
|
+
import { BuiltinToolset } from '@xpert-ai/plugin-sdk';
|
|
3
|
+
export declare class SmartToolset extends BuiltinToolset<StructuredToolInterface, Record<string, never>> {
|
|
4
|
+
_validateCredentials(credentials: Record<string, never>): Promise<void>;
|
|
5
|
+
initTools(): Promise<StructuredToolInterface<ToolSchemaBase, any, any>[]>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=toolset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolset.d.ts","sourceRoot":"","sources":["../../src/lib/toolset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD,qBAAa,YAAa,SAAQ,cAAc,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/E,oBAAoB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAGvE,SAAS,IAAI,OAAO,CAAC,uBAAuB,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;CAIzF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BuiltinToolset } from '@xpert-ai/plugin-sdk';
|
|
2
|
+
import { buildSmartTool } from './tool.js';
|
|
3
|
+
export class SmartToolset extends BuiltinToolset {
|
|
4
|
+
async _validateCredentials(credentials) {
|
|
5
|
+
// No credentials needed for calculator toolset
|
|
6
|
+
}
|
|
7
|
+
async initTools() {
|
|
8
|
+
this.tools = [buildSmartTool()];
|
|
9
|
+
return this.tools;
|
|
10
|
+
}
|
|
11
|
+
}
|