ms-vite-plugin 1.4.10 → 1.4.12

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,269 @@
1
+ # YOLO 图像分类模块 (yolocls)
2
+
3
+ YOLO 图像分类模块基于 YOLOv8-cls / YOLO11-cls / YOLO26-cls 分类模型和 NCNN 框架,提供整图分类、区域分类和模型资源管理能力。
4
+
5
+ ## 功能概览
6
+
7
+ - **模型管理**: 加载和释放 YOLOv8-cls / YOLO11-cls / YOLO26-cls NCNN 模型
8
+ - **图像分类**: 对屏幕截图、图片文件、HTTP 图片或图片 ID 执行整图分类
9
+ - **区域分类**: 先裁剪指定区域,再对裁剪结果执行分类
10
+ - **结果处理**: 返回 Ultralytics `Probs` 风格的完整概率、top1、top5 和对应置信度
11
+ - **资源控制**: 支持释放单个模型或释放全部已加载模型
12
+
13
+ ## 适用场景
14
+
15
+ - 判断当前屏幕或图片属于哪个业务类别
16
+ - 对截图中的固定区域进行状态识别
17
+ - 对自定义 YOLO-cls 模型导出的 NCNN 模型执行端侧推理
18
+
19
+ ## 数据结构
20
+
21
+ ### YoloClsProbs
22
+
23
+ YOLO 分类概率结果字典,字段命名与 Ultralytics `Probs` 保持一致。
24
+
25
+ ```python
26
+ from typing import List, Optional, TypedDict
27
+
28
+ class YoloClsProbs(TypedDict):
29
+ data: List[float] # 所有类别概率,下标即类别 ID
30
+ top1: Optional[int] # 概率最高的类别 ID
31
+ top5: List[int] # 概率最高的 5 个类别 ID
32
+ top1conf: Optional[float] # top1 对应的概率
33
+ top5conf: List[float] # top5 对应的概率
34
+ ```
35
+
36
+ **字段说明:**
37
+
38
+ | 字段名 | 类型 | 描述 |
39
+ | ---------- | --------------------- | ---------------------------------------------------------- |
40
+ | `data` | `List[float]` | 所有类别概率数组,下标即类别 ID |
41
+ | `top1` | `Optional[int]` | 概率最高的类别 ID;分类失败时为 `None` |
42
+ | `top5` | `List[int]` | 概率最高的 5 个类别 ID,按概率从高到低排序 |
43
+ | `top1conf` | `Optional[float]` | `top1` 对应的概率;分类失败时为 `None` |
44
+ | `top5conf` | `List[float]` | `top5` 对应的概率,顺序与 `top5` 一致 |
45
+
46
+ **结果说明:**
47
+
48
+ - `top1` 等于 `top5[0]`,`top1conf` 等于 `data[top1]`。
49
+ - 当模型类别数少于 5 时,`top5` 和 `top5conf` 的长度会小于 5。
50
+ - 分类失败时返回空结果:`data`、`top5`、`top5conf` 为空列表,`top1` 和 `top1conf` 为 `None`。
51
+
52
+ ## API 参考
53
+
54
+ ### 模型管理
55
+
56
+ #### load - 加载 YOLO 分类模型(支持 YOLOv8-cls / YOLO11-cls / YOLO26-cls)
57
+
58
+ 加载模型是使用图像分类能力的前提。支持 Ultralytics 官方 YOLOv8-cls、YOLO11-cls、YOLO26-cls 导出的 NCNN 分类模型,常见模型名使用 `-cls` 后缀,例如 `yolov8n-cls`、`yolo11n-cls`、`yolo26n-cls`。
59
+
60
+ ```python
61
+ def load(
62
+ paramPath: str,
63
+ binPath: str,
64
+ nc: int = 0,
65
+ useGpu: bool = False
66
+ ) -> Optional[str]
67
+ ```
68
+
69
+ **参数:**
70
+
71
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
72
+ | ----------- | ---- | -------- | ------ | ----------------------------------------- |
73
+ | `paramPath` | str | 是 | - | NCNN 模型的 param 文件路径 |
74
+ | `binPath` | str | 是 | - | NCNN 模型的 bin 文件路径 |
75
+ | `nc` | int | 否 | 0 | 模型类别数量;传 `0` 或省略时按模型输出自动推断,显式传入但不匹配时分类返回空结果 |
76
+ | `useGpu` | bool | 否 | False | 是否使用 GPU 推理 |
77
+
78
+ **返回值:**
79
+
80
+ | 类型 | 描述 |
81
+ | ------------- | ------------------------------------ |
82
+ | `str \| None` | 加载成功返回模型 ID,失败返回 `None` |
83
+
84
+ **示例:**
85
+
86
+ ```python
87
+ from kuaijs import yolocls
88
+
89
+ # 模型文件通常放在 res 目录
90
+ model_id = yolocls.load(
91
+ "yolo11n_cls_ncnn_model/model.ncnn.param",
92
+ "yolo11n_cls_ncnn_model/model.ncnn.bin",
93
+ 1000, # ImageNet 分类模型通常为 1000 类
94
+ False,
95
+ )
96
+
97
+ if model_id:
98
+ print(f"YOLO 分类模型加载成功,ID: {model_id}")
99
+ else:
100
+ print("YOLO 分类模型加载失败,请检查模型文件路径和格式")
101
+ ```
102
+
103
+ ### 图像分类
104
+
105
+ #### classify - 对输入图像执行分类
106
+
107
+ 对整张输入图像执行分类,返回完整概率数组和 top1/top5 结果。
108
+
109
+ ```python
110
+ def classify(
111
+ modelId: str,
112
+ img: str,
113
+ targetSize: int = 224
114
+ ) -> YoloClsProbs
115
+ ```
116
+
117
+ **参数:**
118
+
119
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
120
+ | ------------ | ---- | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
121
+ | `modelId` | str | 是 | - | 模型 ID(通过 `load` 获取) |
122
+ | `img` | str | 是 | - | 图像输入源:<br>- `"screen"` - 使用当前屏幕截图<br>- `str` - 图片文件路径或 HTTP 图片地址<br>- `imageId` - 图片 ID(通过 image 模块获取) |
123
+ | `targetSize` | int | 否 | 224 | 分类输入大小,应与模型训练或导出时的输入尺寸一致 |
124
+
125
+ **返回值:**
126
+
127
+ | 类型 | 描述 |
128
+ | -------------- | --------------------------------------------------- |
129
+ | `YoloClsProbs` | Ultralytics `Probs` 风格分类结果,包含 top1/top5 等 |
130
+
131
+ **示例:**
132
+
133
+ ```python
134
+ from kuaijs import yolocls
135
+
136
+ model_id = yolocls.load(
137
+ "yolo11n_cls_ncnn_model/model.ncnn.param",
138
+ "yolo11n_cls_ncnn_model/model.ncnn.bin",
139
+ 1000,
140
+ False,
141
+ )
142
+
143
+ if not model_id:
144
+ print("模型加载失败")
145
+ else:
146
+ probs = yolocls.classify(
147
+ model_id,
148
+ "screen", # 使用当前屏幕
149
+ 224 # 分类模型常用输入尺寸
150
+ )
151
+
152
+ if probs["top1"] is not None:
153
+ print(f"top1 类别ID: {probs['top1']}")
154
+ print(f"top1 置信度: {round(probs['top1conf'] * 100, 2)}%")
155
+ else:
156
+ print("分类失败或无有效结果")
157
+
158
+ for i, class_id in enumerate(probs["top5"]):
159
+ conf = probs["top5conf"][i]
160
+ print(f"top{i + 1}: 类别ID={class_id}, 置信度={round(conf, 4)}")
161
+
162
+ # 如需读取某个类别的原始概率,可直接访问 data[class_id]
163
+ class_id = 0
164
+ if len(probs["data"]) > class_id:
165
+ print(f"类别 {class_id} 概率: {round(probs['data'][class_id], 4)}")
166
+
167
+ yolocls.free(model_id)
168
+ ```
169
+
170
+ #### classifyRegion - 对指定区域执行分类
171
+
172
+ 先从输入图像中裁剪指定区域,再对裁剪结果执行分类。适合只关心屏幕某个固定区域状态的场景。
173
+
174
+ ```python
175
+ def classifyRegion(
176
+ modelId: str,
177
+ img: str,
178
+ x: int = 0,
179
+ y: int = 0,
180
+ ex: int = 0,
181
+ ey: int = 0,
182
+ targetSize: int = 224
183
+ ) -> YoloClsProbs
184
+ ```
185
+
186
+ **参数:**
187
+
188
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
189
+ | ------------ | ---- | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
190
+ | `modelId` | str | 是 | - | 模型 ID(通过 `load` 获取) |
191
+ | `img` | str | 是 | - | 图像输入源:<br>- `"screen"` - 使用当前屏幕截图<br>- `str` - 图片文件路径或 HTTP 图片地址<br>- `imageId` - 图片 ID(通过 image 模块获取) |
192
+ | `x` | int | 否 | 0 | 裁剪区域左上角 x 坐标 |
193
+ | `y` | int | 否 | 0 | 裁剪区域左上角 y 坐标 |
194
+ | `ex` | int | 否 | 0 | 裁剪区域右下角 x 坐标 |
195
+ | `ey` | int | 否 | 0 | 裁剪区域右下角 y 坐标 |
196
+ | `targetSize` | int | 否 | 224 | 分类输入大小,应与模型训练或导出时的输入尺寸一致 |
197
+
198
+ **返回值:**
199
+
200
+ | 类型 | 描述 |
201
+ | -------------- | --------------------------------------------------- |
202
+ | `YoloClsProbs` | Ultralytics `Probs` 风格分类结果,包含 top1/top5 等 |
203
+
204
+ **示例:**
205
+
206
+ ```python
207
+ region_probs = yolocls.classifyRegion(
208
+ model_id,
209
+ "screen",
210
+ 100,
211
+ 100,
212
+ 500,
213
+ 400,
214
+ 224,
215
+ )
216
+
217
+ if region_probs["top1"] is not None:
218
+ print(
219
+ f"区域分类 top1={region_probs['top1']}, "
220
+ f"置信度={round(region_probs['top1conf'], 4)}"
221
+ )
222
+ ```
223
+
224
+ ### 资源管理
225
+
226
+ #### free - 释放指定模型
227
+
228
+ 释放指定分类模型占用的资源。
229
+
230
+ ```python
231
+ def free(modelId: str) -> None
232
+ ```
233
+
234
+ **参数:**
235
+
236
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
237
+ | --------- | ---- | -------- | ------ | --------------- |
238
+ | `modelId` | str | 是 | - | 要释放的模型 ID |
239
+
240
+ **示例:**
241
+
242
+ ```python
243
+ if model_id:
244
+ yolocls.free(model_id)
245
+ print(f"YOLO 分类模型 {model_id} 资源已释放")
246
+ ```
247
+
248
+ #### freeAll - 释放所有模型
249
+
250
+ 释放所有已加载的 YOLO 分类模型资源。
251
+
252
+ ```python
253
+ def freeAll() -> None
254
+ ```
255
+
256
+ **示例:**
257
+
258
+ ```python
259
+ yolocls.freeAll()
260
+ print("所有 YOLO 分类模型资源已释放")
261
+ ```
262
+
263
+ ## 使用注意事项
264
+
265
+ - `targetSize` 默认值为 224,常见 YOLO-cls 模型使用该尺寸;自定义模型请填写训练或导出时使用的输入尺寸。
266
+ - `nc` 传 `0` 或省略时会根据模型输出自动推断类别数量;显式传入但和模型输出不匹配时返回空结果。
267
+ - `classifyRegion` 中 `x/y/ex/ey` 全部为 `0` 时表示不裁剪,直接对整张图分类。
268
+ - 裁剪区域必须位于图像范围内,并且 `ex > x`、`ey > y`。
269
+ - 分类结果中的类别 ID 需要结合训练时的类别列表解释;本模块只返回类别 ID 和概率。
@@ -157,8 +157,9 @@ GET /api/source
157
157
 
158
158
  | 名称 | 位置 | 类型 | 必选 | 说明 |
159
159
  | --------- | ----- | ------- | ---- | ------------------ |
160
- | max_depth | query | integer | 是 | 页面深度 |
160
+ | max_depth | query | integer | 是 | 页面深度,值越小快照成本越低 |
161
161
  | timeout | query | integer | 是 | 超时时间(单位秒) |
162
+ | mode | query | integer | 否 | 抓取模式。模式 1、模式 2,默认模式 1 |
162
163
 
163
164
  > 返回示例
164
165
 
@@ -931,6 +932,49 @@ GET /logger/download
931
932
 
932
933
  ### 返回数据结构
933
934
 
935
+ ## GET 当前日志最新行
936
+
937
+ GET /logger/current/lines
938
+
939
+ 读取 LoggerModule 当前已创建日志文件中已经写入的最新输出行。单次最多返回 5000 行,超出时按 5000 行处理。接口不会刷新当前日志缓冲区,也不会强制日志落盘,返回的 `lines` 按日志原始输出顺序排列。
940
+
941
+ ### 请求参数
942
+
943
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
944
+ | ----- | ----- | ------- | ---- | ------ | ------------------- |
945
+ | count | query | integer | 否 | 行数 | 默认 100,最大 5000 |
946
+
947
+ > 返回示例
948
+
949
+ > 200 Response
950
+
951
+ ```json
952
+ {
953
+ "lines": [
954
+ "string",
955
+ "string"
956
+ ],
957
+ "hasMore": true
958
+ }
959
+ ```
960
+
961
+ ### 返回结果
962
+
963
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
964
+ | ------ | ---------------------------------------------------------------- | ------------------ | -------- |
965
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
966
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数不合法 | Inline |
967
+ | 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | 当前日志文件不存在 | Inline |
968
+
969
+ ### 返回数据结构
970
+
971
+ 状态码 **200**
972
+
973
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
974
+ | --------- | -------- | ---- | ---- | ------------ | -------------------------- |
975
+ | » lines | string[] | true | none | 日志行 | 最新日志行,按旧到新排列 |
976
+ | » hasMore | boolean | true | none | 是否还有更多 | 本次范围前是否还有更早日志 |
977
+
934
978
  # Api/输入法接口
935
979
 
936
980
  ## GET API键盘是否弹出
@@ -2644,6 +2688,245 @@ GET /api/media/deleteAllScreenshots
2644
2688
  | --------- | ------- | ---- | ---- | -------- | ---- |
2645
2689
  | » success | boolean | true | none | 是否成功 | none |
2646
2690
 
2691
+ ## POST 上传文件到沙盒目录
2692
+
2693
+ POST /api/file/upload
2694
+
2695
+ ### 请求参数
2696
+
2697
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
2698
+ | ------- | ----- | -------------- | ---- | -------- | ---- |
2699
+ | dirType | query | string | 是 | 目录类型 | 支持 `temp`、`documents` |
2700
+ | path | query | string | 是 | 路径 | 目标文件路径。支持 `/foo.bin` 或 `foo.bin`,会拼接到所选目录下 |
2701
+ | body | body | string(binary) | 是 | 文件内容 | 文件原始二进制数据,不是 multipart |
2702
+
2703
+ ### 请求体
2704
+
2705
+ 请求体为文件原始二进制数据。接口会流式写入所选沙盒目录,父目录不存在时会自动创建。
2706
+
2707
+ > 返回示例
2708
+
2709
+ > 200 Response
2710
+
2711
+ ```json
2712
+ {
2713
+ "success": true,
2714
+ "data": "/private/var/mobile/Containers/Data/Application/.../tmp/foo.bin"
2715
+ }
2716
+ ```
2717
+
2718
+ ### 返回结果
2719
+
2720
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2721
+ | ------ | ---------------------------------------------------------------- | -------------- | -------- |
2722
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
2723
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数或上传失败 | Inline |
2724
+ | 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
2725
+
2726
+ ### 返回数据结构
2727
+
2728
+ 状态码 **200**
2729
+
2730
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
2731
+ | --------- | ------- | ---- | ---- | -------- | ------------------------------ |
2732
+ | » success | boolean | true | none | 是否成功 | none |
2733
+ | » data | string | true | none | 完整路径 | 上传后的设备沙盒内完整文件路径 |
2734
+
2735
+ ## GET 查询沙盒文件是否存在
2736
+
2737
+ GET /api/file/exists
2738
+
2739
+ ### 请求参数
2740
+
2741
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
2742
+ | ------- | ----- | ------ | ---- | -------- | ---- |
2743
+ | dirType | query | string | 是 | 目录类型 | 支持 `temp`、`documents` |
2744
+ | path | query | string | 是 | 路径 | 目标文件路径。支持 `/foo.bin` 或 `foo.bin`,会拼接到所选目录下 |
2745
+
2746
+ > 返回示例
2747
+
2748
+ > 200 Response
2749
+
2750
+ ```json
2751
+ {
2752
+ "success": true,
2753
+ "data": {
2754
+ "exists": true
2755
+ }
2756
+ }
2757
+ ```
2758
+
2759
+ ### 返回结果
2760
+
2761
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2762
+ | ------ | ---------------------------------------------------------------- | ---------- | -------- |
2763
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
2764
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数不合法 | Inline |
2765
+ | 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
2766
+
2767
+ ### 返回数据结构
2768
+
2769
+ 状态码 **200**
2770
+
2771
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
2772
+ | ---------- | ------- | ----- | ---- | ------------ | ------------------------------------- |
2773
+ | » success | boolean | true | none | 是否成功 | none |
2774
+ | » data | object | true | none | 文件状态 | none |
2775
+ | »» exists | boolean | true | none | 文件是否存在 | 只判断文件,目录不算存在 |
2776
+
2777
+ ## GET 删除沙盒文件
2778
+
2779
+ GET /api/file/delete
2780
+
2781
+ ### 请求参数
2782
+
2783
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
2784
+ | ------- | ----- | ------ | ---- | -------- | ---- |
2785
+ | dirType | query | string | 是 | 目录类型 | 支持 `temp`、`documents` |
2786
+ | path | query | string | 是 | 路径 | 目标文件路径。支持 `/foo.bin` 或 `foo.bin`,会拼接到所选目录下 |
2787
+
2788
+ > 返回示例
2789
+
2790
+ > 200 Response
2791
+
2792
+ ```json
2793
+ {
2794
+ "success": true
2795
+ }
2796
+ ```
2797
+
2798
+ ### 返回结果
2799
+
2800
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2801
+ | ------ | ---------------------------------------------------------------- | -------------------- | -------- |
2802
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
2803
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数不合法或目标不是文件 | Inline |
2804
+ | 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
2805
+ | 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | 文件不存在 | Inline |
2806
+
2807
+ ### 返回数据结构
2808
+
2809
+ 状态码 **200**
2810
+
2811
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
2812
+ | --------- | ------- | ---- | ---- | -------- | ---- |
2813
+ | » success | boolean | true | none | 是否成功 | none |
2814
+
2815
+ ## GET 列出沙盒目录
2816
+
2817
+ GET /api/file/list
2818
+
2819
+ ### 请求参数
2820
+
2821
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
2822
+ | ------- | ----- | ------ | ---- | -------- | ---- |
2823
+ | dirType | query | string | 是 | 目录类型 | 支持 `temp`、`documents` |
2824
+ | path | query | string | 否 | 路径 | 起始目录路径。空值表示所选根目录;支持 `/foo` 或 `foo`,会拼接到所选目录下 |
2825
+
2826
+ > 返回示例
2827
+
2828
+ > 200 Response
2829
+
2830
+ ```json
2831
+ {
2832
+ "success": true,
2833
+ "data": [
2834
+ {
2835
+ "name": "foo",
2836
+ "path": "foo",
2837
+ "isDirectory": true,
2838
+ "size": 0
2839
+ },
2840
+ {
2841
+ "name": "bar.txt",
2842
+ "path": "foo/bar.txt",
2843
+ "isDirectory": false,
2844
+ "size": 12
2845
+ }
2846
+ ]
2847
+ }
2848
+ ```
2849
+
2850
+ ### 返回结果
2851
+
2852
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2853
+ | ------ | ---------------------------------------------------------------- | ---------- | -------- |
2854
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
2855
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数不合法 | Inline |
2856
+ | 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
2857
+ | 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | 目录不存在 | Inline |
2858
+
2859
+ ### 返回数据结构
2860
+
2861
+ 状态码 **200**
2862
+
2863
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
2864
+ | --------------- | ------- | ---- | ---- | -------- | ---- |
2865
+ | » success | boolean | true | none | 是否成功 | none |
2866
+ | » data | array | true | none | 目录列表 | none |
2867
+ | »» name | string | true | none | 名称 | 文件或目录名 |
2868
+ | »» path | string | true | none | 相对路径 | 相对所选根目录的路径 |
2869
+ | »» isDirectory | boolean | true | none | 是否目录 | none |
2870
+ | »» size | integer | true | none | 文件大小 | 文件字节数,目录返回 0;结果包含起始目录下所有后代路径 |
2871
+
2872
+ ## GET 删除沙盒目录
2873
+
2874
+ GET /api/file/deleteDir
2875
+
2876
+ ### 请求参数
2877
+
2878
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
2879
+ | ------- | ----- | ------ | ---- | -------- | ---- |
2880
+ | dirType | query | string | 是 | 目录类型 | 支持 `temp`、`documents` |
2881
+ | path | query | string | 是 | 路径 | 目录路径。支持 `/foo` 或 `foo`,会拼接到所选目录下 |
2882
+
2883
+ > 返回示例
2884
+
2885
+ > 200 Response
2886
+
2887
+ ```json
2888
+ {
2889
+ "success": true
2890
+ }
2891
+ ```
2892
+
2893
+ ### 返回结果
2894
+
2895
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2896
+ | ------ | ---------------------------------------------------------------- | ---------- | -------- |
2897
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
2898
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数不合法 | Inline |
2899
+ | 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
2900
+ | 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | 目录不存在 | Inline |
2901
+
2902
+ ### 返回数据结构
2903
+
2904
+ 状态码 **200**
2905
+
2906
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
2907
+ | --------- | ------- | ---- | ---- | -------- | ---- |
2908
+ | » success | boolean | true | none | 是否成功 | none |
2909
+
2910
+ ## GET 下载沙盒文件
2911
+
2912
+ GET /api/file/download
2913
+
2914
+ ### 请求参数
2915
+
2916
+ | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
2917
+ | ------- | ----- | ------ | ---- | -------- | ---- |
2918
+ | dirType | query | string | 是 | 目录类型 | 支持 `temp`、`documents` |
2919
+ | path | query | string | 是 | 路径 | 文件路径。支持 `/foo.bin` 或 `foo.bin`,会拼接到所选目录下 |
2920
+
2921
+ ### 返回结果
2922
+
2923
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2924
+ | ------ | ---------------------------------------------------------------- | ---------- | -------- |
2925
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 文件流 | file |
2926
+ | 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | 参数不合法 | Inline |
2927
+ | 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
2928
+ | 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | 文件不存在 | Inline |
2929
+
2647
2930
  # 数据模型
2648
2931
 
2649
2932
  <h2 id="tocS_软件状态">软件状态</h2>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.4.10",
3
+ "version": "1.4.12",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {