Underground-Digital/Workflow-Engine
0
1// Types.d.ts2export const BASE_URL: string;3 4export type RequestMethods = 'GET' | 'POST' | 'PATCH' | 'DELETE';5 6interface Params {7 [key: string]: any;8}9 10interface HeaderParams {11 [key: string]: string;12}13 14interface User {15}16 17export declare class DifyClient {18 constructor(apiKey: string, baseUrl?: string);19 20 updateApiKey(apiKey: string): void;21 22 sendRequest(23 method: RequestMethods,24 endpoint: string,25 data?: any,26 params?: Params,27 stream?: boolean,28 headerParams?: HeaderParams29 ): Promise<any>; 30 31 messageFeedback(message_id: string, rating: number, user: User): Promise<any>;32 33 getApplicationParameters(user: User): Promise<any>;34 35 fileUpload(data: FormData): Promise<any>;36 37 textToAudio(text: string ,user: string, streaming?: boolean): Promise<any>;38 39 getMeta(user: User): Promise<any>;40}41 42export declare class CompletionClient extends DifyClient {43 createCompletionMessage(44 inputs: any,45 user: User,46 stream?: boolean,47 files?: File[] | null48 ): Promise<any>;49}50 51export declare class ChatClient extends DifyClient {52 createChatMessage(53 inputs: any,54 query: string,55 user: User,56 stream?: boolean,57 conversation_id?: string | null,58 files?: File[] | null59 ): Promise<any>;60 61 getSuggested(message_id: string, user: User): Promise<any>;62 63 stopMessage(task_id: string, user: User) : Promise<any>;64 65 66 getConversations(67 user: User, 68 first_id?: string | null, 69 limit?: number | null, 70 pinned?: boolean | null71 ): Promise<any>;72 73 getConversationMessages(74 user: User,75 conversation_id?: string,76 first_id?: string | null,77 limit?: number | null78 ): Promise<any>;79 80 renameConversation(conversation_id: string, name: string, user: User,auto_generate:boolean): Promise<any>;81 82 deleteConversation(conversation_id: string, user: User): Promise<any>;83 84 audioToText(data: FormData): Promise<any>;85}86 87export declare class WorkflowClient extends DifyClient {88 run(inputs: any, user: User, stream?: boolean,): Promise<any>;89 90 stop(task_id: string, user: User): Promise<any>;91}