| 
									
										
										
										
											2024-02-18 15:54:14 +08:00
										 |  |  | // Types.d.ts
 | 
					
						
							|  |  |  | export const BASE_URL: string; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export type RequestMethods = 'GET' | 'POST' | 'PATCH' | 'DELETE'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | interface Params { | 
					
						
							|  |  |  |   [key: string]: any; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | interface HeaderParams { | 
					
						
							|  |  |  |   [key: string]: string; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | interface User { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export declare class DifyClient { | 
					
						
							|  |  |  |   constructor(apiKey: string, baseUrl?: string); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   updateApiKey(apiKey: string): void; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   sendRequest( | 
					
						
							|  |  |  |     method: RequestMethods, | 
					
						
							|  |  |  |     endpoint: string, | 
					
						
							|  |  |  |     data?: any, | 
					
						
							|  |  |  |     params?: Params, | 
					
						
							|  |  |  |     stream?: boolean, | 
					
						
							|  |  |  |     headerParams?: HeaderParams | 
					
						
							| 
									
										
										
										
											2025-04-29 18:04:33 +08:00
										 |  |  |   ): Promise<any>; | 
					
						
							| 
									
										
										
										
											2024-02-18 15:54:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   messageFeedback(message_id: string, rating: number, user: User): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   getApplicationParameters(user: User): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   fileUpload(data: FormData): Promise<any>; | 
					
						
							| 
									
										
										
										
											2024-08-16 20:21:08 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   textToAudio(text: string ,user: string, streaming?: boolean): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   getMeta(user: User): Promise<any>; | 
					
						
							| 
									
										
										
										
											2024-02-18 15:54:14 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export declare class CompletionClient extends DifyClient { | 
					
						
							|  |  |  |   createCompletionMessage( | 
					
						
							|  |  |  |     inputs: any, | 
					
						
							|  |  |  |     user: User, | 
					
						
							|  |  |  |     stream?: boolean, | 
					
						
							|  |  |  |     files?: File[] | null | 
					
						
							|  |  |  |   ): Promise<any>; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export declare class ChatClient extends DifyClient { | 
					
						
							| 
									
										
										
										
											2024-06-02 22:03:42 +09:00
										 |  |  |   createChatMessage( | 
					
						
							|  |  |  |     inputs: any, | 
					
						
							|  |  |  |     query: string, | 
					
						
							|  |  |  |     user: User, | 
					
						
							|  |  |  |     stream?: boolean, | 
					
						
							|  |  |  |     conversation_id?: string | null, | 
					
						
							|  |  |  |     files?: File[] | null | 
					
						
							|  |  |  |   ): Promise<any>; | 
					
						
							| 
									
										
										
										
											2024-02-18 15:54:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-16 20:21:08 +08:00
										 |  |  |   getSuggested(message_id: string, user: User): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   stopMessage(task_id: string, user: User) : Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   getConversations( | 
					
						
							| 
									
										
										
										
											2025-04-29 18:04:33 +08:00
										 |  |  |     user: User, | 
					
						
							|  |  |  |     first_id?: string | null, | 
					
						
							|  |  |  |     limit?: number | null, | 
					
						
							| 
									
										
										
										
											2024-08-16 20:21:08 +08:00
										 |  |  |     pinned?: boolean | null | 
					
						
							|  |  |  |   ): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-18 15:54:14 +08:00
										 |  |  |   getConversationMessages( | 
					
						
							|  |  |  |     user: User, | 
					
						
							|  |  |  |     conversation_id?: string, | 
					
						
							|  |  |  |     first_id?: string | null, | 
					
						
							|  |  |  |     limit?: number | null | 
					
						
							|  |  |  |   ): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-16 20:21:08 +08:00
										 |  |  |   renameConversation(conversation_id: string, name: string,  user: User,auto_generate:boolean): Promise<any>; | 
					
						
							| 
									
										
										
										
											2024-02-18 15:54:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   deleteConversation(conversation_id: string, user: User): Promise<any>; | 
					
						
							| 
									
										
										
										
											2025-04-29 18:04:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-16 20:21:08 +08:00
										 |  |  |   audioToText(data: FormData): Promise<any>; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export declare class WorkflowClient extends DifyClient { | 
					
						
							|  |  |  |   run(inputs: any, user: User, stream?: boolean,): Promise<any>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   stop(task_id: string, user: User): Promise<any>; | 
					
						
							| 
									
										
										
										
											2025-04-29 18:04:33 +08:00
										 |  |  | } |