qing-client 0.0.4 → 0.0.6

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.
@@ -1,9 +1,20 @@
1
1
  import { BaseClient } from "../client/BaseClient";
2
2
  import { ClientConfig, RequestOptions } from "../types";
3
- import { TextGenerationRequest, TextGenerationResponse, ImageGenerationRequest, ImageGenerationResponse, ChatCompletionRequest, ChatCompletionResponse } from "../types/aigc";
3
+ import { TextGenerationRequest, TextGenerationResponse, ImageGenerationRequest, ImageGenerationResponse, ChatCompletionRequest, ChatCompletionResponse, GaoqingTaskRequest, GaoqingTaskResponse, TwoDToThreeDTaskRequest, TwoDToThreeDTaskResponse, ImageRewriteTaskRequest, ImageRewriteTaskResponse, IndustrialDesignTaskRequest, IndustrialDesignTaskResponse, InpaintingTaskRequest, InpaintingTaskResponse, InteriorDesignTaskRequest, InteriorDesignTaskResponse, OldPhotoRestoreTaskRequest, OldPhotoRestoreTaskResponse, ProductBackgroundTaskRequest, ProductBackgroundTaskResponse, QingpingguoTaskRequest, QingpingguoTaskResponse, StyleTransferTaskRequest, StyleTransferTaskResponse, TaskStatusRequest, TaskStatusResponse } from "../types/aigc";
4
4
  export declare class AigcService extends BaseClient {
5
5
  constructor(config: ClientConfig);
6
6
  generateText(request: TextGenerationRequest, options?: RequestOptions): Promise<TextGenerationResponse>;
7
7
  generateImage(request: ImageGenerationRequest, options?: RequestOptions): Promise<ImageGenerationResponse>;
8
8
  chatCompletion(request: ChatCompletionRequest, options?: RequestOptions): Promise<ChatCompletionResponse>;
9
+ submitGaoqingTask(request: GaoqingTaskRequest, options?: RequestOptions): Promise<GaoqingTaskResponse>;
10
+ submit2DToThreeDTask(request: TwoDToThreeDTaskRequest, options?: RequestOptions): Promise<TwoDToThreeDTaskResponse>;
11
+ submitImageRewriteTask(request: ImageRewriteTaskRequest, options?: RequestOptions): Promise<ImageRewriteTaskResponse>;
12
+ submitIndustrialDesignTask(request: IndustrialDesignTaskRequest, options?: RequestOptions): Promise<IndustrialDesignTaskResponse>;
13
+ submitInpaintingTask(request: InpaintingTaskRequest, options?: RequestOptions): Promise<InpaintingTaskResponse>;
14
+ submitInteriorDesignTask(request: InteriorDesignTaskRequest, options?: RequestOptions): Promise<InteriorDesignTaskResponse>;
15
+ submitOldPhotoRestoreTask(request: OldPhotoRestoreTaskRequest, options?: RequestOptions): Promise<OldPhotoRestoreTaskResponse>;
16
+ submitProductBackgroundTask(request: ProductBackgroundTaskRequest, options?: RequestOptions): Promise<ProductBackgroundTaskResponse>;
17
+ submitQingpingguoTask(request: QingpingguoTaskRequest, options?: RequestOptions): Promise<QingpingguoTaskResponse>;
18
+ submitStyleTransferTask(request: StyleTransferTaskRequest, options?: RequestOptions): Promise<StyleTransferTaskResponse>;
19
+ getTaskStatus(request: TaskStatusRequest, options?: RequestOptions): Promise<TaskStatusResponse>;
9
20
  }
@@ -6,7 +6,6 @@ class AigcService extends BaseClient_1.BaseClient {
6
6
  constructor(config) {
7
7
  super(config, 'aigc');
8
8
  }
9
- // 文本生成
10
9
  async generateText(request, options) {
11
10
  return this.request('/text/generation', {
12
11
  ...options,
@@ -14,7 +13,6 @@ class AigcService extends BaseClient_1.BaseClient {
14
13
  body: request
15
14
  });
16
15
  }
17
- // 图片生成
18
16
  async generateImage(request, options) {
19
17
  return this.request('/image/generation', {
20
18
  ...options,
@@ -22,7 +20,6 @@ class AigcService extends BaseClient_1.BaseClient {
22
20
  body: request
23
21
  });
24
22
  }
25
- // 对话补全
26
23
  async chatCompletion(request, options) {
27
24
  return this.request('/chat/completion', {
28
25
  ...options,
@@ -30,5 +27,92 @@ class AigcService extends BaseClient_1.BaseClient {
30
27
  body: request
31
28
  });
32
29
  }
30
+ // 高清面部修复任务
31
+ async submitGaoqingTask(request, options) {
32
+ return this.request('/lib/gaoqing/tasks', {
33
+ ...options,
34
+ method: 'POST',
35
+ body: request
36
+ });
37
+ }
38
+ // 2D转3D任务
39
+ async submit2DToThreeDTask(request, options) {
40
+ return this.request('/lib/2d23d/tasks', {
41
+ ...options,
42
+ method: 'POST',
43
+ body: request
44
+ });
45
+ }
46
+ // 图生图重写任务
47
+ async submitImageRewriteTask(request, options) {
48
+ return this.request('/lib/rewrite/tasks', {
49
+ ...options,
50
+ method: 'POST',
51
+ body: request
52
+ });
53
+ }
54
+ // 工业设计任务
55
+ async submitIndustrialDesignTask(request, options) {
56
+ return this.request('/lib/industrial-design/tasks', {
57
+ ...options,
58
+ method: 'POST',
59
+ body: request
60
+ });
61
+ }
62
+ // 智能涂抹消除任务
63
+ async submitInpaintingTask(request, options) {
64
+ return this.request('/lib/inpainting/tasks', {
65
+ ...options,
66
+ method: 'POST',
67
+ body: request
68
+ });
69
+ }
70
+ // 智能装修任务
71
+ async submitInteriorDesignTask(request, options) {
72
+ return this.request('/lib/interior-design/tasks', {
73
+ ...options,
74
+ method: 'POST',
75
+ body: request
76
+ });
77
+ }
78
+ // 老照片修复任务
79
+ async submitOldPhotoRestoreTask(request, options) {
80
+ return this.request('/old-photo/tasks', {
81
+ ...options,
82
+ method: 'POST',
83
+ body: request
84
+ });
85
+ }
86
+ // 产品换背景任务
87
+ async submitProductBackgroundTask(request, options) {
88
+ return this.request('/product-background/tasks', {
89
+ ...options,
90
+ method: 'POST',
91
+ body: request
92
+ });
93
+ }
94
+ // 青苹果风格洗稿任务
95
+ async submitQingpingguoTask(request, options) {
96
+ return this.request('/qingpingguo/tasks', {
97
+ ...options,
98
+ method: 'POST',
99
+ body: request
100
+ });
101
+ }
102
+ // 风格转绘任务
103
+ async submitStyleTransferTask(request, options) {
104
+ return this.request('/style-transfer/tasks', {
105
+ ...options,
106
+ method: 'POST',
107
+ body: request
108
+ });
109
+ }
110
+ // 获取任务状态
111
+ async getTaskStatus(request, options) {
112
+ return this.request(`/comfy/tasks/${request.taskId}`, {
113
+ ...options,
114
+ method: 'GET'
115
+ });
116
+ }
33
117
  }
34
118
  exports.AigcService = AigcService;
@@ -50,3 +50,113 @@ export interface ChatCompletionResponse {
50
50
  total_tokens: number;
51
51
  };
52
52
  }
53
+ export interface GaoqingTaskRequest {
54
+ faceImageUrl: string;
55
+ posterImageUrl: string;
56
+ }
57
+ export interface GaoqingTaskResponse {
58
+ taskId: string;
59
+ result: any;
60
+ statusUrl: string;
61
+ }
62
+ export interface TwoDToThreeDTaskRequest {
63
+ imageUrl: string;
64
+ }
65
+ export interface TwoDToThreeDTaskResponse {
66
+ taskId: string;
67
+ statusUrl: string;
68
+ result: any;
69
+ }
70
+ export interface ImageRewriteTaskRequest {
71
+ imageUrl: string;
72
+ denoise?: number;
73
+ seed?: number;
74
+ batchSize?: number;
75
+ loraStrength?: number;
76
+ }
77
+ export interface ImageRewriteTaskResponse {
78
+ taskId: string;
79
+ statusUrl: string;
80
+ result: any;
81
+ }
82
+ export interface IndustrialDesignTaskRequest {
83
+ styleImageUrl: string;
84
+ productImageUrl: string;
85
+ }
86
+ export interface IndustrialDesignTaskResponse {
87
+ taskId: string;
88
+ statusUrl: string;
89
+ result: any;
90
+ }
91
+ export interface InpaintingTaskRequest {
92
+ imageUrl: string;
93
+ batchSize?: number;
94
+ resolution?: number;
95
+ }
96
+ export interface InpaintingTaskResponse {
97
+ taskId: string;
98
+ statusUrl: string;
99
+ author: string;
100
+ features: string[];
101
+ batchSize: number;
102
+ }
103
+ export interface InteriorDesignTaskRequest {
104
+ originalImage: string;
105
+ designImage: string;
106
+ }
107
+ export interface InteriorDesignTaskResponse {
108
+ taskId: string;
109
+ statusUrl: string;
110
+ author: string;
111
+ features: string[];
112
+ }
113
+ export interface OldPhotoRestoreTaskRequest {
114
+ imageUrl: string;
115
+ description?: string;
116
+ }
117
+ export interface OldPhotoRestoreTaskResponse {
118
+ taskId: string;
119
+ statusUrl: string;
120
+ author: string;
121
+ features: string[];
122
+ }
123
+ export interface ProductBackgroundTaskRequest {
124
+ imageUrl: string;
125
+ promptText: string;
126
+ }
127
+ export interface ProductBackgroundTaskResponse {
128
+ taskId: string;
129
+ statusUrl: string;
130
+ result: any;
131
+ }
132
+ export interface QingpingguoTaskRequest {
133
+ imageUrl: string;
134
+ denoise?: number;
135
+ seed?: number;
136
+ batchSize?: number;
137
+ loraStrength?: number;
138
+ }
139
+ export interface QingpingguoTaskResponse {
140
+ taskId: string;
141
+ statusUrl: string;
142
+ authorStyle: string;
143
+ resolution: number;
144
+ }
145
+ export interface StyleTransferTaskRequest {
146
+ imageUrl: string;
147
+ styleCode?: number;
148
+ }
149
+ export interface StyleTransferTaskResponse {
150
+ taskId: string;
151
+ statusUrl: string;
152
+ selectedStyle: string;
153
+ result: any;
154
+ }
155
+ export interface TaskStatusRequest {
156
+ taskId: string;
157
+ }
158
+ export interface TaskStatusResponse {
159
+ status: any;
160
+ progress: number;
161
+ images: any[];
162
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qing-client",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -14,5 +14,4 @@ export * from './types/msg';
14
14
  export * from './types/token';
15
15
  export * from './types/user';
16
16
 
17
-
18
17
  export { BaseClient } from './client/BaseClient';
@@ -6,7 +6,29 @@ import {
6
6
  ImageGenerationRequest,
7
7
  ImageGenerationResponse,
8
8
  ChatCompletionRequest,
9
- ChatCompletionResponse
9
+ ChatCompletionResponse,
10
+ GaoqingTaskRequest,
11
+ GaoqingTaskResponse,
12
+ TwoDToThreeDTaskRequest,
13
+ TwoDToThreeDTaskResponse,
14
+ ImageRewriteTaskRequest,
15
+ ImageRewriteTaskResponse,
16
+ IndustrialDesignTaskRequest,
17
+ IndustrialDesignTaskResponse,
18
+ InpaintingTaskRequest,
19
+ InpaintingTaskResponse,
20
+ InteriorDesignTaskRequest,
21
+ InteriorDesignTaskResponse,
22
+ OldPhotoRestoreTaskRequest,
23
+ OldPhotoRestoreTaskResponse,
24
+ ProductBackgroundTaskRequest,
25
+ ProductBackgroundTaskResponse,
26
+ QingpingguoTaskRequest,
27
+ QingpingguoTaskResponse,
28
+ StyleTransferTaskRequest,
29
+ StyleTransferTaskResponse,
30
+ TaskStatusRequest,
31
+ TaskStatusResponse
10
32
  } from "../types/aigc";
11
33
 
12
34
  export class AigcService extends BaseClient {
@@ -14,7 +36,6 @@ export class AigcService extends BaseClient {
14
36
  super(config, 'aigc');
15
37
  }
16
38
 
17
- // 文本生成
18
39
  async generateText(request: TextGenerationRequest, options?: RequestOptions): Promise<TextGenerationResponse> {
19
40
  return this.request<TextGenerationResponse>('/text/generation', {
20
41
  ...options,
@@ -23,7 +44,6 @@ export class AigcService extends BaseClient {
23
44
  });
24
45
  }
25
46
 
26
- // 图片生成
27
47
  async generateImage(request: ImageGenerationRequest, options?: RequestOptions): Promise<ImageGenerationResponse> {
28
48
  return this.request<ImageGenerationResponse>('/image/generation', {
29
49
  ...options,
@@ -32,7 +52,6 @@ export class AigcService extends BaseClient {
32
52
  });
33
53
  }
34
54
 
35
- // 对话补全
36
55
  async chatCompletion(request: ChatCompletionRequest, options?: RequestOptions): Promise<ChatCompletionResponse> {
37
56
  return this.request<ChatCompletionResponse>('/chat/completion', {
38
57
  ...options,
@@ -40,4 +59,102 @@ export class AigcService extends BaseClient {
40
59
  body: request
41
60
  });
42
61
  }
62
+
63
+ // 高清面部修复任务
64
+ async submitGaoqingTask(request: GaoqingTaskRequest, options?: RequestOptions): Promise<GaoqingTaskResponse> {
65
+ return this.request<GaoqingTaskResponse>('/lib/gaoqing/tasks', {
66
+ ...options,
67
+ method: 'POST',
68
+ body: request
69
+ });
70
+ }
71
+
72
+ // 2D转3D任务
73
+ async submit2DToThreeDTask(request: TwoDToThreeDTaskRequest, options?: RequestOptions): Promise<TwoDToThreeDTaskResponse> {
74
+ return this.request<TwoDToThreeDTaskResponse>('/lib/2d23d/tasks', {
75
+ ...options,
76
+ method: 'POST',
77
+ body: request
78
+ });
79
+ }
80
+
81
+ // 图生图重写任务
82
+ async submitImageRewriteTask(request: ImageRewriteTaskRequest, options?: RequestOptions): Promise<ImageRewriteTaskResponse> {
83
+ return this.request<ImageRewriteTaskResponse>('/lib/rewrite/tasks', {
84
+ ...options,
85
+ method: 'POST',
86
+ body: request
87
+ });
88
+ }
89
+
90
+ // 工业设计任务
91
+ async submitIndustrialDesignTask(request: IndustrialDesignTaskRequest, options?: RequestOptions): Promise<IndustrialDesignTaskResponse> {
92
+ return this.request<IndustrialDesignTaskResponse>('/lib/industrial-design/tasks', {
93
+ ...options,
94
+ method: 'POST',
95
+ body: request
96
+ });
97
+ }
98
+
99
+ // 智能涂抹消除任务
100
+ async submitInpaintingTask(request: InpaintingTaskRequest, options?: RequestOptions): Promise<InpaintingTaskResponse> {
101
+ return this.request<InpaintingTaskResponse>('/lib/inpainting/tasks', {
102
+ ...options,
103
+ method: 'POST',
104
+ body: request
105
+ });
106
+ }
107
+
108
+ // 智能装修任务
109
+ async submitInteriorDesignTask(request: InteriorDesignTaskRequest, options?: RequestOptions): Promise<InteriorDesignTaskResponse> {
110
+ return this.request<InteriorDesignTaskResponse>('/lib/interior-design/tasks', {
111
+ ...options,
112
+ method: 'POST',
113
+ body: request
114
+ });
115
+ }
116
+
117
+ // 老照片修复任务
118
+ async submitOldPhotoRestoreTask(request: OldPhotoRestoreTaskRequest, options?: RequestOptions): Promise<OldPhotoRestoreTaskResponse> {
119
+ return this.request<OldPhotoRestoreTaskResponse>('/old-photo/tasks', {
120
+ ...options,
121
+ method: 'POST',
122
+ body: request
123
+ });
124
+ }
125
+
126
+ // 产品换背景任务
127
+ async submitProductBackgroundTask(request: ProductBackgroundTaskRequest, options?: RequestOptions): Promise<ProductBackgroundTaskResponse> {
128
+ return this.request<ProductBackgroundTaskResponse>('/product-background/tasks', {
129
+ ...options,
130
+ method: 'POST',
131
+ body: request
132
+ });
133
+ }
134
+
135
+ // 青苹果风格洗稿任务
136
+ async submitQingpingguoTask(request: QingpingguoTaskRequest, options?: RequestOptions): Promise<QingpingguoTaskResponse> {
137
+ return this.request<QingpingguoTaskResponse>('/qingpingguo/tasks', {
138
+ ...options,
139
+ method: 'POST',
140
+ body: request
141
+ });
142
+ }
143
+
144
+ // 风格转绘任务
145
+ async submitStyleTransferTask(request: StyleTransferTaskRequest, options?: RequestOptions): Promise<StyleTransferTaskResponse> {
146
+ return this.request<StyleTransferTaskResponse>('/style-transfer/tasks', {
147
+ ...options,
148
+ method: 'POST',
149
+ body: request
150
+ });
151
+ }
152
+
153
+ // 获取任务状态
154
+ async getTaskStatus(request: TaskStatusRequest, options?: RequestOptions): Promise<TaskStatusResponse> {
155
+ return this.request<TaskStatusResponse>(`/comfy/tasks/${request.taskId}`, {
156
+ ...options,
157
+ method: 'GET'
158
+ });
159
+ }
43
160
  }
package/src/types/aigc.ts CHANGED
@@ -54,4 +54,136 @@ export interface ChatCompletionResponse {
54
54
  completion_tokens: number;
55
55
  total_tokens: number;
56
56
  };
57
+ }
58
+
59
+ export interface GaoqingTaskRequest {
60
+ faceImageUrl: string;
61
+ posterImageUrl: string;
62
+ }
63
+
64
+ export interface GaoqingTaskResponse {
65
+ taskId: string;
66
+ result: any;
67
+ statusUrl: string;
68
+ }
69
+
70
+ export interface TwoDToThreeDTaskRequest {
71
+ imageUrl: string;
72
+ }
73
+
74
+ export interface TwoDToThreeDTaskResponse {
75
+ taskId: string;
76
+ statusUrl: string;
77
+ result: any;
78
+ }
79
+
80
+ export interface ImageRewriteTaskRequest {
81
+ imageUrl: string;
82
+ denoise?: number;
83
+ seed?: number;
84
+ batchSize?: number;
85
+ loraStrength?: number;
86
+ }
87
+
88
+ export interface ImageRewriteTaskResponse {
89
+ taskId: string;
90
+ statusUrl: string;
91
+ result: any;
92
+ }
93
+
94
+ export interface IndustrialDesignTaskRequest {
95
+ styleImageUrl: string;
96
+ productImageUrl: string;
97
+ }
98
+
99
+ export interface IndustrialDesignTaskResponse {
100
+ taskId: string;
101
+ statusUrl: string;
102
+ result: any;
103
+ }
104
+
105
+ export interface InpaintingTaskRequest {
106
+ imageUrl: string;
107
+ batchSize?: number;
108
+ resolution?: number;
109
+ }
110
+
111
+ export interface InpaintingTaskResponse {
112
+ taskId: string;
113
+ statusUrl: string;
114
+ author: string;
115
+ features: string[];
116
+ batchSize: number;
117
+ }
118
+
119
+ export interface InteriorDesignTaskRequest {
120
+ originalImage: string;
121
+ designImage: string;
122
+ }
123
+
124
+ export interface InteriorDesignTaskResponse {
125
+ taskId: string;
126
+ statusUrl: string;
127
+ author: string;
128
+ features: string[];
129
+ }
130
+
131
+ export interface OldPhotoRestoreTaskRequest {
132
+ imageUrl: string;
133
+ description?: string;
134
+ }
135
+
136
+ export interface OldPhotoRestoreTaskResponse {
137
+ taskId: string;
138
+ statusUrl: string;
139
+ author: string;
140
+ features: string[];
141
+ }
142
+
143
+ export interface ProductBackgroundTaskRequest {
144
+ imageUrl: string;
145
+ promptText: string;
146
+ }
147
+
148
+ export interface ProductBackgroundTaskResponse {
149
+ taskId: string;
150
+ statusUrl: string;
151
+ result: any;
152
+ }
153
+
154
+ export interface QingpingguoTaskRequest {
155
+ imageUrl: string;
156
+ denoise?: number;
157
+ seed?: number;
158
+ batchSize?: number;
159
+ loraStrength?: number;
160
+ }
161
+
162
+ export interface QingpingguoTaskResponse {
163
+ taskId: string;
164
+ statusUrl: string;
165
+ authorStyle: string;
166
+ resolution: number;
167
+ }
168
+
169
+ export interface StyleTransferTaskRequest {
170
+ imageUrl: string;
171
+ styleCode?: number;
172
+ }
173
+
174
+ export interface StyleTransferTaskResponse {
175
+ taskId: string;
176
+ statusUrl: string;
177
+ selectedStyle: string;
178
+ result: any;
179
+ }
180
+
181
+ export interface TaskStatusRequest {
182
+ taskId: string;
183
+ }
184
+
185
+ export interface TaskStatusResponse {
186
+ status: any;
187
+ progress: number;
188
+ images: any[];
57
189
  }