gm-mcp 1.1.26 → 1.1.28
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/index.js +53 -23
- package/dist/services/constants/product-type.d.ts +6 -0
- package/dist/services/constants/product-type.js +9 -0
- package/dist/test.js +9 -14
- package/dist/tools/lark-tool.d.ts +1 -0
- package/dist/tools/lark-tool.js +16 -7
- package/package.json +1 -1
- package/src/index.ts +82 -23
- package/src/services/constants/product-type.ts +6 -0
- package/src/test.ts +8 -11
- package/src/tools/lark-tool.ts +22 -14
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const tools_1 = require("./tools");
|
|
|
20
20
|
const zod_1 = __importDefault(require("zod"));
|
|
21
21
|
const env_1 = require("./env");
|
|
22
22
|
const lark_tool_1 = require("./tools/lark-tool");
|
|
23
|
+
const product_type_1 = require("./services/constants/product-type");
|
|
23
24
|
exports.server = new mcp_js_1.McpServer({
|
|
24
25
|
name: "mcp-server",
|
|
25
26
|
version: "1.0.0",
|
|
@@ -71,39 +72,68 @@ exports.server.tool("statistic_salary_x3_in_range", "Get statistic salary x3 wit
|
|
|
71
72
|
}));
|
|
72
73
|
exports.server.tool("debt_collection", "The company's debt collection information", {
|
|
73
74
|
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
75
|
+
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
+
const { company_name } = args;
|
|
77
|
+
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
78
|
+
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
79
|
+
companyName: company_name,
|
|
80
|
+
productType: product_type_1.PRODUCT_TYPE.EWA_02_03,
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
83
|
+
exports.server.tool("debt_collection_with_month", "The company's debt collection information with month", {
|
|
74
84
|
month: zod_1.default
|
|
75
85
|
.string()
|
|
76
|
-
.optional()
|
|
77
86
|
.describe("Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"),
|
|
87
|
+
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
88
|
+
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
+
const { month, company_name } = args;
|
|
90
|
+
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
91
|
+
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
92
|
+
monthDate: month,
|
|
93
|
+
companyName: company_name,
|
|
94
|
+
productType: product_type_1.PRODUCT_TYPE.EWA_02_03,
|
|
95
|
+
});
|
|
96
|
+
}));
|
|
97
|
+
exports.server.tool("debt_collection_ewa_02", "The company's debt collection information with EWA 02 - 03 product type", {
|
|
98
|
+
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
99
|
+
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
+
const { company_name } = args;
|
|
101
|
+
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
102
|
+
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
103
|
+
companyName: company_name,
|
|
104
|
+
productType: product_type_1.PRODUCT_TYPE.EWA_02_03,
|
|
105
|
+
});
|
|
106
|
+
}));
|
|
107
|
+
exports.server.tool("debt_collection_ewa_04", "The company's debt collection information with EWA 04 product type", {
|
|
108
|
+
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
109
|
+
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
const { company_name } = args;
|
|
111
|
+
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
112
|
+
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
113
|
+
companyName: company_name,
|
|
114
|
+
productType: product_type_1.PRODUCT_TYPE.EWA_04,
|
|
115
|
+
});
|
|
116
|
+
}));
|
|
117
|
+
exports.server.tool("debt_collection_x3", "The company's debt collection information with Lương X3 product type", {
|
|
118
|
+
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
119
|
+
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
+
const { company_name } = args;
|
|
121
|
+
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
122
|
+
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
123
|
+
companyName: company_name,
|
|
124
|
+
productType: product_type_1.PRODUCT_TYPE.X3,
|
|
125
|
+
});
|
|
126
|
+
}));
|
|
127
|
+
exports.server.tool("debt_collection_x3", "The company's debt collection information with Lương X3 - EVF product type", {
|
|
128
|
+
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
78
129
|
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
130
|
const { company_name } = args;
|
|
80
131
|
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
81
132
|
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
82
|
-
// monthDate: month || "",
|
|
83
133
|
companyName: company_name,
|
|
134
|
+
productType: product_type_1.PRODUCT_TYPE.X3_EVF,
|
|
84
135
|
});
|
|
85
136
|
}));
|
|
86
|
-
// server.tool(
|
|
87
|
-
// "debt_collection_with_month",
|
|
88
|
-
// "The company's debt collection information with month",
|
|
89
|
-
// {
|
|
90
|
-
// month: z
|
|
91
|
-
// .string()
|
|
92
|
-
// .optional()
|
|
93
|
-
// .describe(
|
|
94
|
-
// "Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"
|
|
95
|
-
// ),
|
|
96
|
-
// company_name: z.string({ description: "Company name to get data" }),
|
|
97
|
-
// },
|
|
98
|
-
// async (args) => {
|
|
99
|
-
// const { month, company_name } = args;
|
|
100
|
-
// return debtCollectionRateTool({
|
|
101
|
-
// sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
102
|
-
// monthDate: month,
|
|
103
|
-
// companyName: company_name,
|
|
104
|
-
// });
|
|
105
|
-
// }
|
|
106
|
-
// );
|
|
107
137
|
function bootstap() {
|
|
108
138
|
(0, env_1.ensureEnvVariables)();
|
|
109
139
|
const transport = new stdio_js_1.StdioServerTransport();
|
package/dist/test.js
CHANGED
|
@@ -8,29 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const v3_1 = __importDefault(require("zod/v3"));
|
|
16
12
|
const env_1 = require("./env");
|
|
17
|
-
const
|
|
13
|
+
const lark_tool_1 = require("./tools/lark-tool");
|
|
14
|
+
const product_type_1 = require("./services/constants/product-type");
|
|
18
15
|
function setupTest() {
|
|
19
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
17
|
(0, env_1.ensureEnvVariables)();
|
|
21
|
-
const mySchema = v3_1.default
|
|
22
|
-
.object({
|
|
23
|
-
myString: v3_1.default.string().min(5).optional(),
|
|
24
|
-
})
|
|
25
|
-
.describe("My neat object schema");
|
|
26
|
-
const res1 = (0, zod_to_json_schema_1.zodToJsonSchema)(mySchema);
|
|
27
|
-
console.log(res1);
|
|
28
18
|
// const r = await fetchDebtCollectionRecords();
|
|
29
19
|
// console.log(r.length);
|
|
30
20
|
// const compnay = "BGG";
|
|
31
21
|
// const month = "12/2025";
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
const res = yield (0, lark_tool_1.debtCollectionRateTool)({
|
|
23
|
+
sendMessageToLark: true,
|
|
24
|
+
companyName: "Tkg",
|
|
25
|
+
// monthDate: "8/2025",
|
|
26
|
+
productType: product_type_1.PRODUCT_TYPE.X3_EVF,
|
|
27
|
+
});
|
|
28
|
+
console.log(res);
|
|
34
29
|
// const fieldNames = REPORT_COLUMS.map((item) => item.field_name);
|
|
35
30
|
// try {
|
|
36
31
|
// const records = await fetchReportRecords({ view_id: "vewI23hNnx", field_names: fieldNames });
|
package/dist/tools/lark-tool.js
CHANGED
|
@@ -25,7 +25,7 @@ const statusKey = "TRẠNG THÁI";
|
|
|
25
25
|
function debtCollectionRateTool(options) {
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
var _c, _d;
|
|
28
|
-
const { sendMessageToLark, companyName, monthDate } = options;
|
|
28
|
+
const { sendMessageToLark, companyName, monthDate, productType } = options;
|
|
29
29
|
const monthParts = !monthDate ? null : (0, helpers_1.extractMonth)(monthDate);
|
|
30
30
|
// if (monthParts === null) {
|
|
31
31
|
// return { content: [{ type: "text", text: `${monthDate} is invalid` }] };
|
|
@@ -43,24 +43,33 @@ function debtCollectionRateTool(options) {
|
|
|
43
43
|
const companiesMatchName = records.filter((item) => item.fields[companyKey] === foundName);
|
|
44
44
|
// console.log(companiesMatchName);
|
|
45
45
|
// Find by debt reduction month, search fully match
|
|
46
|
-
|
|
46
|
+
// Then find by product
|
|
47
|
+
const foundRecords = companiesMatchName
|
|
48
|
+
.filter((item) => {
|
|
47
49
|
if (monthParts === null) {
|
|
48
50
|
return true;
|
|
49
51
|
}
|
|
50
52
|
const { month } = monthParts;
|
|
51
53
|
return compareReductionDebtMonth(item.fields[debReductionMonthKey], month.toString());
|
|
54
|
+
})
|
|
55
|
+
.filter((item) => {
|
|
56
|
+
var _c;
|
|
57
|
+
if (!productType) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return ((_c = item.fields[productKey]) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === productType.toLowerCase();
|
|
52
61
|
});
|
|
53
62
|
// const foundMonth = searchLike(
|
|
54
63
|
// month.toString(),
|
|
55
64
|
// companiesMatchName.map((item) => item.fields["KỲ LƯƠNG"])
|
|
56
65
|
// )[0];
|
|
57
|
-
console.log(
|
|
66
|
+
console.log(foundRecords);
|
|
58
67
|
// const finalCompnay = companiesMatchName.find((item) => item.fields["KỲ LƯƠNG"] === foundMonth);
|
|
59
68
|
// console.log(finalCompnay);
|
|
60
69
|
const messages = [];
|
|
61
|
-
for (const item of
|
|
70
|
+
for (const item of foundRecords) {
|
|
62
71
|
messages.push([
|
|
63
|
-
item.fields[
|
|
72
|
+
item.fields[debReductionMonthKey] || "N/A",
|
|
64
73
|
typeof item.fields[debtCollectionRateKey] === "undefined"
|
|
65
74
|
? "N/A"
|
|
66
75
|
: round(Number(item.fields[debtCollectionRateKey])) + "%",
|
|
@@ -83,11 +92,11 @@ function debtCollectionRateTool(options) {
|
|
|
83
92
|
// return {} as any;
|
|
84
93
|
if (sendMessageToLark) {
|
|
85
94
|
yield (0, lark_service_1.sendReportOpsGroup)({
|
|
86
|
-
title:
|
|
95
|
+
title: ['Tỉ lệ thu nợ', foundName, productType].filter(Boolean).join(' - '),
|
|
87
96
|
message_content: messages.join("<hr>"),
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
|
-
return { content: [{ type: "text", text: JSON.stringify(
|
|
99
|
+
return { content: [{ type: "text", text: JSON.stringify(foundRecords) }] };
|
|
91
100
|
// console.log(finalCompnay);
|
|
92
101
|
}
|
|
93
102
|
catch (e) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import z from "zod";
|
|
14
14
|
import { ensureEnvVariables, getEnv } from "./env";
|
|
15
15
|
import { debtCollectionRateTool } from "./tools/lark-tool";
|
|
16
|
+
import { PRODUCT_TYPE } from "./services/constants/product-type";
|
|
16
17
|
|
|
17
18
|
export const server = new McpServer(
|
|
18
19
|
{
|
|
@@ -94,44 +95,102 @@ server.tool(
|
|
|
94
95
|
"The company's debt collection information",
|
|
95
96
|
{
|
|
96
97
|
company_name: z.string({ description: "Company name to get data" }),
|
|
98
|
+
},
|
|
99
|
+
async (args) => {
|
|
100
|
+
const { company_name } = args;
|
|
101
|
+
return debtCollectionRateTool({
|
|
102
|
+
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
103
|
+
companyName: company_name,
|
|
104
|
+
productType: PRODUCT_TYPE.EWA_02_03,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
server.tool(
|
|
110
|
+
"debt_collection_with_month",
|
|
111
|
+
"The company's debt collection information with month",
|
|
112
|
+
{
|
|
97
113
|
month: z
|
|
98
114
|
.string()
|
|
99
|
-
.optional()
|
|
100
115
|
.describe(
|
|
101
116
|
"Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"
|
|
102
117
|
),
|
|
118
|
+
company_name: z.string({ description: "Company name to get data" }),
|
|
119
|
+
},
|
|
120
|
+
async (args) => {
|
|
121
|
+
const { month, company_name } = args;
|
|
122
|
+
return debtCollectionRateTool({
|
|
123
|
+
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
124
|
+
monthDate: month,
|
|
125
|
+
companyName: company_name,
|
|
126
|
+
productType: PRODUCT_TYPE.EWA_02_03,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
server.tool(
|
|
132
|
+
"debt_collection_ewa_02",
|
|
133
|
+
"The company's debt collection information with EWA 02 - 03 product type",
|
|
134
|
+
{
|
|
135
|
+
company_name: z.string({ description: "Company name to get data" }),
|
|
103
136
|
},
|
|
104
137
|
async (args) => {
|
|
105
138
|
const { company_name } = args;
|
|
106
139
|
return debtCollectionRateTool({
|
|
107
140
|
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
108
|
-
// monthDate: month || "",
|
|
109
141
|
companyName: company_name,
|
|
142
|
+
productType: PRODUCT_TYPE.EWA_02_03,
|
|
110
143
|
});
|
|
111
144
|
}
|
|
112
145
|
);
|
|
113
146
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
server.tool(
|
|
148
|
+
"debt_collection_ewa_04",
|
|
149
|
+
"The company's debt collection information with EWA 04 product type",
|
|
150
|
+
{
|
|
151
|
+
company_name: z.string({ description: "Company name to get data" }),
|
|
152
|
+
},
|
|
153
|
+
async (args) => {
|
|
154
|
+
const { company_name } = args;
|
|
155
|
+
return debtCollectionRateTool({
|
|
156
|
+
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
157
|
+
companyName: company_name,
|
|
158
|
+
productType: PRODUCT_TYPE.EWA_04,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
server.tool(
|
|
164
|
+
"debt_collection_x3",
|
|
165
|
+
"The company's debt collection information with Lương X3 product type",
|
|
166
|
+
{
|
|
167
|
+
company_name: z.string({ description: "Company name to get data" }),
|
|
168
|
+
},
|
|
169
|
+
async (args) => {
|
|
170
|
+
const { company_name } = args;
|
|
171
|
+
return debtCollectionRateTool({
|
|
172
|
+
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
173
|
+
companyName: company_name,
|
|
174
|
+
productType: PRODUCT_TYPE.X3,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
server.tool(
|
|
180
|
+
"debt_collection_x3",
|
|
181
|
+
"The company's debt collection information with Lương X3 - EVF product type",
|
|
182
|
+
{
|
|
183
|
+
company_name: z.string({ description: "Company name to get data" }),
|
|
184
|
+
},
|
|
185
|
+
async (args) => {
|
|
186
|
+
const { company_name } = args;
|
|
187
|
+
return debtCollectionRateTool({
|
|
188
|
+
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
189
|
+
companyName: company_name,
|
|
190
|
+
productType: PRODUCT_TYPE.X3_EVF,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
);
|
|
135
194
|
|
|
136
195
|
function bootstap() {
|
|
137
196
|
ensureEnvVariables();
|
package/src/test.ts
CHANGED
|
@@ -13,26 +13,23 @@ import {
|
|
|
13
13
|
} from "./tools";
|
|
14
14
|
import { debtCollectionRateTool } from "./tools/lark-tool";
|
|
15
15
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
16
|
+
import { PRODUCT_TYPE } from "./services/constants/product-type";
|
|
16
17
|
|
|
17
18
|
async function setupTest() {
|
|
18
19
|
ensureEnvVariables();
|
|
19
20
|
|
|
20
|
-
const mySchema = z
|
|
21
|
-
.object({
|
|
22
|
-
myString: z.string().min(5).optional(),
|
|
23
|
-
})
|
|
24
|
-
.describe("My neat object schema");
|
|
25
|
-
|
|
26
|
-
const res1 = zodToJsonSchema(mySchema);
|
|
27
|
-
console.log(res1);
|
|
28
|
-
|
|
29
21
|
// const r = await fetchDebtCollectionRecords();
|
|
30
22
|
// console.log(r.length);
|
|
31
23
|
|
|
32
24
|
// const compnay = "BGG";
|
|
33
25
|
// const month = "12/2025";
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
const res = await debtCollectionRateTool({
|
|
27
|
+
sendMessageToLark: true,
|
|
28
|
+
companyName: "Tkg",
|
|
29
|
+
// monthDate: "8/2025",
|
|
30
|
+
productType: PRODUCT_TYPE.X3_EVF,
|
|
31
|
+
});
|
|
32
|
+
console.log(res);
|
|
36
33
|
|
|
37
34
|
// const fieldNames = REPORT_COLUMS.map((item) => item.field_name);
|
|
38
35
|
// try {
|
package/src/tools/lark-tool.ts
CHANGED
|
@@ -17,8 +17,9 @@ export async function debtCollectionRateTool(options: {
|
|
|
17
17
|
sendMessageToLark: boolean;
|
|
18
18
|
companyName: string;
|
|
19
19
|
monthDate?: string;
|
|
20
|
+
productType?: string;
|
|
20
21
|
}): Promise<CallToolResult> {
|
|
21
|
-
const { sendMessageToLark, companyName, monthDate } = options;
|
|
22
|
+
const { sendMessageToLark, companyName, monthDate, productType } = options;
|
|
22
23
|
const monthParts = !monthDate ? null : extractMonth(monthDate);
|
|
23
24
|
// if (monthParts === null) {
|
|
24
25
|
// return { content: [{ type: "text", text: `${monthDate} is invalid` }] };
|
|
@@ -38,31 +39,38 @@ export async function debtCollectionRateTool(options: {
|
|
|
38
39
|
// console.log(companiesMatchName);
|
|
39
40
|
|
|
40
41
|
// Find by debt reduction month, search fully match
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
// Then find by product
|
|
43
|
+
const foundRecords = companiesMatchName
|
|
44
|
+
.filter((item) => {
|
|
45
|
+
if (monthParts === null) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
const { month } = monthParts;
|
|
49
|
+
return compareReductionDebtMonth(item.fields[debReductionMonthKey], month.toString());
|
|
50
|
+
})
|
|
51
|
+
.filter((item) => {
|
|
52
|
+
if (!productType) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return (item.fields[productKey] as string)?.toLowerCase() === productType.toLowerCase();
|
|
56
|
+
});
|
|
48
57
|
// const foundMonth = searchLike(
|
|
49
58
|
// month.toString(),
|
|
50
59
|
// companiesMatchName.map((item) => item.fields["KỲ LƯƠNG"])
|
|
51
60
|
// )[0];
|
|
52
|
-
console.log(
|
|
61
|
+
console.log(foundRecords);
|
|
53
62
|
// const finalCompnay = companiesMatchName.find((item) => item.fields["KỲ LƯƠNG"] === foundMonth);
|
|
54
63
|
// console.log(finalCompnay);
|
|
55
64
|
|
|
56
65
|
const messages: string[] = [];
|
|
57
|
-
for (const item of
|
|
66
|
+
for (const item of foundRecords) {
|
|
58
67
|
messages.push(
|
|
59
68
|
[
|
|
60
|
-
item.fields[
|
|
69
|
+
item.fields[debReductionMonthKey] || "N/A",
|
|
61
70
|
typeof item.fields[debtCollectionRateKey] === "undefined"
|
|
62
71
|
? "N/A"
|
|
63
72
|
: round(Number(item.fields[debtCollectionRateKey])) + "%",
|
|
64
73
|
item?.fields[statusKey]?.[0]?.text || "N/A",
|
|
65
|
-
|
|
66
74
|
].join(" | ")
|
|
67
75
|
);
|
|
68
76
|
// messages.push(
|
|
@@ -84,11 +92,11 @@ export async function debtCollectionRateTool(options: {
|
|
|
84
92
|
|
|
85
93
|
if (sendMessageToLark) {
|
|
86
94
|
await sendReportOpsGroup({
|
|
87
|
-
title:
|
|
95
|
+
title: ['Tỉ lệ thu nợ', foundName,productType].filter(Boolean).join(' - '),
|
|
88
96
|
message_content: messages.join("<hr>"),
|
|
89
97
|
});
|
|
90
98
|
}
|
|
91
|
-
return { content: [{ type: "text", text: JSON.stringify(
|
|
99
|
+
return { content: [{ type: "text", text: JSON.stringify(foundRecords) }] };
|
|
92
100
|
// console.log(finalCompnay);
|
|
93
101
|
} catch (e) {
|
|
94
102
|
return { content: [{ type: "text", text: JSON.stringify(e) }] };
|