@howone/sdk 0.3.10 → 0.3.12
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/index.d.mts +201 -27
- package/dist/index.d.ts +201 -27
- package/dist/index.js +204 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +202 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,118 @@ interface FloatingButtonProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const FloatingButton: React$1.FC<FloatingButtonProps>;
|
|
13
13
|
|
|
14
|
+
interface RequestInterceptors<T = AxiosResponse> {
|
|
15
|
+
requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
|
|
16
|
+
requestInterceptorCatch?: (error: any) => any;
|
|
17
|
+
responseInterceptor?: (res: T) => T;
|
|
18
|
+
responseInterceptorCatch?: (error: any) => any;
|
|
19
|
+
}
|
|
20
|
+
interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
|
|
21
|
+
interceptors?: RequestInterceptors<T>;
|
|
22
|
+
showLoading?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class Request {
|
|
26
|
+
instance: AxiosInstance;
|
|
27
|
+
interceptors?: RequestInterceptors;
|
|
28
|
+
abortControllers: Map<string, AbortController>;
|
|
29
|
+
constructor(config: RequestConfig);
|
|
30
|
+
cancelRequest(url: string): void;
|
|
31
|
+
cancelAllRequests(): void;
|
|
32
|
+
request<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
33
|
+
get<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
34
|
+
post<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
35
|
+
delete<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
36
|
+
put<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
37
|
+
patch<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* AI 功能客户端
|
|
42
|
+
*
|
|
43
|
+
* 包含图片生成、修改等 AI 相关功能
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 图片生成/修改选项
|
|
48
|
+
*/
|
|
49
|
+
interface GenerateImageOptions {
|
|
50
|
+
imageUrl: string;
|
|
51
|
+
description: string;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 图片生成结果
|
|
56
|
+
*/
|
|
57
|
+
interface GenerateImageResponse {
|
|
58
|
+
imageUrl: string;
|
|
59
|
+
taskId?: string;
|
|
60
|
+
metadata?: Record<string, any>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 创建 AI 客户端
|
|
64
|
+
*/
|
|
65
|
+
declare function createAIClient(req: Request, projectId?: string): {
|
|
66
|
+
/**
|
|
67
|
+
* 生成/修改图片
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const result = await client.ai.generateImage({
|
|
72
|
+
* imageUrl: 'https://example.com/image.jpg',
|
|
73
|
+
* description: '把天空改成蓝色'
|
|
74
|
+
* })
|
|
75
|
+
* console.log('新图片:', result.imageUrl)
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
generateImage(options: GenerateImageOptions): Promise<GenerateImageResponse>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 文件上传类型定义
|
|
83
|
+
*
|
|
84
|
+
* 独立的上传模块,不依赖 Artifact
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* 上传选项
|
|
88
|
+
*/
|
|
89
|
+
interface UploadOptions {
|
|
90
|
+
onProgress?: (percent: number) => void;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
metadata?: Record<string, any>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 上传结果
|
|
96
|
+
*/
|
|
97
|
+
interface UploadResponse {
|
|
98
|
+
url: string;
|
|
99
|
+
thumbnailUrl?: string;
|
|
100
|
+
id?: string;
|
|
101
|
+
size?: number;
|
|
102
|
+
mimeType?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 批量上传选项
|
|
106
|
+
*/
|
|
107
|
+
interface BatchUploadOptions {
|
|
108
|
+
files: (File | Blob)[];
|
|
109
|
+
concurrent?: number;
|
|
110
|
+
onProgress?: (completed: number, total: number) => void;
|
|
111
|
+
onFileComplete?: (result: UploadResponse | Error, index: number) => void;
|
|
112
|
+
signal?: AbortSignal;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 批量上传结果
|
|
116
|
+
*/
|
|
117
|
+
interface BatchUploadResponse {
|
|
118
|
+
success: UploadResponse[];
|
|
119
|
+
failed: Array<{
|
|
120
|
+
index: number;
|
|
121
|
+
error: string;
|
|
122
|
+
}>;
|
|
123
|
+
total: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
14
126
|
/**
|
|
15
127
|
* 统一的 SSE 工作流执行模块
|
|
16
128
|
*
|
|
@@ -336,32 +448,6 @@ declare class AIWorkflowClient {
|
|
|
336
448
|
declare function createAIWorkflowClient(options?: AIWorkflowClientOptions): AIWorkflowClient;
|
|
337
449
|
declare const aiWorkflow: AIWorkflowClient;
|
|
338
450
|
|
|
339
|
-
interface RequestInterceptors<T = AxiosResponse> {
|
|
340
|
-
requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
|
|
341
|
-
requestInterceptorCatch?: (error: any) => any;
|
|
342
|
-
responseInterceptor?: (res: T) => T;
|
|
343
|
-
responseInterceptorCatch?: (error: any) => any;
|
|
344
|
-
}
|
|
345
|
-
interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
|
|
346
|
-
interceptors?: RequestInterceptors<T>;
|
|
347
|
-
showLoading?: boolean;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
declare class Request {
|
|
351
|
-
instance: AxiosInstance;
|
|
352
|
-
interceptors?: RequestInterceptors;
|
|
353
|
-
abortControllers: Map<string, AbortController>;
|
|
354
|
-
constructor(config: RequestConfig);
|
|
355
|
-
cancelRequest(url: string): void;
|
|
356
|
-
cancelAllRequests(): void;
|
|
357
|
-
request<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
358
|
-
get<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
359
|
-
post<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
360
|
-
delete<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
361
|
-
put<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
362
|
-
patch<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
451
|
interface AxiosAIWorkflowOptions {
|
|
366
452
|
baseUrl?: string;
|
|
367
453
|
basePath?: string;
|
|
@@ -435,6 +521,51 @@ declare function createArtifactsClient(req: Request): {
|
|
|
435
521
|
canAccessLocal(a: Artifact, ctx: AccessContext): boolean;
|
|
436
522
|
};
|
|
437
523
|
|
|
524
|
+
/**
|
|
525
|
+
* 文件上传客户端
|
|
526
|
+
*
|
|
527
|
+
* 独立的上传功能,不依赖其他模块
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
declare function createUploadClient(req: Request, projectId?: string): {
|
|
531
|
+
/**
|
|
532
|
+
* 上传单个文件
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```typescript
|
|
536
|
+
* const { url } = await client.upload.file(imageFile)
|
|
537
|
+
* console.log('文件地址:', url)
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
file(file: File | Blob | string, options?: UploadOptions): Promise<UploadResponse>;
|
|
541
|
+
/**
|
|
542
|
+
* 上传图片(快捷方法,专为 AI 设计)
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```typescript
|
|
546
|
+
* const { url } = await client.upload.image(imageFile)
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
image(file: File | Blob | string): Promise<{
|
|
550
|
+
url: string;
|
|
551
|
+
}>;
|
|
552
|
+
/**
|
|
553
|
+
* 批量上传文件
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```typescript
|
|
557
|
+
* const result = await client.upload.batch({
|
|
558
|
+
* files: [file1, file2, file3],
|
|
559
|
+
* concurrent: 3,
|
|
560
|
+
* onProgress: (completed, total) => {
|
|
561
|
+
* console.log(`${completed}/${total}`)
|
|
562
|
+
* }
|
|
563
|
+
* })
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
566
|
+
batch(options: BatchUploadOptions): Promise<BatchUploadResponse>;
|
|
567
|
+
};
|
|
568
|
+
|
|
438
569
|
declare const AUTH_TOKEN_KEY = "auth_token";
|
|
439
570
|
declare function setToken(token: string | null): void;
|
|
440
571
|
declare function getToken(): string | null;
|
|
@@ -854,6 +985,49 @@ declare function createClient(opts: {
|
|
|
854
985
|
setVisibility(id: string, visibility: string): Promise<void>;
|
|
855
986
|
delete(id: string): Promise<void>;
|
|
856
987
|
};
|
|
988
|
+
/**
|
|
989
|
+
* 文件上传模块(独立,不依赖 artifact)
|
|
990
|
+
*
|
|
991
|
+
* @example
|
|
992
|
+
* ```typescript
|
|
993
|
+
* // 最简单的用法
|
|
994
|
+
* const { url } = await client.upload.file(imageFile)
|
|
995
|
+
* console.log('文件地址:', url)
|
|
996
|
+
*
|
|
997
|
+
* // AI 友好版本(只返回 url)
|
|
998
|
+
* const { url } = await client.upload.image(imageFile)
|
|
999
|
+
*
|
|
1000
|
+
* // 批量上传
|
|
1001
|
+
* const result = await client.upload.batch({
|
|
1002
|
+
* files: [file1, file2, file3],
|
|
1003
|
+
* concurrent: 3,
|
|
1004
|
+
* onProgress: (completed, total) => console.log(`${completed}/${total}`)
|
|
1005
|
+
* })
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
upload: {
|
|
1009
|
+
file(file: File | Blob | string, options?: UploadOptions): Promise<UploadResponse>;
|
|
1010
|
+
image(file: File | Blob | string): Promise<{
|
|
1011
|
+
url: string;
|
|
1012
|
+
}>;
|
|
1013
|
+
batch(options: BatchUploadOptions): Promise<BatchUploadResponse>;
|
|
1014
|
+
};
|
|
1015
|
+
/**
|
|
1016
|
+
* AI 功能模块
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```typescript
|
|
1020
|
+
* // 图片生成/修改
|
|
1021
|
+
* const result = await client.ai.generateImage({
|
|
1022
|
+
* imageUrl: 'https://example.com/image.jpg',
|
|
1023
|
+
* description: '把天空改成蓝色'
|
|
1024
|
+
* })
|
|
1025
|
+
* console.log('新图片:', result.imageUrl)
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1028
|
+
ai: {
|
|
1029
|
+
generateImage(options: GenerateImageOptions): Promise<GenerateImageResponse>;
|
|
1030
|
+
};
|
|
857
1031
|
me: () => Promise<{
|
|
858
1032
|
id: {};
|
|
859
1033
|
email: string;
|
|
@@ -1200,4 +1374,4 @@ declare const elementSelector: {
|
|
|
1200
1374
|
isActive: () => boolean;
|
|
1201
1375
|
};
|
|
1202
1376
|
|
|
1203
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
|
1377
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, type BatchUploadOptions, type BatchUploadResponse, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, type GenerateImageOptions, type GenerateImageResponse, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type UploadOptions, type UploadResponse, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIClient, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, createUploadClient, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,118 @@ interface FloatingButtonProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const FloatingButton: React$1.FC<FloatingButtonProps>;
|
|
13
13
|
|
|
14
|
+
interface RequestInterceptors<T = AxiosResponse> {
|
|
15
|
+
requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
|
|
16
|
+
requestInterceptorCatch?: (error: any) => any;
|
|
17
|
+
responseInterceptor?: (res: T) => T;
|
|
18
|
+
responseInterceptorCatch?: (error: any) => any;
|
|
19
|
+
}
|
|
20
|
+
interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
|
|
21
|
+
interceptors?: RequestInterceptors<T>;
|
|
22
|
+
showLoading?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class Request {
|
|
26
|
+
instance: AxiosInstance;
|
|
27
|
+
interceptors?: RequestInterceptors;
|
|
28
|
+
abortControllers: Map<string, AbortController>;
|
|
29
|
+
constructor(config: RequestConfig);
|
|
30
|
+
cancelRequest(url: string): void;
|
|
31
|
+
cancelAllRequests(): void;
|
|
32
|
+
request<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
33
|
+
get<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
34
|
+
post<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
35
|
+
delete<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
36
|
+
put<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
37
|
+
patch<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* AI 功能客户端
|
|
42
|
+
*
|
|
43
|
+
* 包含图片生成、修改等 AI 相关功能
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 图片生成/修改选项
|
|
48
|
+
*/
|
|
49
|
+
interface GenerateImageOptions {
|
|
50
|
+
imageUrl: string;
|
|
51
|
+
description: string;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 图片生成结果
|
|
56
|
+
*/
|
|
57
|
+
interface GenerateImageResponse {
|
|
58
|
+
imageUrl: string;
|
|
59
|
+
taskId?: string;
|
|
60
|
+
metadata?: Record<string, any>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 创建 AI 客户端
|
|
64
|
+
*/
|
|
65
|
+
declare function createAIClient(req: Request, projectId?: string): {
|
|
66
|
+
/**
|
|
67
|
+
* 生成/修改图片
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const result = await client.ai.generateImage({
|
|
72
|
+
* imageUrl: 'https://example.com/image.jpg',
|
|
73
|
+
* description: '把天空改成蓝色'
|
|
74
|
+
* })
|
|
75
|
+
* console.log('新图片:', result.imageUrl)
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
generateImage(options: GenerateImageOptions): Promise<GenerateImageResponse>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 文件上传类型定义
|
|
83
|
+
*
|
|
84
|
+
* 独立的上传模块,不依赖 Artifact
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* 上传选项
|
|
88
|
+
*/
|
|
89
|
+
interface UploadOptions {
|
|
90
|
+
onProgress?: (percent: number) => void;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
metadata?: Record<string, any>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 上传结果
|
|
96
|
+
*/
|
|
97
|
+
interface UploadResponse {
|
|
98
|
+
url: string;
|
|
99
|
+
thumbnailUrl?: string;
|
|
100
|
+
id?: string;
|
|
101
|
+
size?: number;
|
|
102
|
+
mimeType?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 批量上传选项
|
|
106
|
+
*/
|
|
107
|
+
interface BatchUploadOptions {
|
|
108
|
+
files: (File | Blob)[];
|
|
109
|
+
concurrent?: number;
|
|
110
|
+
onProgress?: (completed: number, total: number) => void;
|
|
111
|
+
onFileComplete?: (result: UploadResponse | Error, index: number) => void;
|
|
112
|
+
signal?: AbortSignal;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 批量上传结果
|
|
116
|
+
*/
|
|
117
|
+
interface BatchUploadResponse {
|
|
118
|
+
success: UploadResponse[];
|
|
119
|
+
failed: Array<{
|
|
120
|
+
index: number;
|
|
121
|
+
error: string;
|
|
122
|
+
}>;
|
|
123
|
+
total: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
14
126
|
/**
|
|
15
127
|
* 统一的 SSE 工作流执行模块
|
|
16
128
|
*
|
|
@@ -336,32 +448,6 @@ declare class AIWorkflowClient {
|
|
|
336
448
|
declare function createAIWorkflowClient(options?: AIWorkflowClientOptions): AIWorkflowClient;
|
|
337
449
|
declare const aiWorkflow: AIWorkflowClient;
|
|
338
450
|
|
|
339
|
-
interface RequestInterceptors<T = AxiosResponse> {
|
|
340
|
-
requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
|
|
341
|
-
requestInterceptorCatch?: (error: any) => any;
|
|
342
|
-
responseInterceptor?: (res: T) => T;
|
|
343
|
-
responseInterceptorCatch?: (error: any) => any;
|
|
344
|
-
}
|
|
345
|
-
interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
|
|
346
|
-
interceptors?: RequestInterceptors<T>;
|
|
347
|
-
showLoading?: boolean;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
declare class Request {
|
|
351
|
-
instance: AxiosInstance;
|
|
352
|
-
interceptors?: RequestInterceptors;
|
|
353
|
-
abortControllers: Map<string, AbortController>;
|
|
354
|
-
constructor(config: RequestConfig);
|
|
355
|
-
cancelRequest(url: string): void;
|
|
356
|
-
cancelAllRequests(): void;
|
|
357
|
-
request<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
358
|
-
get<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
359
|
-
post<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
360
|
-
delete<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
361
|
-
put<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
362
|
-
patch<T = any>(config: RequestConfig<T>): Promise<T>;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
451
|
interface AxiosAIWorkflowOptions {
|
|
366
452
|
baseUrl?: string;
|
|
367
453
|
basePath?: string;
|
|
@@ -435,6 +521,51 @@ declare function createArtifactsClient(req: Request): {
|
|
|
435
521
|
canAccessLocal(a: Artifact, ctx: AccessContext): boolean;
|
|
436
522
|
};
|
|
437
523
|
|
|
524
|
+
/**
|
|
525
|
+
* 文件上传客户端
|
|
526
|
+
*
|
|
527
|
+
* 独立的上传功能,不依赖其他模块
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
declare function createUploadClient(req: Request, projectId?: string): {
|
|
531
|
+
/**
|
|
532
|
+
* 上传单个文件
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```typescript
|
|
536
|
+
* const { url } = await client.upload.file(imageFile)
|
|
537
|
+
* console.log('文件地址:', url)
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
file(file: File | Blob | string, options?: UploadOptions): Promise<UploadResponse>;
|
|
541
|
+
/**
|
|
542
|
+
* 上传图片(快捷方法,专为 AI 设计)
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```typescript
|
|
546
|
+
* const { url } = await client.upload.image(imageFile)
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
image(file: File | Blob | string): Promise<{
|
|
550
|
+
url: string;
|
|
551
|
+
}>;
|
|
552
|
+
/**
|
|
553
|
+
* 批量上传文件
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```typescript
|
|
557
|
+
* const result = await client.upload.batch({
|
|
558
|
+
* files: [file1, file2, file3],
|
|
559
|
+
* concurrent: 3,
|
|
560
|
+
* onProgress: (completed, total) => {
|
|
561
|
+
* console.log(`${completed}/${total}`)
|
|
562
|
+
* }
|
|
563
|
+
* })
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
566
|
+
batch(options: BatchUploadOptions): Promise<BatchUploadResponse>;
|
|
567
|
+
};
|
|
568
|
+
|
|
438
569
|
declare const AUTH_TOKEN_KEY = "auth_token";
|
|
439
570
|
declare function setToken(token: string | null): void;
|
|
440
571
|
declare function getToken(): string | null;
|
|
@@ -854,6 +985,49 @@ declare function createClient(opts: {
|
|
|
854
985
|
setVisibility(id: string, visibility: string): Promise<void>;
|
|
855
986
|
delete(id: string): Promise<void>;
|
|
856
987
|
};
|
|
988
|
+
/**
|
|
989
|
+
* 文件上传模块(独立,不依赖 artifact)
|
|
990
|
+
*
|
|
991
|
+
* @example
|
|
992
|
+
* ```typescript
|
|
993
|
+
* // 最简单的用法
|
|
994
|
+
* const { url } = await client.upload.file(imageFile)
|
|
995
|
+
* console.log('文件地址:', url)
|
|
996
|
+
*
|
|
997
|
+
* // AI 友好版本(只返回 url)
|
|
998
|
+
* const { url } = await client.upload.image(imageFile)
|
|
999
|
+
*
|
|
1000
|
+
* // 批量上传
|
|
1001
|
+
* const result = await client.upload.batch({
|
|
1002
|
+
* files: [file1, file2, file3],
|
|
1003
|
+
* concurrent: 3,
|
|
1004
|
+
* onProgress: (completed, total) => console.log(`${completed}/${total}`)
|
|
1005
|
+
* })
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
upload: {
|
|
1009
|
+
file(file: File | Blob | string, options?: UploadOptions): Promise<UploadResponse>;
|
|
1010
|
+
image(file: File | Blob | string): Promise<{
|
|
1011
|
+
url: string;
|
|
1012
|
+
}>;
|
|
1013
|
+
batch(options: BatchUploadOptions): Promise<BatchUploadResponse>;
|
|
1014
|
+
};
|
|
1015
|
+
/**
|
|
1016
|
+
* AI 功能模块
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```typescript
|
|
1020
|
+
* // 图片生成/修改
|
|
1021
|
+
* const result = await client.ai.generateImage({
|
|
1022
|
+
* imageUrl: 'https://example.com/image.jpg',
|
|
1023
|
+
* description: '把天空改成蓝色'
|
|
1024
|
+
* })
|
|
1025
|
+
* console.log('新图片:', result.imageUrl)
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1028
|
+
ai: {
|
|
1029
|
+
generateImage(options: GenerateImageOptions): Promise<GenerateImageResponse>;
|
|
1030
|
+
};
|
|
857
1031
|
me: () => Promise<{
|
|
858
1032
|
id: {};
|
|
859
1033
|
email: string;
|
|
@@ -1200,4 +1374,4 @@ declare const elementSelector: {
|
|
|
1200
1374
|
isActive: () => boolean;
|
|
1201
1375
|
};
|
|
1202
1376
|
|
|
1203
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
|
1377
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, type BatchUploadOptions, type BatchUploadResponse, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, type GenerateImageOptions, type GenerateImageResponse, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type UploadOptions, type UploadResponse, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIClient, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, createUploadClient, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|