@cpzxrobot/sdk 1.3.120 → 1.3.121
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/AIFORM_GATEWAY.md +573 -51
- package/aiform_gateway.ts +216 -6
- package/dist/aiform_gateway.js +184 -6
- package/package.json +1 -1
- package/types.d.ts +161 -3
package/aiform_gateway.ts
CHANGED
|
@@ -6,6 +6,11 @@ import type {
|
|
|
6
6
|
AiformFileUploadResponse,
|
|
7
7
|
AiformFileListResponse,
|
|
8
8
|
AiformFileDetailResponse,
|
|
9
|
+
AiformTemplateHistoryResponse,
|
|
10
|
+
AiformTemplatePublishResponse,
|
|
11
|
+
AiformReplyResponse,
|
|
12
|
+
AiformConfirmResponse,
|
|
13
|
+
AiformReplyListResponse,
|
|
9
14
|
} from ".";
|
|
10
15
|
|
|
11
16
|
export class AiformGateway extends Object {
|
|
@@ -71,19 +76,25 @@ export class AiformGateway extends Object {
|
|
|
71
76
|
/**
|
|
72
77
|
* 上传表格图片提炼模板提示词
|
|
73
78
|
* POST /api/v2/aiform/template/upload
|
|
74
|
-
* @param templateId 模板ID
|
|
79
|
+
* @param templateId 模板ID(可选,与factoryId二选一)
|
|
75
80
|
* @param file 图片文件
|
|
81
|
+
* @param factoryId 工厂ID(可选,与templateId二选一)
|
|
76
82
|
*/
|
|
77
|
-
uploadTemplateImage: async (templateId: number, file: File): Promise<any> => {
|
|
83
|
+
uploadTemplateImage: async (templateId: number | null, file: File, factoryId?: number): Promise<any> => {
|
|
78
84
|
const axios = await this.context.ready;
|
|
79
85
|
|
|
80
|
-
if (!templateId) {
|
|
81
|
-
throw new Error('模板ID
|
|
86
|
+
if (!templateId && !factoryId) {
|
|
87
|
+
throw new Error('模板ID和工厂ID至少需要传一个');
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
const formData = new FormData();
|
|
85
91
|
formData.append('file', file);
|
|
86
|
-
|
|
92
|
+
if (templateId) {
|
|
93
|
+
formData.append('templateId', String(templateId));
|
|
94
|
+
}
|
|
95
|
+
if (factoryId) {
|
|
96
|
+
formData.append('factoryId', String(factoryId));
|
|
97
|
+
}
|
|
87
98
|
|
|
88
99
|
return axios.post('/api/v2/aiform/template/upload', formData, {
|
|
89
100
|
headers: {
|
|
@@ -96,6 +107,70 @@ export class AiformGateway extends Object {
|
|
|
96
107
|
return res.data;
|
|
97
108
|
});
|
|
98
109
|
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 删除模板
|
|
113
|
+
* @param templateId 模板ID
|
|
114
|
+
* @returns Promise 包含删除结果
|
|
115
|
+
*/
|
|
116
|
+
delete: async (templateId: number): Promise<any> => {
|
|
117
|
+
const axios = await this.context.ready;
|
|
118
|
+
|
|
119
|
+
if (!templateId) {
|
|
120
|
+
throw new Error('模板ID不能为空');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return axios.post(`/api/v2/aiform/template/delete/${templateId}`).then((res) => {
|
|
124
|
+
if (res.data.code !== 200) {
|
|
125
|
+
throw new Error(res.data.message || '删除模板失败');
|
|
126
|
+
}
|
|
127
|
+
return res.data;
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 查询模板解析历史快照
|
|
133
|
+
* @param templateId 模板ID
|
|
134
|
+
* @returns Promise 包含历史快照列表
|
|
135
|
+
*/
|
|
136
|
+
history: async (templateId: number): Promise<AiformTemplateHistoryResponse> => {
|
|
137
|
+
const axios = await this.context.ready;
|
|
138
|
+
|
|
139
|
+
if (!templateId) {
|
|
140
|
+
throw new Error('模板ID不能为空');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return axios.get(`/api/v2/aiform/template/${templateId}/history`).then((res) => {
|
|
144
|
+
if (res.data.code !== 200) {
|
|
145
|
+
throw new Error(res.data.message || '获取历史快照失败');
|
|
146
|
+
}
|
|
147
|
+
return res.data;
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 按版本号将历史发布到主表
|
|
153
|
+
* @param templateId 模板ID
|
|
154
|
+
* @param snapshotVersion 解析版本号
|
|
155
|
+
* @returns Promise 包含更新后的模板
|
|
156
|
+
*/
|
|
157
|
+
publishHistory: async (templateId: number, snapshotVersion: number): Promise<AiformTemplatePublishResponse> => {
|
|
158
|
+
const axios = await this.context.ready;
|
|
159
|
+
|
|
160
|
+
if (!templateId) {
|
|
161
|
+
throw new Error('模板ID不能为空');
|
|
162
|
+
}
|
|
163
|
+
if (!snapshotVersion || snapshotVersion <= 0) {
|
|
164
|
+
throw new Error('解析版本号必须大于0');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return axios.post(`/api/v2/aiform/template/${templateId}/history/${snapshotVersion}/publish`).then((res) => {
|
|
168
|
+
if (res.data.code !== 200) {
|
|
169
|
+
throw new Error(res.data.message || '发布历史失败');
|
|
170
|
+
}
|
|
171
|
+
return res.data;
|
|
172
|
+
});
|
|
173
|
+
},
|
|
99
174
|
};
|
|
100
175
|
}
|
|
101
176
|
|
|
@@ -104,9 +179,10 @@ export class AiformGateway extends Object {
|
|
|
104
179
|
/**
|
|
105
180
|
* 上传表格图片
|
|
106
181
|
* @param templateId 关联的模板ID
|
|
182
|
+
* @param watermark 图片是否带水印
|
|
107
183
|
* @returns Promise 包含文件记录信息
|
|
108
184
|
*/
|
|
109
|
-
upload: async (templateId: number): Promise<AiformFileUploadResponse> => {
|
|
185
|
+
upload: async (templateId: number, watermark: boolean = false): Promise<AiformFileUploadResponse> => {
|
|
110
186
|
const axios = await this.context.ready;
|
|
111
187
|
|
|
112
188
|
if (!templateId) {
|
|
@@ -117,6 +193,7 @@ export class AiformGateway extends Object {
|
|
|
117
193
|
title: "请选择要解析的表格图片",
|
|
118
194
|
data: {
|
|
119
195
|
templateId,
|
|
196
|
+
watermark,
|
|
120
197
|
}
|
|
121
198
|
}).then((res) => {
|
|
122
199
|
if (res.data.code !== 200) {
|
|
@@ -167,6 +244,139 @@ export class AiformGateway extends Object {
|
|
|
167
244
|
return res.data;
|
|
168
245
|
});
|
|
169
246
|
},
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* 根据reply_id获取解析结果
|
|
250
|
+
* @param replyId reply记录ID
|
|
251
|
+
* @returns Promise 包含解析结果详情
|
|
252
|
+
*/
|
|
253
|
+
getReplyDetail: async (replyId: number): Promise<AiformFileDetailResponse> => {
|
|
254
|
+
const axios = await this.context.ready;
|
|
255
|
+
|
|
256
|
+
if (!replyId) {
|
|
257
|
+
throw new Error('reply记录ID不能为空');
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return axios.get(`/api/v2/aiform/file/detail/reply/${replyId}`).then((res) => {
|
|
261
|
+
if (res.data.code !== 200) {
|
|
262
|
+
throw new Error(res.data.message || '获取解析结果失败');
|
|
263
|
+
}
|
|
264
|
+
return res.data;
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* 根据解析结果提交反馈(reply)
|
|
270
|
+
* @param code 文件业务编码
|
|
271
|
+
* @param reply 用户的修改意见/反馈内容
|
|
272
|
+
* @returns Promise 包含调整后的解析结果
|
|
273
|
+
*/
|
|
274
|
+
reply: async (code: string, reply: string): Promise<AiformReplyResponse> => {
|
|
275
|
+
const axios = await this.context.ready;
|
|
276
|
+
|
|
277
|
+
if (!code) {
|
|
278
|
+
throw new Error('文件业务编码不能为空');
|
|
279
|
+
}
|
|
280
|
+
if (!reply) {
|
|
281
|
+
throw new Error('反馈内容不能为空');
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return axios.post(`/api/v2/aiform/file/reply`, {
|
|
285
|
+
code,
|
|
286
|
+
reply
|
|
287
|
+
}, {
|
|
288
|
+
headers: {
|
|
289
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
290
|
+
}
|
|
291
|
+
}).then((res) => {
|
|
292
|
+
if (res.data.code !== 200) {
|
|
293
|
+
throw new Error(res.data.message || '提交反馈失败');
|
|
294
|
+
}
|
|
295
|
+
return res.data;
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 用户确认并保存
|
|
301
|
+
* @param id 解析结果记录ID
|
|
302
|
+
* @param content 表格文本,markdown表格格式
|
|
303
|
+
* @param headerRowCount 表头行数(可选)
|
|
304
|
+
* @param headers 表头单元格列表(可选)
|
|
305
|
+
* @returns Promise 包含保存结果
|
|
306
|
+
*/
|
|
307
|
+
confirm: async (id: number, content: string, headerRowCount?: number, headers?: any[]): Promise<AiformConfirmResponse> => {
|
|
308
|
+
const axios = await this.context.ready;
|
|
309
|
+
|
|
310
|
+
if (!id) {
|
|
311
|
+
throw new Error('解析结果记录ID不能为空');
|
|
312
|
+
}
|
|
313
|
+
if (!content) {
|
|
314
|
+
throw new Error('表格内容不能为空');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const data: any = {
|
|
318
|
+
content,
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
if (headerRowCount !== undefined) {
|
|
322
|
+
data.headerRowCount = headerRowCount;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (headers) {
|
|
326
|
+
data.headers = headers;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return axios.post(`/api/v2/aiform/file/confirm?id=${id}`, data, {
|
|
330
|
+
headers: {
|
|
331
|
+
'Content-Type': 'application/json'
|
|
332
|
+
}
|
|
333
|
+
}).then((res) => {
|
|
334
|
+
if (res.data.code !== 200) {
|
|
335
|
+
throw new Error(res.data.message || '确认保存失败');
|
|
336
|
+
}
|
|
337
|
+
return res.data;
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 查询文件的reply调整历史
|
|
343
|
+
* @param code 文件业务编码
|
|
344
|
+
* @returns Promise 包含reply记录列表
|
|
345
|
+
*/
|
|
346
|
+
getReplyList: async (code: string): Promise<AiformReplyListResponse> => {
|
|
347
|
+
const axios = await this.context.ready;
|
|
348
|
+
|
|
349
|
+
if (!code) {
|
|
350
|
+
throw new Error('文件业务编码不能为空');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return axios.get(`/api/v2/aiform/file/reply/list/${code}`).then((res) => {
|
|
354
|
+
if (res.data.code !== 200) {
|
|
355
|
+
throw new Error(res.data.message || '获取reply历史失败');
|
|
356
|
+
}
|
|
357
|
+
return res.data;
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* 根据文件code删除记录
|
|
363
|
+
* @param code 文件业务编码
|
|
364
|
+
* @returns Promise 包含删除结果
|
|
365
|
+
*/
|
|
366
|
+
delete: async (code: string): Promise<any> => {
|
|
367
|
+
const axios = await this.context.ready;
|
|
368
|
+
|
|
369
|
+
if (!code) {
|
|
370
|
+
throw new Error('文件业务编码不能为空');
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return axios.post(`/api/v2/aiform/file/delete/${code}`).then((res) => {
|
|
374
|
+
if (res.data.code !== 200) {
|
|
375
|
+
throw new Error(res.data.message || '删除记录失败');
|
|
376
|
+
}
|
|
377
|
+
return res.data;
|
|
378
|
+
});
|
|
379
|
+
},
|
|
170
380
|
};
|
|
171
381
|
}
|
|
172
382
|
}
|
package/dist/aiform_gateway.js
CHANGED
|
@@ -64,17 +64,23 @@ class AiformGateway extends Object {
|
|
|
64
64
|
/**
|
|
65
65
|
* 上传表格图片提炼模板提示词
|
|
66
66
|
* POST /api/v2/aiform/template/upload
|
|
67
|
-
* @param templateId 模板ID
|
|
67
|
+
* @param templateId 模板ID(可选,与factoryId二选一)
|
|
68
68
|
* @param file 图片文件
|
|
69
|
+
* @param factoryId 工厂ID(可选,与templateId二选一)
|
|
69
70
|
*/
|
|
70
|
-
uploadTemplateImage: (templateId, file) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
uploadTemplateImage: (templateId, file, factoryId) => __awaiter(this, void 0, void 0, function* () {
|
|
71
72
|
const axios = yield this.context.ready;
|
|
72
|
-
if (!templateId) {
|
|
73
|
-
throw new Error('模板ID
|
|
73
|
+
if (!templateId && !factoryId) {
|
|
74
|
+
throw new Error('模板ID和工厂ID至少需要传一个');
|
|
74
75
|
}
|
|
75
76
|
const formData = new FormData();
|
|
76
77
|
formData.append('file', file);
|
|
77
|
-
|
|
78
|
+
if (templateId) {
|
|
79
|
+
formData.append('templateId', String(templateId));
|
|
80
|
+
}
|
|
81
|
+
if (factoryId) {
|
|
82
|
+
formData.append('factoryId', String(factoryId));
|
|
83
|
+
}
|
|
78
84
|
return axios.post('/api/v2/aiform/template/upload', formData, {
|
|
79
85
|
headers: {
|
|
80
86
|
'Content-Type': 'multipart/form-data'
|
|
@@ -86,6 +92,61 @@ class AiformGateway extends Object {
|
|
|
86
92
|
return res.data;
|
|
87
93
|
});
|
|
88
94
|
}),
|
|
95
|
+
/**
|
|
96
|
+
* 删除模板
|
|
97
|
+
* @param templateId 模板ID
|
|
98
|
+
* @returns Promise 包含删除结果
|
|
99
|
+
*/
|
|
100
|
+
delete: (templateId) => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const axios = yield this.context.ready;
|
|
102
|
+
if (!templateId) {
|
|
103
|
+
throw new Error('模板ID不能为空');
|
|
104
|
+
}
|
|
105
|
+
return axios.post(`/api/v2/aiform/template/delete/${templateId}`).then((res) => {
|
|
106
|
+
if (res.data.code !== 200) {
|
|
107
|
+
throw new Error(res.data.message || '删除模板失败');
|
|
108
|
+
}
|
|
109
|
+
return res.data;
|
|
110
|
+
});
|
|
111
|
+
}),
|
|
112
|
+
/**
|
|
113
|
+
* 查询模板解析历史快照
|
|
114
|
+
* @param templateId 模板ID
|
|
115
|
+
* @returns Promise 包含历史快照列表
|
|
116
|
+
*/
|
|
117
|
+
history: (templateId) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const axios = yield this.context.ready;
|
|
119
|
+
if (!templateId) {
|
|
120
|
+
throw new Error('模板ID不能为空');
|
|
121
|
+
}
|
|
122
|
+
return axios.get(`/api/v2/aiform/template/${templateId}/history`).then((res) => {
|
|
123
|
+
if (res.data.code !== 200) {
|
|
124
|
+
throw new Error(res.data.message || '获取历史快照失败');
|
|
125
|
+
}
|
|
126
|
+
return res.data;
|
|
127
|
+
});
|
|
128
|
+
}),
|
|
129
|
+
/**
|
|
130
|
+
* 按版本号将历史发布到主表
|
|
131
|
+
* @param templateId 模板ID
|
|
132
|
+
* @param snapshotVersion 解析版本号
|
|
133
|
+
* @returns Promise 包含更新后的模板
|
|
134
|
+
*/
|
|
135
|
+
publishHistory: (templateId, snapshotVersion) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const axios = yield this.context.ready;
|
|
137
|
+
if (!templateId) {
|
|
138
|
+
throw new Error('模板ID不能为空');
|
|
139
|
+
}
|
|
140
|
+
if (!snapshotVersion || snapshotVersion <= 0) {
|
|
141
|
+
throw new Error('解析版本号必须大于0');
|
|
142
|
+
}
|
|
143
|
+
return axios.post(`/api/v2/aiform/template/${templateId}/history/${snapshotVersion}/publish`).then((res) => {
|
|
144
|
+
if (res.data.code !== 200) {
|
|
145
|
+
throw new Error(res.data.message || '发布历史失败');
|
|
146
|
+
}
|
|
147
|
+
return res.data;
|
|
148
|
+
});
|
|
149
|
+
}),
|
|
89
150
|
};
|
|
90
151
|
}
|
|
91
152
|
get record() {
|
|
@@ -93,9 +154,10 @@ class AiformGateway extends Object {
|
|
|
93
154
|
/**
|
|
94
155
|
* 上传表格图片
|
|
95
156
|
* @param templateId 关联的模板ID
|
|
157
|
+
* @param watermark 图片是否带水印
|
|
96
158
|
* @returns Promise 包含文件记录信息
|
|
97
159
|
*/
|
|
98
|
-
upload: (
|
|
160
|
+
upload: (templateId_1, ...args_1) => __awaiter(this, [templateId_1, ...args_1], void 0, function* (templateId, watermark = false) {
|
|
99
161
|
const axios = yield this.context.ready;
|
|
100
162
|
if (!templateId) {
|
|
101
163
|
throw new Error('模板ID不能为空');
|
|
@@ -104,6 +166,7 @@ class AiformGateway extends Object {
|
|
|
104
166
|
title: "请选择要解析的表格图片",
|
|
105
167
|
data: {
|
|
106
168
|
templateId,
|
|
169
|
+
watermark,
|
|
107
170
|
}
|
|
108
171
|
}).then((res) => {
|
|
109
172
|
if (res.data.code !== 200) {
|
|
@@ -148,6 +211,121 @@ class AiformGateway extends Object {
|
|
|
148
211
|
return res.data;
|
|
149
212
|
});
|
|
150
213
|
}),
|
|
214
|
+
/**
|
|
215
|
+
* 根据reply_id获取解析结果
|
|
216
|
+
* @param replyId reply记录ID
|
|
217
|
+
* @returns Promise 包含解析结果详情
|
|
218
|
+
*/
|
|
219
|
+
getReplyDetail: (replyId) => __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
const axios = yield this.context.ready;
|
|
221
|
+
if (!replyId) {
|
|
222
|
+
throw new Error('reply记录ID不能为空');
|
|
223
|
+
}
|
|
224
|
+
return axios.get(`/api/v2/aiform/file/detail/reply/${replyId}`).then((res) => {
|
|
225
|
+
if (res.data.code !== 200) {
|
|
226
|
+
throw new Error(res.data.message || '获取解析结果失败');
|
|
227
|
+
}
|
|
228
|
+
return res.data;
|
|
229
|
+
});
|
|
230
|
+
}),
|
|
231
|
+
/**
|
|
232
|
+
* 根据解析结果提交反馈(reply)
|
|
233
|
+
* @param code 文件业务编码
|
|
234
|
+
* @param reply 用户的修改意见/反馈内容
|
|
235
|
+
* @returns Promise 包含调整后的解析结果
|
|
236
|
+
*/
|
|
237
|
+
reply: (code, reply) => __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
const axios = yield this.context.ready;
|
|
239
|
+
if (!code) {
|
|
240
|
+
throw new Error('文件业务编码不能为空');
|
|
241
|
+
}
|
|
242
|
+
if (!reply) {
|
|
243
|
+
throw new Error('反馈内容不能为空');
|
|
244
|
+
}
|
|
245
|
+
return axios.post(`/api/v2/aiform/file/reply`, {
|
|
246
|
+
code,
|
|
247
|
+
reply
|
|
248
|
+
}, {
|
|
249
|
+
headers: {
|
|
250
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
251
|
+
}
|
|
252
|
+
}).then((res) => {
|
|
253
|
+
if (res.data.code !== 200) {
|
|
254
|
+
throw new Error(res.data.message || '提交反馈失败');
|
|
255
|
+
}
|
|
256
|
+
return res.data;
|
|
257
|
+
});
|
|
258
|
+
}),
|
|
259
|
+
/**
|
|
260
|
+
* 用户确认并保存
|
|
261
|
+
* @param id 解析结果记录ID
|
|
262
|
+
* @param content 表格文本,markdown表格格式
|
|
263
|
+
* @param headerRowCount 表头行数(可选)
|
|
264
|
+
* @param headers 表头单元格列表(可选)
|
|
265
|
+
* @returns Promise 包含保存结果
|
|
266
|
+
*/
|
|
267
|
+
confirm: (id, content, headerRowCount, headers) => __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
const axios = yield this.context.ready;
|
|
269
|
+
if (!id) {
|
|
270
|
+
throw new Error('解析结果记录ID不能为空');
|
|
271
|
+
}
|
|
272
|
+
if (!content) {
|
|
273
|
+
throw new Error('表格内容不能为空');
|
|
274
|
+
}
|
|
275
|
+
const data = {
|
|
276
|
+
content,
|
|
277
|
+
};
|
|
278
|
+
if (headerRowCount !== undefined) {
|
|
279
|
+
data.headerRowCount = headerRowCount;
|
|
280
|
+
}
|
|
281
|
+
if (headers) {
|
|
282
|
+
data.headers = headers;
|
|
283
|
+
}
|
|
284
|
+
return axios.post(`/api/v2/aiform/file/confirm?id=${id}`, data, {
|
|
285
|
+
headers: {
|
|
286
|
+
'Content-Type': 'application/json'
|
|
287
|
+
}
|
|
288
|
+
}).then((res) => {
|
|
289
|
+
if (res.data.code !== 200) {
|
|
290
|
+
throw new Error(res.data.message || '确认保存失败');
|
|
291
|
+
}
|
|
292
|
+
return res.data;
|
|
293
|
+
});
|
|
294
|
+
}),
|
|
295
|
+
/**
|
|
296
|
+
* 查询文件的reply调整历史
|
|
297
|
+
* @param code 文件业务编码
|
|
298
|
+
* @returns Promise 包含reply记录列表
|
|
299
|
+
*/
|
|
300
|
+
getReplyList: (code) => __awaiter(this, void 0, void 0, function* () {
|
|
301
|
+
const axios = yield this.context.ready;
|
|
302
|
+
if (!code) {
|
|
303
|
+
throw new Error('文件业务编码不能为空');
|
|
304
|
+
}
|
|
305
|
+
return axios.get(`/api/v2/aiform/file/reply/list/${code}`).then((res) => {
|
|
306
|
+
if (res.data.code !== 200) {
|
|
307
|
+
throw new Error(res.data.message || '获取reply历史失败');
|
|
308
|
+
}
|
|
309
|
+
return res.data;
|
|
310
|
+
});
|
|
311
|
+
}),
|
|
312
|
+
/**
|
|
313
|
+
* 根据文件code删除记录
|
|
314
|
+
* @param code 文件业务编码
|
|
315
|
+
* @returns Promise 包含删除结果
|
|
316
|
+
*/
|
|
317
|
+
delete: (code) => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
const axios = yield this.context.ready;
|
|
319
|
+
if (!code) {
|
|
320
|
+
throw new Error('文件业务编码不能为空');
|
|
321
|
+
}
|
|
322
|
+
return axios.post(`/api/v2/aiform/file/delete/${code}`).then((res) => {
|
|
323
|
+
if (res.data.code !== 200) {
|
|
324
|
+
throw new Error(res.data.message || '删除记录失败');
|
|
325
|
+
}
|
|
326
|
+
return res.data;
|
|
327
|
+
});
|
|
328
|
+
}),
|
|
151
329
|
};
|
|
152
330
|
}
|
|
153
331
|
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -820,7 +820,159 @@ interface AiformTemplate {
|
|
|
820
820
|
/** 是否包含水印 */
|
|
821
821
|
watermark?: boolean;
|
|
822
822
|
/** 注意事项 */
|
|
823
|
-
attention?:
|
|
823
|
+
attention?: {
|
|
824
|
+
hasFixedContent: boolean;
|
|
825
|
+
fixedContentList: string[];
|
|
826
|
+
hasFixedRowContent: boolean;
|
|
827
|
+
rowContent: string;
|
|
828
|
+
hasFixedColumnContent: boolean;
|
|
829
|
+
columnContent: string;
|
|
830
|
+
otherNotes: string;
|
|
831
|
+
};
|
|
832
|
+
/** 解析状态:null-未上传 0-已上传 1-解析中 2-已解析 */
|
|
833
|
+
status?: number;
|
|
834
|
+
/** 从表格图片提炼的解析提示词 */
|
|
835
|
+
parsePrompt?: string;
|
|
836
|
+
/** 当前解析版本号 */
|
|
837
|
+
curVersion?: number;
|
|
838
|
+
/** 创建时间 */
|
|
839
|
+
createTime?: string;
|
|
840
|
+
/** 更新时间 */
|
|
841
|
+
updateTime?: string;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* 模板历史快照接口
|
|
846
|
+
*/
|
|
847
|
+
interface AiformTemplateHistory {
|
|
848
|
+
/** 历史表主键 */
|
|
849
|
+
id: number;
|
|
850
|
+
/** 模板ID */
|
|
851
|
+
templateId: number;
|
|
852
|
+
/** 解析版本号 */
|
|
853
|
+
snapshotVersion: number;
|
|
854
|
+
/** 名称快照 */
|
|
855
|
+
name: string;
|
|
856
|
+
/** 内容快照 */
|
|
857
|
+
content: string;
|
|
858
|
+
/** 注意事项快照 */
|
|
859
|
+
attention: object;
|
|
860
|
+
/** 解析提示词快照 */
|
|
861
|
+
parsePrompt: string;
|
|
862
|
+
/** 归档时间 */
|
|
863
|
+
createTime: string;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* 模板历史响应接口
|
|
868
|
+
*/
|
|
869
|
+
interface AiformTemplateHistoryResponse {
|
|
870
|
+
/** 响应码 */
|
|
871
|
+
code: number;
|
|
872
|
+
/** 提示信息 */
|
|
873
|
+
message: string;
|
|
874
|
+
/** 历史快照列表 */
|
|
875
|
+
data: AiformTemplateHistory[];
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* 模板发布响应接口
|
|
880
|
+
*/
|
|
881
|
+
interface AiformTemplatePublishResponse {
|
|
882
|
+
/** 响应码 */
|
|
883
|
+
code: number;
|
|
884
|
+
/** 提示信息 */
|
|
885
|
+
message: string;
|
|
886
|
+
/** 更新后的模板 */
|
|
887
|
+
data: AiformTemplate;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* 记录VO接口
|
|
892
|
+
*/
|
|
893
|
+
interface AiformRecordVO {
|
|
894
|
+
/** 业务编码(用于调用详情接口) */
|
|
895
|
+
code: string;
|
|
896
|
+
/** 存储文件名 */
|
|
897
|
+
storageName: string;
|
|
898
|
+
/** 解析状态:0-已上传 1-解析中 2-已解析 */
|
|
899
|
+
status: number;
|
|
900
|
+
/** 图片是否带水印 */
|
|
901
|
+
watermark: boolean;
|
|
902
|
+
/** 创建用户ID */
|
|
903
|
+
createUserId: number;
|
|
904
|
+
/** 创建时间 */
|
|
905
|
+
createTime: string;
|
|
906
|
+
/** 更新时间 */
|
|
907
|
+
updateTime: string;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* 解析结果详情接口(AiformParseResultVO)
|
|
912
|
+
*/
|
|
913
|
+
interface AiformParseResultVO {
|
|
914
|
+
/** 解析结果记录ID */
|
|
915
|
+
id: number;
|
|
916
|
+
/** markdown 解析的表格内容 */
|
|
917
|
+
content: string;
|
|
918
|
+
/** 疑似不清晰处的描述说明 */
|
|
919
|
+
unclears: string[];
|
|
920
|
+
/** 整体解析说明 */
|
|
921
|
+
description: string;
|
|
922
|
+
/** 解析结果(兼容旧数据或解析失败时的原始结果) */
|
|
923
|
+
parseResult: string | null;
|
|
924
|
+
/** 预签名访问链接(有效期7天) */
|
|
925
|
+
accessUrl: string;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Reply响应接口
|
|
930
|
+
*/
|
|
931
|
+
interface AiformReplyResponse {
|
|
932
|
+
/** 响应码 */
|
|
933
|
+
code: number;
|
|
934
|
+
/** 提示信息 */
|
|
935
|
+
message: string;
|
|
936
|
+
/** 调整后的解析结果 */
|
|
937
|
+
data: AiformParseResultVO;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Confirm响应接口
|
|
942
|
+
*/
|
|
943
|
+
interface AiformConfirmResponse {
|
|
944
|
+
/** 响应码 */
|
|
945
|
+
code: number;
|
|
946
|
+
/** 提示信息 */
|
|
947
|
+
message: string;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Reply记录接口
|
|
952
|
+
*/
|
|
953
|
+
interface AiformRecordReply {
|
|
954
|
+
/** 主键 */
|
|
955
|
+
id: number;
|
|
956
|
+
/** 记录ID,关联 aiform_record */
|
|
957
|
+
recordId: number;
|
|
958
|
+
/** 用户的修改意见/反馈内容 */
|
|
959
|
+
reply: string;
|
|
960
|
+
/** 创建用户ID */
|
|
961
|
+
createUserId: number;
|
|
962
|
+
/** 创建时间 */
|
|
963
|
+
createTime: string;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Reply列表响应接口
|
|
968
|
+
*/
|
|
969
|
+
interface AiformReplyListResponse {
|
|
970
|
+
/** 响应码 */
|
|
971
|
+
code: number;
|
|
972
|
+
/** 提示信息 */
|
|
973
|
+
message: string;
|
|
974
|
+
/** reply 记录列表 */
|
|
975
|
+
data: AiformRecordReply[];
|
|
824
976
|
}
|
|
825
977
|
|
|
826
978
|
/**
|
|
@@ -1074,12 +1226,18 @@ declare module "@cpzxrobot/sdk" {
|
|
|
1074
1226
|
AiformTemplateListResponse,
|
|
1075
1227
|
AiformTemplateSaveRequest,
|
|
1076
1228
|
AiformTemplateSaveResponse,
|
|
1077
|
-
|
|
1078
|
-
|
|
1229
|
+
AiformTemplateHistory,
|
|
1230
|
+
AiformTemplateHistoryResponse,
|
|
1231
|
+
AiformTemplatePublishResponse,
|
|
1232
|
+
AiformRecordVO,
|
|
1079
1233
|
AiformParseResultVO,
|
|
1080
1234
|
AiformFileUploadResponse,
|
|
1081
1235
|
AiformFileListResponse,
|
|
1082
1236
|
AiformFileDetailResponse,
|
|
1237
|
+
AiformReplyResponse,
|
|
1238
|
+
AiformConfirmResponse,
|
|
1239
|
+
AiformRecordReply,
|
|
1240
|
+
AiformReplyListResponse,
|
|
1083
1241
|
AlarmRuleDetail,
|
|
1084
1242
|
AlarmRuleListResponse,
|
|
1085
1243
|
AlarmRuleDetailResponse,
|