@wzyjs/utils 0.3.3 → 0.3.4

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.
Files changed (47) hide show
  1. package/dist/common/ai/302/audio/doubao.d.ts +29 -0
  2. package/dist/common/ai/302/audio/index.d.ts +2 -0
  3. package/dist/common/ai/302/audio/tts.d.ts +51 -0
  4. package/dist/common/ai/302/image/gpt.d.ts +97 -0
  5. package/dist/{ai → common/ai}/302/image/index.d.ts +1 -0
  6. package/dist/common/ai/302/index.d.ts +3 -0
  7. package/dist/common/ai/doubao/index.d.ts +2 -0
  8. package/dist/common/ai/doubao/tts.d.ts +30 -0
  9. package/dist/common/ai/doubao/vc.d.ts +21 -0
  10. package/dist/common/base/index.d.ts +6 -0
  11. package/dist/common/index.d.ts +5 -11
  12. package/dist/node.cjs.js +838 -190
  13. package/dist/node.d.ts +11 -2
  14. package/dist/node.esm.js +844 -194
  15. package/dist/{browser.cjs.js → web.cjs.js} +20887 -19828
  16. package/dist/web.d.ts +15 -0
  17. package/dist/{browser.esm.js → web.esm.js} +20394 -19333
  18. package/package.json +14 -14
  19. package/dist/ai/302/index.d.ts +0 -1
  20. package/dist/ai/index.d.ts +0 -1
  21. package/dist/ai/midjourney/index.d.ts +0 -1
  22. package/dist/ai/midjourney/utils.d.ts +0 -12
  23. package/dist/browser/index.d.ts +0 -10
  24. package/dist/browser.d.ts +0 -2
  25. package/dist/node/index.d.ts +0 -6
  26. /package/dist/{ai → common/ai}/302/axios.d.ts +0 -0
  27. /package/dist/{ai → common/ai}/302/chat/index.d.ts +0 -0
  28. /package/dist/{ai → common/ai}/302/image/midjourney.d.ts +0 -0
  29. /package/dist/{ai → common/ai}/keling/axios.d.ts +0 -0
  30. /package/dist/{ai → common/ai}/keling/index.d.ts +0 -0
  31. /package/dist/{ai → common/ai}/keling/utils.d.ts +0 -0
  32. /package/dist/common/{array.d.ts → base/array.d.ts} +0 -0
  33. /package/dist/common/{number.d.ts → base/number.d.ts} +0 -0
  34. /package/dist/common/{object.d.ts → base/object.d.ts} +0 -0
  35. /package/dist/common/{other.d.ts → base/other.d.ts} +0 -0
  36. /package/dist/common/{promise.d.ts → base/promise.d.ts} +0 -0
  37. /package/dist/common/{string.d.ts → base/string.d.ts} +0 -0
  38. /package/dist/node/{cron/index.d.ts → cron.d.ts} +0 -0
  39. /package/dist/node/{file/index.d.ts → file.d.ts} +0 -0
  40. /package/dist/node/{mail/index.d.ts → mail.d.ts} +0 -0
  41. /package/dist/node/{oss/index.d.ts → oss.d.ts} +0 -0
  42. /package/dist/{common → web}/antd.d.ts +0 -0
  43. /package/dist/{browser/other.d.ts → web/clipboard.d.ts} +0 -0
  44. /package/dist/{browser → web}/download.d.ts +0 -0
  45. /package/dist/{browser → web}/element.d.ts +0 -0
  46. /package/dist/{browser → web}/location.d.ts +0 -0
  47. /package/dist/{browser → web}/style.d.ts +0 -0
@@ -0,0 +1,29 @@
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>;
@@ -0,0 +1,2 @@
1
+ export * as tts from './tts';
2
+ export * as doubao from './doubao';
@@ -0,0 +1,51 @@
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>;
@@ -0,0 +1,97 @@
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 +1,2 @@
1
1
  export * as midjourney from './midjourney';
2
+ export * as gpt from './gpt';
@@ -0,0 +1,3 @@
1
+ export * from './chat';
2
+ export * as audio from './audio';
3
+ export * as image from './image';
@@ -0,0 +1,2 @@
1
+ export * from './tts';
2
+ export * from './vc';
@@ -0,0 +1,30 @@
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>;
@@ -0,0 +1,21 @@
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
+ };
@@ -0,0 +1,6 @@
1
+ export * from './array';
2
+ export * from './number';
3
+ export * from './object';
4
+ export * from './other';
5
+ export * from './promise';
6
+ export * from './string';
@@ -1,13 +1,7 @@
1
- export { default as _ } from 'lodash';
2
- export { default as axios } from 'axios';
3
- export { default as json5 } from 'json5';
4
- export { default as consola } from 'consola';
5
- export * from 'zod';
6
- export * from './string';
7
- export * from './object';
8
- export * from './other';
9
- export * from './number';
10
- export * from './array';
11
- export * from './image';
1
+ export * as ai302 from './ai/302';
2
+ export * as doubao from './ai/doubao';
3
+ export * as keling from './ai/keling';
4
+ export * from './base';
12
5
  export * from './enum';
6
+ export * from './image';
13
7
  export { default as dayjs, Dayjs, Timezone, initChinaDayjs, chinaDayjs } from './dayjs';