@dj1029/plugin-smart-sl 0.0.4 → 0.0.5

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.
@@ -0,0 +1,47 @@
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
+ expression: import("zod").ZodString;
37
+ }, "strip", import("zod").ZodTypeAny, {
38
+ expression?: string;
39
+ }, {
40
+ expression?: string;
41
+ }>, {
42
+ expression?: string;
43
+ }, {
44
+ expression?: string;
45
+ }, string>[];
46
+ }
47
+ //# 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;AAK/F,qBAuBa,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"}
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,13 @@
1
+ import { z } from 'zod';
2
+ export declare function buildSmartTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
3
+ expression: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ expression?: string;
6
+ }, {
7
+ expression?: string;
8
+ }>, {
9
+ expression?: string;
10
+ }, {
11
+ expression?: string;
12
+ }, string>;
13
+ //# 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;;;;;;;;;;WAkB7B"}
@@ -0,0 +1,20 @@
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 Useful for getting the result of a math expression. The input to this tool should be a valid mathematical expression that could be executed by a simple calculator.`,
16
+ schema: z.object({
17
+ expression: z.string().describe('Smart The mathematical expression to evaluate, e.g., "2 + 2 * 3"')
18
+ })
19
+ });
20
+ }
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dj1029/plugin-smart-sl",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",