@wzyjs/utils 0.3.4 → 0.3.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.
- package/dist/common/ai/302/image/index.d.ts +0 -1
- package/dist/common/ai/302/index.d.ts +0 -2
- package/dist/common/index.d.ts +3 -5
- package/dist/node.cjs.js +158 -3289
- package/dist/node.esm.js +155 -3286
- package/dist/web.cjs.js +112 -3238
- package/dist/web.esm.js +119 -3245
- package/package.json +2 -2
- package/dist/common/ai/302/audio/doubao.d.ts +0 -29
- package/dist/common/ai/302/audio/index.d.ts +0 -2
- package/dist/common/ai/302/audio/tts.d.ts +0 -51
- package/dist/common/ai/302/image/gpt.d.ts +0 -97
- package/dist/common/ai/doubao/index.d.ts +0 -2
- package/dist/common/ai/doubao/tts.d.ts +0 -30
- package/dist/common/ai/doubao/vc.d.ts +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"@types/nodemailer": "^6.4.7",
|
|
70
70
|
"@types/papaparse": "^5.3.15"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "3e0b376c19e23a470826c7d512d901b0ad630cfb"
|
|
73
73
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type DoubaoTtsHdEncoding = 'wav' | 'pcm' | 'ogg_opus' | 'mp3';
|
|
2
|
-
export interface DoubaoTtsHdAudioParams {
|
|
3
|
-
voice_type: string;
|
|
4
|
-
encoding?: DoubaoTtsHdEncoding;
|
|
5
|
-
speed_ratio?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface DoubaoTtsHdRequestParams {
|
|
8
|
-
reqid?: string;
|
|
9
|
-
text: string;
|
|
10
|
-
operation?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface DoubaoTtsHdRequest {
|
|
13
|
-
audio: DoubaoTtsHdAudioParams;
|
|
14
|
-
request: DoubaoTtsHdRequestParams;
|
|
15
|
-
}
|
|
16
|
-
export interface DoubaoTtsHdResponseAddition {
|
|
17
|
-
duration: string;
|
|
18
|
-
first_pkg: string;
|
|
19
|
-
}
|
|
20
|
-
export interface DoubaoTtsHdResponse {
|
|
21
|
-
reqid: string;
|
|
22
|
-
code: number;
|
|
23
|
-
operation: string;
|
|
24
|
-
message: string;
|
|
25
|
-
sequence: number;
|
|
26
|
-
data: string;
|
|
27
|
-
addition: DoubaoTtsHdResponseAddition;
|
|
28
|
-
}
|
|
29
|
-
export declare const ttsHd: <T = DoubaoTtsHdResponse>(payload: DoubaoTtsHdRequest) => Promise<T>;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type AudioTtsProvider = 'openai' | 'doubao' | 'azure' | 'fish' | 'minimaxi' | 'dubbingx' | 'elevenlabs' | 'elevenlabs-official' | 'meruka' | 'google' | 'qwen';
|
|
2
|
-
export declare const fetchProviders: <T = unknown>() => Promise<T>;
|
|
3
|
-
export interface AudioTtsQueryParams {
|
|
4
|
-
webhook?: string;
|
|
5
|
-
run_async?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface AudioTtsBody {
|
|
8
|
-
text: string;
|
|
9
|
-
provider: AudioTtsProvider;
|
|
10
|
-
voice: string;
|
|
11
|
-
model?: string;
|
|
12
|
-
speed?: number;
|
|
13
|
-
volume?: number;
|
|
14
|
-
emotion?: string;
|
|
15
|
-
output_format?: string;
|
|
16
|
-
timeout?: number;
|
|
17
|
-
}
|
|
18
|
-
export interface AudioTtsRequest extends AudioTtsBody, AudioTtsQueryParams {
|
|
19
|
-
}
|
|
20
|
-
export declare const textToSpeech: <T = unknown>(request: AudioTtsRequest) => Promise<T>;
|
|
21
|
-
export type AudioTtsTaskStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
22
|
-
export interface AudioTtsTaskReq {
|
|
23
|
-
text: string;
|
|
24
|
-
provider: AudioTtsProvider | string;
|
|
25
|
-
model: string;
|
|
26
|
-
voice: string;
|
|
27
|
-
speed: string | number;
|
|
28
|
-
volume: string | number;
|
|
29
|
-
emotion: string;
|
|
30
|
-
output_format: string;
|
|
31
|
-
timeout: number;
|
|
32
|
-
}
|
|
33
|
-
export interface AudioTtsTaskResponse {
|
|
34
|
-
model: string;
|
|
35
|
-
status: AudioTtsTaskStatus;
|
|
36
|
-
provider: string;
|
|
37
|
-
task_id: string;
|
|
38
|
-
req: AudioTtsTaskReq;
|
|
39
|
-
created_at: string;
|
|
40
|
-
webhook: string;
|
|
41
|
-
task_type: string;
|
|
42
|
-
execution_time: string;
|
|
43
|
-
audio_url: string;
|
|
44
|
-
raw_response?: unknown;
|
|
45
|
-
updated_at?: string;
|
|
46
|
-
attempts?: string;
|
|
47
|
-
upstream_task_id?: string;
|
|
48
|
-
completed_at?: string;
|
|
49
|
-
started_at?: string;
|
|
50
|
-
}
|
|
51
|
-
export declare const fetchTask: <T = AudioTtsTaskResponse>(taskId: string) => Promise<T>;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export interface GenerateImageParams {
|
|
2
|
-
/**
|
|
3
|
-
* 描述文本
|
|
4
|
-
* 长度 ≤ 32 k(gpt-image-1.5)
|
|
5
|
-
*/
|
|
6
|
-
prompt: string;
|
|
7
|
-
/**
|
|
8
|
-
* 模型
|
|
9
|
-
* 可选:gpt-image-1.5 / gpt-image-1 / gpt-image-1-mini / dall-e-3 / gpt-4o-plus
|
|
10
|
-
*/
|
|
11
|
-
model: 'gpt-image-1.5' | 'gpt-image-1' | 'gpt-image-1-mini' | 'dall-e-3' | 'gpt-4o-plus';
|
|
12
|
-
/**
|
|
13
|
-
* 生成张数
|
|
14
|
-
* 1-10;dall-e-3 仅支持 1
|
|
15
|
-
* @default 1
|
|
16
|
-
*/
|
|
17
|
-
n?: number;
|
|
18
|
-
/**
|
|
19
|
-
* 尺寸
|
|
20
|
-
* 1024x1024、1536x1024(横向)、1024x1536(纵向)、auto
|
|
21
|
-
* DALL-E-3 支持 1792x1024
|
|
22
|
-
* 尺寸选择 `auto` 时,模型会根据提示词自动给出最佳比例。
|
|
23
|
-
* @default 'auto'
|
|
24
|
-
*/
|
|
25
|
-
size?: '1024x1024' | '1536x1024' | '1024x1536' | '1792x1024' | 'auto';
|
|
26
|
-
/**
|
|
27
|
-
* 质量
|
|
28
|
-
* low / medium / high / auto
|
|
29
|
-
* @default 'auto'
|
|
30
|
-
*/
|
|
31
|
-
quality?: 'low' | 'medium' | 'high' | 'auto';
|
|
32
|
-
/**
|
|
33
|
-
* 背景
|
|
34
|
-
* transparent / opaque / auto
|
|
35
|
-
* @default 'auto'
|
|
36
|
-
*/
|
|
37
|
-
background?: 'transparent' | 'opaque' | 'auto';
|
|
38
|
-
/**
|
|
39
|
-
* 输出格式
|
|
40
|
-
* png / jpeg / webp
|
|
41
|
-
* @default 'png'
|
|
42
|
-
*/
|
|
43
|
-
output_format?: 'png' | 'jpeg' | 'webp';
|
|
44
|
-
/**
|
|
45
|
-
* 压缩率
|
|
46
|
-
* 0-100;仅 jpeg/webp 生效
|
|
47
|
-
* @default 100
|
|
48
|
-
*/
|
|
49
|
-
output_compression?: number;
|
|
50
|
-
/**
|
|
51
|
-
* 审核严格度
|
|
52
|
-
* low(宽松) / auto
|
|
53
|
-
* @default 'auto'
|
|
54
|
-
*/
|
|
55
|
-
moderation?: 'low' | 'auto';
|
|
56
|
-
/**
|
|
57
|
-
* 流式输出
|
|
58
|
-
* 仅 GPT-Image 系列支持
|
|
59
|
-
* @default false
|
|
60
|
-
*/
|
|
61
|
-
stream?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* 流式分片数
|
|
64
|
-
* 0-3;0=仅返回最终图
|
|
65
|
-
* @default 0
|
|
66
|
-
*/
|
|
67
|
-
partial_images?: number;
|
|
68
|
-
}
|
|
69
|
-
export interface ImageObject {
|
|
70
|
-
url: string;
|
|
71
|
-
}
|
|
72
|
-
export interface TokenDetails {
|
|
73
|
-
image_tokens: number;
|
|
74
|
-
text_tokens: number;
|
|
75
|
-
}
|
|
76
|
-
export interface Usage {
|
|
77
|
-
input_tokens: number;
|
|
78
|
-
input_tokens_details: TokenDetails;
|
|
79
|
-
output_tokens: number;
|
|
80
|
-
output_tokens_details: TokenDetails;
|
|
81
|
-
total_tokens: number;
|
|
82
|
-
}
|
|
83
|
-
export interface GenerateImageResponse {
|
|
84
|
-
background: string;
|
|
85
|
-
created: number;
|
|
86
|
-
data: ImageObject[];
|
|
87
|
-
output_format: string;
|
|
88
|
-
quality: string;
|
|
89
|
-
size: string;
|
|
90
|
-
usage: Usage;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 根据文本提示生成一张或多张高质量图像
|
|
94
|
-
* @param params GenerateImageParams
|
|
95
|
-
* @returns Promise<GenerateImageResponse>
|
|
96
|
-
*/
|
|
97
|
-
export declare const generateImage: (params: GenerateImageParams) => Promise<GenerateImageResponse>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface DoubaoTtsAppConfig {
|
|
2
|
-
appid?: string;
|
|
3
|
-
accessToken?: string;
|
|
4
|
-
resourceId?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface DoubaoTtsUserConfig {
|
|
7
|
-
uid?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface DoubaoTtsAudioConfig {
|
|
10
|
-
voice_type: string;
|
|
11
|
-
encoding?: 'mp3' | 'pcm' | 'wav' | 'aac' | 'ogg_opus';
|
|
12
|
-
speed_ratio?: number;
|
|
13
|
-
volume_ratio?: number;
|
|
14
|
-
pitch_ratio?: number;
|
|
15
|
-
emotion?: string;
|
|
16
|
-
emotion_scale?: number;
|
|
17
|
-
context_texts?: string[];
|
|
18
|
-
language?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface DoubaoTtsRequestConfig {
|
|
21
|
-
reqid?: string;
|
|
22
|
-
text: string;
|
|
23
|
-
}
|
|
24
|
-
export interface DoubaoTtsParams {
|
|
25
|
-
app: DoubaoTtsAppConfig;
|
|
26
|
-
user?: DoubaoTtsUserConfig;
|
|
27
|
-
audio: DoubaoTtsAudioConfig;
|
|
28
|
-
request: DoubaoTtsRequestConfig;
|
|
29
|
-
}
|
|
30
|
-
export declare const tts: (params: DoubaoTtsParams) => Promise<ArrayBuffer>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface DoubaoVcAppConfig {
|
|
2
|
-
appid: string;
|
|
3
|
-
accessToken: string;
|
|
4
|
-
}
|
|
5
|
-
export interface DoubaoVcSubmitParams {
|
|
6
|
-
app: DoubaoVcAppConfig;
|
|
7
|
-
options?: Record<string, any>;
|
|
8
|
-
audio: {
|
|
9
|
-
data: ArrayBuffer | Buffer;
|
|
10
|
-
contentType?: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface DoubaoVcQueryParams {
|
|
14
|
-
app: DoubaoVcAppConfig;
|
|
15
|
-
id: string;
|
|
16
|
-
blocking?: string | number;
|
|
17
|
-
}
|
|
18
|
-
export declare const vc: {
|
|
19
|
-
submit: (params: DoubaoVcSubmitParams) => Promise<ArrayBuffer>;
|
|
20
|
-
query: (params: DoubaoVcQueryParams) => Promise<ArrayBuffer>;
|
|
21
|
-
};
|