ms-vite-plugin 1.4.49 → 1.4.51

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.
Files changed (42) hide show
  1. package/dist/build.js +1 -1
  2. package/dist/cli.js +1 -1
  3. package/dist/mcp/doc-tools.js +1 -1
  4. package/dist/mcp/docs-service.js +1 -1
  5. package/dist/mcp/types.d.ts +1 -1
  6. package/dist/mcp/types.js +1 -1
  7. package/dist/project.js +1 -1
  8. package/docs/AGENTS.md +3 -2
  9. package/docs/SKILL.md +2 -1
  10. package/docs/apilua/action.md +1013 -0
  11. package/docs/apilua/appleocr.md +281 -0
  12. package/docs/apilua/cloud.md +183 -0
  13. package/docs/apilua/config.md +181 -0
  14. package/docs/apilua/cryptoUtils.md +253 -0
  15. package/docs/apilua/device.md +485 -0
  16. package/docs/apilua/dotocr.md +230 -0
  17. package/docs/apilua/file.md +554 -0
  18. package/docs/apilua/global.md +654 -0
  19. package/docs/apilua/hid.md +1126 -0
  20. package/docs/apilua/hotUpdate.md +167 -0
  21. package/docs/apilua/http.md +427 -0
  22. package/docs/apilua/image.md +1177 -0
  23. package/docs/apilua/ime.md +283 -0
  24. package/docs/apilua/logger.md +294 -0
  25. package/docs/apilua/media.md +283 -0
  26. package/docs/apilua/mysql.md +445 -0
  27. package/docs/apilua/netCard.md +224 -0
  28. package/docs/apilua/node.md +264 -0
  29. package/docs/apilua/opencv.md +870 -0
  30. package/docs/apilua/paddleocr.md +324 -0
  31. package/docs/apilua/pip.md +359 -0
  32. package/docs/apilua/system.md +686 -0
  33. package/docs/apilua/tomatoocr.md +461 -0
  34. package/docs/apilua/tts.md +330 -0
  35. package/docs/apilua/ui.md +1033 -0
  36. package/docs/apilua/utils.md +222 -0
  37. package/docs/apilua/yolo.md +324 -0
  38. package/docs/apilua/yolocls.md +276 -0
  39. package/docs/mcp-agent-description.md +5 -4
  40. package/docs/quick/vscode/createProject.md +84 -0
  41. package/docs/quick/vscode/packProject.md +17 -0
  42. package/package.json +2 -1
@@ -0,0 +1,461 @@
1
+ # TomatoOCR 模块
2
+
3
+ TomatoOCR 模块提供基于 TomatoOCR 框架的文字识别和 YOLO 目标检测功能,支持多种识别模式和配置选项。
4
+
5
+ 该 ocr 为付费插件, 具体资费请联系https://www.52tomato.com, 如果购买请选择插件版-快点 JS-IOS
6
+
7
+ ## 功能概览
8
+
9
+ - **文字识别**: 支持多语言文字识别,包括中文、英文、数字、繁体、日语、韩语等
10
+ - **多种输入源**: 支持屏幕截图、文件路径、图像 ID 等多种输入方式
11
+ - **灵活配置**: 提供丰富的参数配置选项
12
+ - **点击点查找**: 根据文字内容查找可点击的位置
13
+
14
+ ## API 参考
15
+
16
+ ### 初始化方法
17
+
18
+ #### `initializeWithConfig`
19
+
20
+ 初始化 TomatoOCR 引擎并设置基本配置。
21
+
22
+ ```lua
23
+ ---@param mode string
24
+ ---@param licenseData string
25
+ ---@param remark string?
26
+ ---@return any
27
+ function initializeWithConfig(mode, licenseData, remark) end
28
+ ```
29
+
30
+ **参数:**
31
+
32
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
33
+ | ------------- | ------ | -------- | ------ | ------------------------------------------------------------------ |
34
+ | `mode` | string | 是 | | 运行模式,debug:调试模型;删除或传别的任何值为正式模式 |
35
+ | `licenseData` | string | 是 | | 授权码 请传入你在 TomatoOCR 官网申请的授权码 购买依赖版-IOS 后获取 |
36
+ | `remark` | string | 否 | | 备注信息 |
37
+
38
+ **返回值:**
39
+
40
+ - 成功时返回包含设备信息的对象,失败时返回 nil
41
+
42
+ | 参数名 | 类型 | 描述 |
43
+ | ------------- | ------ | -------- |
44
+ | `deviceId` | string | 设备 ID |
45
+ | `expiryTime` | string | 过期时间 |
46
+ | `message` | string | 消息 |
47
+ | `status` | string | 状态 |
48
+ | `versionName` | string | 版本名称 |
49
+
50
+ **示例:**
51
+
52
+ ```lua
53
+ local tomatoocr = require("tomatoocr")
54
+ -- 不带备注
55
+ local result1 = tomatoocr.initializeWithConfig(
56
+ "online",
57
+ "请传入你在 TomatoOCR 官网申请的授权码"
58
+ )
59
+ -- 带备注
60
+ local result2 = tomatoocr.initializeWithConfig(
61
+ "online",
62
+ "请传入你在 TomatoOCR 官网申请的授权码",
63
+ "测试环境"
64
+ )
65
+ print("结果1: " .. tostring(ToJsonString(result1)) .. ", 结果2: " .. tostring(ToJsonString(result2)))
66
+ ```
67
+
68
+ ### 配置方法
69
+
70
+ #### `setHttpIntervalTime`
71
+
72
+ 设置 HTTP 请求间隔时间。
73
+
74
+ ```lua
75
+ ---@param second number
76
+ function setHttpIntervalTime(second) end
77
+ ```
78
+
79
+ **参数:**
80
+
81
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
82
+ | -------- | ------ | -------- | ------ | ------------------------------------------------- |
83
+ | `second` | number | 是 | | 间隔秒数,设置网络请求间隔时间,非必设置。0-86400 |
84
+
85
+ **示例:**
86
+
87
+ ```lua
88
+ local tomatoocr = require("tomatoocr")
89
+ tomatoocr.setHttpIntervalTime(3600)
90
+ ```
91
+
92
+ #### `setRecType`
93
+
94
+ 设置识别类型。
95
+
96
+ ```lua
97
+ ---@param recType string
98
+ function setRecType(recType) end
99
+ ```
100
+
101
+ **参数:**
102
+
103
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
104
+ | --------- | ------ | -------- | ------ | ---------------------------------------------------------------------------------- |
105
+ | `recType` | string | 是 | | 识别类型,模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number |
106
+
107
+ **示例:**
108
+
109
+ ```lua
110
+ local tomatoocr = require("tomatoocr")
111
+ -- 普通中英文识别,3.0版模型
112
+ tomatoocr.setRecType("ch-3.0")
113
+ -- 普通中英文识别,2.0版模型
114
+ tomatoocr.setRecType("ch-2.0")
115
+ -- 普通中英文识别,1.0版模型
116
+ tomatoocr.setRecType("ch")
117
+ -- 繁体
118
+ tomatoocr.setRecType("cht")
119
+ -- 日语
120
+ tomatoocr.setRecType("japan")
121
+ -- 韩语
122
+ tomatoocr.setRecType("korean")
123
+ -- 数字模型
124
+ tomatoocr.setRecType("number")
125
+ ```
126
+
127
+ #### `setDetBoxType`
128
+
129
+ 设置检测框类型。
130
+
131
+ ```lua
132
+ ---@param detBoxType string
133
+ function setDetBoxType(detBoxType) end
134
+ ```
135
+
136
+ **参数:**
137
+
138
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
139
+ | ------------ | ------ | -------- | ------ | ---------------------------------------------------------------------------------- |
140
+ | `detBoxType` | string | 是 | | 检测框类型,默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本 |
141
+
142
+ **示例:**
143
+
144
+ ```lua
145
+ local tomatoocr = require("tomatoocr")
146
+ -- 矩形文本
147
+ tomatoocr.setDetBoxType("rect")
148
+ -- 倾斜文本
149
+ tomatoocr.setDetBoxType("quad")
150
+ ```
151
+
152
+ #### `setDetScaleRatio`
153
+
154
+ 设置输入图片缩放大小的参数,非必设置,默认为 1.0。值范围 0.1-10.0 之间,如果图太小,可能出现检测不到的情况,则尝试放大图片,如设置 2.0;如果图太大,可能出现检测不到一起的情况,则尝试缩小图片,如设置 0.5
155
+
156
+ ```lua
157
+ ---@param detScaleRatio number
158
+ function setDetScaleRatio(detScaleRatio) end
159
+ ```
160
+
161
+ **参数:**
162
+
163
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
164
+ | --------------- | ------ | -------- | ------ | -------------- |
165
+ | `detScaleRatio` | number | 是 | | 检测框缩放比例 |
166
+
167
+ **示例:**
168
+
169
+ ```lua
170
+ local tomatoocr = require("tomatoocr")
171
+ tomatoocr.setDetScaleRatio(0.5)
172
+ ```
173
+
174
+ #### `setDetUnclipRatio`
175
+
176
+ 设置检测框展开比例。
177
+
178
+ ```lua
179
+ ---@param detUnclipRatio number
180
+ function setDetUnclipRatio(detUnclipRatio) end
181
+ ```
182
+
183
+ **参数:**
184
+
185
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
186
+ | ---------------- | ------ | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
187
+ | `detUnclipRatio` | number | 是 | | 设置检测模型框选文本范围大小的参数,非必设置,默认为 1.9。值范围 1.6-2.5 之间,值越大框选范围越大,值越小框选范围越小;当框选到了,但识别得分较低,就可以调整该参数改善准确率。 |
188
+
189
+ **示例:**
190
+
191
+ ```lua
192
+ local tomatoocr = require("tomatoocr")
193
+ tomatoocr.setDetUnclipRatio(1.9)
194
+ ```
195
+
196
+ #### `setRecScoreThreshold`
197
+
198
+ 设置识别分数阈值。
199
+
200
+ ```lua
201
+ ---@param recScoreThreshold number
202
+ function setRecScoreThreshold(recScoreThreshold) end
203
+ ```
204
+
205
+ **参数:**
206
+
207
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
208
+ | ------------------- | ------ | -------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
209
+ | `recScoreThreshold` | number | 是 | | 设置识别模型过滤得分的参数,非必设置,默认 0.1。由于返回的识别结果数据太多太乱,可以通过设置该参数,过滤一些得分较低不准的数据,使得结果看起来更加简练。 |
210
+
211
+ **示例:**
212
+
213
+ ```lua
214
+ local tomatoocr = require("tomatoocr")
215
+ tomatoocr.setRecScoreThreshold(0.1)
216
+ ```
217
+
218
+ #### `setReturnType`
219
+
220
+ 设置返回类型。
221
+
222
+ ```lua
223
+ ---@param returnType string
224
+ function setReturnType(returnType) end
225
+ ```
226
+
227
+ **参数:**
228
+
229
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
230
+ | ------------ | ------ | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
231
+ | `returnType` | string | 是 | | 设置调用插件识别返回格式的参数,非必设置,默认为 json。默认"json": 包含得分、坐标和文字;"text":纯文字;"num":纯数字;自定义输入想要返回的文本:".¥ 1234567890",仅只返回这些内容 |
232
+
233
+ **示例:**
234
+
235
+ ```lua
236
+ local tomatoocr = require("tomatoocr")
237
+ tomatoocr.setReturnType("json")
238
+ ```
239
+
240
+ #### `setBinaryThresh`
241
+
242
+ 设置二值化阈值。
243
+
244
+ ```lua
245
+ ---@param binaryThresh number
246
+ function setBinaryThresh(binaryThresh) end
247
+ ```
248
+
249
+ **参数:**
250
+
251
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
252
+ | -------------- | ------ | -------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
253
+ | `binaryThresh` | number | 是 | | 设置图像二值化的参数,非必设置,默认 0,不进行二值化。二值化设定 0-255,常规情况下不需要设置,可配合中调试应用使用。 |
254
+
255
+ **示例:**
256
+
257
+ ```lua
258
+ local tomatoocr = require("tomatoocr")
259
+ tomatoocr.setBinaryThresh(0)
260
+ ```
261
+
262
+ #### `setRunMode`
263
+
264
+ 设置运行模式。
265
+
266
+ ```lua
267
+ ---@param runMode string
268
+ function setRunMode(runMode) end
269
+ ```
270
+
271
+ **参数:**
272
+
273
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
274
+ | --------- | ------ | -------- | ------ | ---------------------------------------------------- |
275
+ | `runMode` | string | 是 | | 运行模式,默认"fast": 快速模式;"accurate":准确模式 |
276
+
277
+ **示例:**
278
+
279
+ ```lua
280
+ local tomatoocr = require("tomatoocr")
281
+ tomatoocr.setRunMode("fast")
282
+ ```
283
+
284
+ #### `setFilterColor`
285
+
286
+ 设置图像滤色参数。
287
+
288
+ ```lua
289
+ ---@param filterColor string
290
+ ---@param backgroundColor string
291
+ function setFilterColor(filterColor, backgroundColor) end
292
+ ```
293
+
294
+ **参数:**
295
+
296
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
297
+ | ----------------- | ------ | -------- | ------ | -------------------------------------------------------------------------------------------------- |
298
+ | `filterColor` | string | 是 | \_ | 颜色过滤,通过逗号相互连,第一个是颜色值,第二个是负偏色,第三个是正偏色;不同颜色之间以" \| "连接 |
299
+ | `backgroundColor` | string | 是 | \_ | 滤色后的背景色,传""或 black 的时候,背景是黑色,传"white"的时候,背景是白色 |
300
+
301
+ **示例:**
302
+
303
+ ```lua
304
+ local tomatoocr = require("tomatoocr")
305
+ tomatoocr.setFilterColor("#41917A,38,38", "black")
306
+ tomatoocr.setFilterColor("#41917A,38,38|#E091A8,50,50", "white")
307
+ ```
308
+
309
+ ### OCR 识别方法
310
+
311
+ #### `ocrImage`
312
+
313
+ 对图像执行 OCR 识别。
314
+
315
+ ```lua
316
+ ---@param input string
317
+ ---@param type number
318
+ ---@param x number
319
+ ---@param y number
320
+ ---@param ex number
321
+ ---@param ey number
322
+ ---@return string
323
+ function ocrImage(input, type, x, y, ex, ey) end
324
+ ```
325
+
326
+ **参数:**
327
+
328
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
329
+ | ------- | ------ | -------- | ------ | ----------------------------------------------------------------------------------- |
330
+ | `input` | string | 是 | | 输入源(imageId、URL 字符串、文件路径或"screen") |
331
+ | `type` | number | 是 | | 识别类型,默认 3: 检测 + 识别;0: 只检测;1: 方向分类+识别;2: 只识别;3: 检测+识别 |
332
+ | `x` | number | 是 | | 边界框左上角 x 坐标 |
333
+ | `y` | number | 是 | | 边界框左上角 y 坐标 |
334
+ | `ex` | number | 是 | | 边界框右下角 x 坐标 |
335
+ | `ey` | number | 是 | | 边界框右下角 y 坐标 |
336
+
337
+ **返回值:**
338
+
339
+ | 类型 | 描述 |
340
+ | -------- | ------------------------ |
341
+ | `string` | OCR 识别结果 JSON 字符串 |
342
+
343
+ **示例:**
344
+
345
+ ```lua
346
+ local tomatoocr = require("tomatoocr")
347
+ -- 识别屏幕
348
+ local result1 = tomatoocr.ocrImage("screen", 0, 0, 0, 0, 0)
349
+ print("识别屏幕结果:" .. tostring(result1))
350
+ -- 识别文件
351
+ local result2 = tomatoocr.ocrImage("/path/to/image.png", 0, 0, 0, 0, 0)
352
+ print("识别文件结果:" .. tostring(result2))
353
+ -- 识别指定屏幕区域
354
+ local result3 = tomatoocr.ocrImage("screen", 0, 100, 500, 300)
355
+ print("识别指定屏幕区域结果:" .. tostring(result3))
356
+ ```
357
+
358
+ ### 点击点查找方法
359
+
360
+ #### `findTapPoint`
361
+
362
+ 查找点击点。
363
+
364
+ ```lua
365
+ ---@param data string
366
+ ---@return string
367
+ function findTapPoint(data) end
368
+ ```
369
+
370
+ **参数:**
371
+
372
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
373
+ | ------ | ------ | -------- | ------ | ---------- |
374
+ | `data` | string | 是 | | 要找的文字 |
375
+
376
+ **返回值:**
377
+
378
+ | 类型 | 描述 |
379
+ | -------- | ------------------------------------------- |
380
+ | `string` | 找"要找的文字"的中心点 没有找到返回空字符串 |
381
+
382
+ **示例:**
383
+
384
+ ```lua
385
+ local tomatoocr = require("tomatoocr")
386
+ local result = tomatoocr.findTapPoint(“确定”)
387
+ print(result)
388
+ ```
389
+
390
+ #### `findTapPoints`
391
+
392
+ 查找多个点击点。
393
+
394
+ ```lua
395
+ ---@param data string
396
+ ---@return string
397
+ function findTapPoints(data) end
398
+ ```
399
+
400
+ **参数:**
401
+
402
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
403
+ | ------ | ------ | -------- | ------ | ---------- |
404
+ | `data` | string | 是 | | 要找的文字 |
405
+
406
+ **返回值:**
407
+
408
+ | 类型 | 描述 |
409
+ | -------- | ------------------------------------------------------- |
410
+ | `string` | 找"要找的文字"的所有相匹配的中心点 没有找到返回空字符串 |
411
+
412
+ **示例:**
413
+
414
+ ```lua
415
+ local tomatoocr = require("tomatoocr")
416
+ local result = tomatoocr.findTapPoints(“确定”)
417
+ print(result)
418
+ ```
419
+
420
+ #### `release`
421
+
422
+ 释放 TomatoOCR SDK 已加载的 OCR 模型和内部资源。
423
+
424
+ ```lua
425
+ function release() end
426
+ ```
427
+
428
+ **示例:**
429
+
430
+ ```lua
431
+ local tomatoocr = require("tomatoocr")
432
+ tomatoocr.release()
433
+ ```
434
+
435
+ ## 完整示例
436
+
437
+ ```lua
438
+ local tomatoocr = require("tomatoocr")
439
+ -- 初始化 TomatoOCR 并设置基本配置
440
+ local initResult = tomatoocr.initializeWithConfig(
441
+ "online",
442
+ "请传入你在 TomatoOCR 官网申请的授权码",
443
+ "测试环境" -- 可选备注
444
+ )
445
+ print("初始化结果:" + ToJsonString(initResult))
446
+ -- 配置其他参数
447
+ tomatoocr.setRecType("ch-3.0")
448
+ -- 执行 OCR 识别
449
+ local ocrResult = tomatoocr.ocrImage("screen", 3, 0, 0, 0, 0); -- 识别当前屏幕
450
+ print("识别结果:" + ocrResult)
451
+ -- 查找点击点
452
+ local tapResult = tomatoocr.findTapPoint("登录")
453
+ print("点击点坐标:" + tapResult)
454
+ -- 释放 TomatoOCR 资源
455
+ tomatoocr.release()
456
+ ```
457
+
458
+ ## 注意事项
459
+
460
+ 1. **参数配置**: 根据实际需求调整各种阈值和配置参数
461
+ 2. **错误处理**: 建议对返回的 JSON 结果进行错误检查