@cpzxrobot/sdk 1.3.121 → 1.3.123

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.ts CHANGED
@@ -77,29 +77,29 @@ export class AiformGateway extends Object {
77
77
  * 上传表格图片提炼模板提示词
78
78
  * POST /api/v2/aiform/template/upload
79
79
  * @param templateId 模板ID(可选,与factoryId二选一)
80
- * @param file 图片文件
81
80
  * @param factoryId 工厂ID(可选,与templateId二选一)
82
81
  */
83
- uploadTemplateImage: async (templateId: number | null, file: File, factoryId?: number): Promise<any> => {
82
+ uploadTemplateImage: async (args: {
83
+ templateId?: number;
84
+ factoryId?: number;
85
+ }): Promise<any> => {
84
86
  const axios = await this.context.ready;
85
87
 
86
- if (!templateId && !factoryId) {
88
+ if (!args.templateId && !args.factoryId) {
87
89
  throw new Error('模板ID和工厂ID至少需要传一个');
88
90
  }
89
91
 
90
- const formData = new FormData();
91
- formData.append('file', file);
92
- if (templateId) {
93
- formData.append('templateId', String(templateId));
92
+ const data: any = {};
93
+ if (args.templateId) {
94
+ data.templateId = args.templateId;
94
95
  }
95
- if (factoryId) {
96
- formData.append('factoryId', String(factoryId));
96
+ if (args.factoryId) {
97
+ data.factoryId = args.factoryId;
97
98
  }
98
99
 
99
- return axios.post('/api/v2/aiform/template/upload', formData, {
100
- headers: {
101
- 'Content-Type': 'multipart/form-data'
102
- }
100
+ return axios.upload(`/api/v2/aiform/template/upload`,{
101
+ title: "请选择表格图片",
102
+ data: data
103
103
  }).then((res) => {
104
104
  if (res.data.code !== 200) {
105
105
  throw new Error(res.data.message || '上传图片失败');
@@ -65,26 +65,23 @@ class AiformGateway extends Object {
65
65
  * 上传表格图片提炼模板提示词
66
66
  * POST /api/v2/aiform/template/upload
67
67
  * @param templateId 模板ID(可选,与factoryId二选一)
68
- * @param file 图片文件
69
68
  * @param factoryId 工厂ID(可选,与templateId二选一)
70
69
  */
71
- uploadTemplateImage: (templateId, file, factoryId) => __awaiter(this, void 0, void 0, function* () {
70
+ uploadTemplateImage: (args) => __awaiter(this, void 0, void 0, function* () {
72
71
  const axios = yield this.context.ready;
73
- if (!templateId && !factoryId) {
72
+ if (!args.templateId && !args.factoryId) {
74
73
  throw new Error('模板ID和工厂ID至少需要传一个');
75
74
  }
76
- const formData = new FormData();
77
- formData.append('file', file);
78
- if (templateId) {
79
- formData.append('templateId', String(templateId));
75
+ const data = {};
76
+ if (args.templateId) {
77
+ data.templateId = args.templateId;
80
78
  }
81
- if (factoryId) {
82
- formData.append('factoryId', String(factoryId));
79
+ if (args.factoryId) {
80
+ data.factoryId = args.factoryId;
83
81
  }
84
- return axios.post('/api/v2/aiform/template/upload', formData, {
85
- headers: {
86
- 'Content-Type': 'multipart/form-data'
87
- }
82
+ return axios.upload(`/api/v2/aiform/template/upload`, {
83
+ title: "请选择表格图片",
84
+ data: data
88
85
  }).then((res) => {
89
86
  if (res.data.code !== 200) {
90
87
  throw new Error(res.data.message || '上传图片失败');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.121",
3
+ "version": "1.3.123",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {