tencentcloud-sdk-nodejs-aiart 4.0.556

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 @@
1
+ export * from "./services";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./services"), exports);
@@ -0,0 +1,6 @@
1
+ export declare const aiart: {
2
+ v20221229: {
3
+ Client: typeof import("./v20221229/aiart_client").Client;
4
+ Models: typeof import("./v20221229/aiart_models");
5
+ };
6
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aiart = void 0;
4
+ const v20221229_1 = require("./v20221229");
5
+ exports.aiart = {
6
+ v20221229: v20221229_1.v20221229,
7
+ };
@@ -0,0 +1,27 @@
1
+ import * as TencentCloudCommon from "tencentcloud-sdk-nodejs-common";
2
+ import { ImageToImageResponse, ImageToImageRequest, TextToImageRequest, TextToImageResponse } from "./aiart_models";
3
+ /**
4
+ * aiart client
5
+ * @class
6
+ */
7
+ export declare class Client extends TencentCloudCommon.AbstractClient {
8
+ constructor(clientConfig: TencentCloudCommon.ClientConfig);
9
+ /**
10
+ * 智能文生图接口将根据输入的描述文本,智能生成与之相关的结果图。
11
+ 输入:512个字符以内的描述性文本,推荐使用中文。
12
+ 输出:对应风格及分辨率的 AI 生成图。
13
+ 可支持的风格详见 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
14
+
15
+ 请求频率限制为1次/秒。
16
+ */
17
+ TextToImage(req: TextToImageRequest, cb?: (error: string, rep: TextToImageResponse) => void): Promise<TextToImageResponse>;
18
+ /**
19
+ * 智能图生图接口将根据输入的图片及辅助描述文本,智能生成与之相关的结果图。
20
+ 输入:单边分辨率小于2000、转成 Base64 字符串后小于 5MB 的图片,建议同时输入描述文本。
21
+ 输出:对应风格及分辨率的 AI 生成图。
22
+ 可支持的风格详见 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
23
+
24
+ 请求频率限制为1次/秒。
25
+ */
26
+ ImageToImage(req: ImageToImageRequest, cb?: (error: string, rep: ImageToImageResponse) => void): Promise<ImageToImageResponse>;
27
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Client = void 0;
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
+ /*
6
+ * Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing,
15
+ * software distributed under the License is distributed on an
16
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ * KIND, either express or implied. See the License for the
18
+ * specific language governing permissions and limitations
19
+ * under the License.
20
+ */
21
+ const TencentCloudCommon = require("tencentcloud-sdk-nodejs-common");
22
+ /**
23
+ * aiart client
24
+ * @class
25
+ */
26
+ class Client extends TencentCloudCommon.AbstractClient {
27
+ constructor(clientConfig) {
28
+ super("aiart.tencentcloudapi.com", "2022-12-29", clientConfig);
29
+ }
30
+ /**
31
+ * 智能文生图接口将根据输入的描述文本,智能生成与之相关的结果图。
32
+ 输入:512个字符以内的描述性文本,推荐使用中文。
33
+ 输出:对应风格及分辨率的 AI 生成图。
34
+ 可支持的风格详见 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
35
+
36
+ 请求频率限制为1次/秒。
37
+ */
38
+ async TextToImage(req, cb) {
39
+ return this.request("TextToImage", req, cb);
40
+ }
41
+ /**
42
+ * 智能图生图接口将根据输入的图片及辅助描述文本,智能生成与之相关的结果图。
43
+ 输入:单边分辨率小于2000、转成 Base64 字符串后小于 5MB 的图片,建议同时输入描述文本。
44
+ 输出:对应风格及分辨率的 AI 生成图。
45
+ 可支持的风格详见 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
46
+
47
+ 请求频率限制为1次/秒。
48
+ */
49
+ async ImageToImage(req, cb) {
50
+ return this.request("ImageToImage", req, cb);
51
+ }
52
+ }
53
+ exports.Client = Client;
@@ -0,0 +1,187 @@
1
+ /**
2
+ * ImageToImage返回参数结构体
3
+ */
4
+ export interface ImageToImageResponse {
5
+ /**
6
+ * 返回的生成图 Base64 编码。
7
+ */
8
+ ResultImage?: string;
9
+ /**
10
+ * 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
11
+ */
12
+ RequestId?: string;
13
+ }
14
+ /**
15
+ * logo参数
16
+ */
17
+ export interface LogoParam {
18
+ /**
19
+ * 水印url
20
+ 注意:此字段可能返回 null,表示取不到有效值。
21
+ */
22
+ LogoUrl?: string;
23
+ /**
24
+ * 水印base64,url和base64二选一传入
25
+ 注意:此字段可能返回 null,表示取不到有效值。
26
+ */
27
+ LogoImage?: string;
28
+ /**
29
+ * 水印图片位于融合结果图中的坐标,将按照坐标对标识图片进行位置和大小的拉伸匹配
30
+ 注意:此字段可能返回 null,表示取不到有效值。
31
+ */
32
+ LogoRect?: LogoRect;
33
+ }
34
+ /**
35
+ * ImageToImage请求参数结构体
36
+ */
37
+ export interface ImageToImageRequest {
38
+ /**
39
+ * 输入图 Base64 数据。
40
+ 算法将根据输入的图片,结合文本描述智能生成与之相关的图像。
41
+ Base64 和 Url 必须提供一个,如果都提供以 Base64 为准。
42
+ 图片限制:单边分辨率小于2000,转成 Base64 字符串后小于 5MB。
43
+ */
44
+ InputImage?: string;
45
+ /**
46
+ * 输入图 Url。
47
+ 算法将根据输入的图片,结合文本描述智能生成与之相关的图像。
48
+ Base64 和 Url 必须提供一个,如果都提供以 Base64 为准。
49
+ 图片限制:单边分辨率小于2000,转成 Base64 字符串后小于 5MB。
50
+ */
51
+ InputUrl?: string;
52
+ /**
53
+ * 文本描述。
54
+ 用于在输入图的基础上引导生成图效果,建议详细描述画面主体、细节、场景等,文本描述越丰富,生成效果越精美。推荐使用中文。最多支持512个 utf-8 字符。
55
+ 注意:如果不输入任何文本描述,可能导致较差的效果,建议根据期望的效果输入相应的文本描述。
56
+ */
57
+ Prompt?: string;
58
+ /**
59
+ * 反向文本描述。
60
+ 用于一定程度上从反面引导模型生成的走向,减少生成结果中出现描述内容的可能,但不能完全杜绝。
61
+ 推荐使用中文。最多可传512个 utf-8 字符。
62
+ */
63
+ NegativePrompt?: string;
64
+ /**
65
+ * 绘画风格。
66
+ 请在 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250) 中选择期望的风格,传入风格编号。
67
+ 推荐使用且只使用一种风格。不传默认使用201(日系动漫风格)。
68
+ 如果想要探索风格列表之外的风格,也可以尝试在 Prompt 中输入其他的风格描述。
69
+ */
70
+ Styles?: Array<string>;
71
+ /**
72
+ * 生成图结果的配置,包括输出图片分辨率和尺寸等。
73
+ */
74
+ ResultConfig?: ResultConfig;
75
+ /**
76
+ * 为生成结果图添加标识的开关,默认为1。
77
+ 1:添加标识。
78
+ 0:不添加标识。
79
+ 其他数值:默认按1处理。
80
+ 建议您使用显著标识来提示结果图使用了 AI 绘画技术,是 AI 生成的图片。
81
+ */
82
+ LogoAdd?: number;
83
+ /**
84
+ * 标识内容设置。
85
+ 默认在生成结果图右下角添加“图片由 AI 生成”字样,您可根据自身需要替换为其他的标识图片。
86
+ */
87
+ LogoParam?: LogoParam;
88
+ /**
89
+ * 生成自由度。
90
+ Strength 值越小,生成图和原图越接近。取值范围0~1,不传默认为0.6。
91
+ */
92
+ Strength?: number;
93
+ }
94
+ /**
95
+ * 输入框
96
+ */
97
+ export interface LogoRect {
98
+ /**
99
+ * 左上角X坐标
100
+ 注意:此字段可能返回 null,表示取不到有效值。
101
+ */
102
+ X?: number;
103
+ /**
104
+ * 左上角Y坐标
105
+ 注意:此字段可能返回 null,表示取不到有效值。
106
+ */
107
+ Y?: number;
108
+ /**
109
+ * 方框宽度
110
+ 注意:此字段可能返回 null,表示取不到有效值。
111
+ */
112
+ Width?: number;
113
+ /**
114
+ * 方框高度
115
+ 注意:此字段可能返回 null,表示取不到有效值。
116
+ */
117
+ Height?: number;
118
+ }
119
+ /**
120
+ * 返回结果配置
121
+ */
122
+ export interface ResultConfig {
123
+ /**
124
+ * 生成图分辨率
125
+ 支持生成以下不同分辨率的图片,对应1:1方图、3:4竖图、4:3横图三种尺寸规格,不传默认为"768:768"
126
+ 取值:
127
+ ● 768:768
128
+ ● 768:1024
129
+ ● 1024:768
130
+ 注意:此字段可能返回 null,表示取不到有效值。
131
+ */
132
+ Resolution?: string;
133
+ }
134
+ /**
135
+ * TextToImage请求参数结构体
136
+ */
137
+ export interface TextToImageRequest {
138
+ /**
139
+ * 文本描述。
140
+ 算法将根据输入的文本智能生成与之相关的图像。建议详细描述画面主体、细节、场景等,文本描述越丰富,生成效果越精美。
141
+ 不能为空,推荐使用中文。最多可传512个 utf-8 字符。
142
+ */
143
+ Prompt: string;
144
+ /**
145
+ * 反向文本描述。
146
+ 用于一定程度上从反面引导模型生成的走向,减少生成结果中出现描述内容的可能,但不能完全杜绝。
147
+ 推荐使用中文。最多可传512个 utf-8 字符。
148
+ */
149
+ NegativePrompt?: string;
150
+ /**
151
+ * 绘画风格。
152
+ 请在 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249) 中选择期望的风格,传入风格编号。
153
+ 推荐使用且只使用一种风格。不传默认使用201(日系动漫风格)。
154
+ 如果想要探索风格列表之外的风格,也可以尝试在 Prompt 中输入其他的风格描述。
155
+ */
156
+ Styles?: Array<string>;
157
+ /**
158
+ * 生成图结果的配置,包括输出图片分辨率和尺寸等。
159
+ */
160
+ ResultConfig?: ResultConfig;
161
+ /**
162
+ * 为生成结果图添加标识的开关,默认为1。
163
+ 1:添加标识。
164
+ 0:不添加标识。
165
+ 其他数值:默认按1处理。
166
+ 建议您使用显著标识来提示结果图使用了 AI 绘画技术,是 AI 生成的图片。
167
+ */
168
+ LogoAdd?: number;
169
+ /**
170
+ * 标识内容设置。
171
+ 默认在生成结果图右下角添加“图片由 AI 生成”字样,您可根据自身需要替换为其他的标识图片。
172
+ */
173
+ LogoParam?: LogoParam;
174
+ }
175
+ /**
176
+ * TextToImage返回参数结构体
177
+ */
178
+ export interface TextToImageResponse {
179
+ /**
180
+ * 返回的生成图 Base64 编码。
181
+ */
182
+ ResultImage?: string;
183
+ /**
184
+ * 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
185
+ */
186
+ RequestId?: string;
187
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import * as Models from "./aiart_models";
2
+ import { Client } from "./aiart_client";
3
+ export declare const v20221229: {
4
+ Client: typeof Client;
5
+ Models: typeof Models;
6
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.v20221229 = void 0;
4
+ const Models = require("./aiart_models");
5
+ const aiart_client_1 = require("./aiart_client");
6
+ exports.v20221229 = {
7
+ Client: aiart_client_1.Client,
8
+ Models: Models,
9
+ };
@@ -0,0 +1 @@
1
+ export { aiart } from "./aiart";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var aiart_1 = require("./aiart");
4
+ Object.defineProperty(exports, "aiart", { enumerable: true, get: function () { return aiart_1.aiart; } });
package/tsconfig.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "compilerOptions": {
3
+ // "incremental": true, /* 增量编译 提高编译速度*/
4
+ "target": "ES2019" /* 编译目标ES版本*/,
5
+ "module": "commonjs" /* 编译目标模块系统*/,
6
+ // "lib": [], /* 编译过程中需要引入的库文件列表*/
7
+ "declaration": true /* 编译时创建声明文件 */,
8
+ "outDir": "tencentcloud" /* ts编译输出目录 */,
9
+ "rootDir": "src" /* ts编译根目录. */,
10
+ "importHelpers": true /* 从tslib导入辅助工具函数(如__importDefault)*/,
11
+ "strict": true /* 严格模式开关 等价于noImplicitAny、strictNullChecks、strictFunctionTypes、strictBindCallApply等设置true */,
12
+ "strictNullChecks": false,
13
+ "noUnusedLocals": false /* 未使用局部变量报错*/,
14
+ "noUnusedParameters": false /* 未使用参数报错*/,
15
+ "noImplicitReturns": true /* 有代码路径没有返回值时报错*/,
16
+ "noFallthroughCasesInSwitch": true /* 不允许switch的case语句贯穿*/,
17
+ "moduleResolution": "node" /* 模块解析策略 */,
18
+ "typeRoots": [
19
+ /* 要包含的类型声明文件路径列表*/
20
+ "./typings",
21
+ "./node_modules/@types"
22
+ ],
23
+ "allowSyntheticDefaultImports": true /* 允许从没有设置默认导出的模块中默认导入,仅用于提示,不影响编译结果*/,
24
+ "esModuleInterop": false /* 允许编译生成文件时,在代码中注入工具类(__importDefault、__importStar)对ESM与commonjs混用情况做兼容处理*/,
25
+ "sourceMap": false
26
+ },
27
+ "include": [
28
+ /* 需要编译的文件 */
29
+ "src/**/*.ts",
30
+ "typings/**/*.ts"
31
+ ],
32
+ "exclude": []
33
+ }
@@ -0,0 +1,2 @@
1
+ declare module "get-stream"
2
+ declare module "is-stream"