mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
enhancement: reusable api client setup + replaced in settings, conversation
This commit is contained in:
17
frontend/src/api/services/conversationService.ts
Normal file
17
frontend/src/api/services/conversationService.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import apiClient from '../client';
|
||||
import endpoints from '../endpoints';
|
||||
|
||||
const conversationService = {
|
||||
answer: (data: any, signal: AbortSignal): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.ANSWER, data, {}, signal),
|
||||
answerStream: (data: any, signal: AbortSignal): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.ANSWER_STREAMING, data, {}, signal),
|
||||
search: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.SEARCH, data),
|
||||
feedback: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.FEEDBACK, data),
|
||||
getSharedConversation: (identifier: string): Promise<any> =>
|
||||
apiClient.get(endpoints.CONVERSATION.SHARED_CONVERSATION(identifier)),
|
||||
};
|
||||
|
||||
export default conversationService;
|
||||
23
frontend/src/api/services/userService.ts
Normal file
23
frontend/src/api/services/userService.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import apiClient from '../client';
|
||||
import endpoints from '../endpoints';
|
||||
|
||||
const userService = {
|
||||
getAPIKeys: (): Promise<any> => apiClient.get(endpoints.USER.API_KEYS),
|
||||
createAPIKey: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.CREATE_API_KEY, data),
|
||||
deleteAPIKey: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.DELETE_API_KEY, data),
|
||||
getPrompts: (): Promise<any> => apiClient.get(endpoints.USER.PROMPTS),
|
||||
createPrompt: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.CREATE_PROMPT, data),
|
||||
deletePrompt: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.DELETE_PROMPT, data),
|
||||
updatePrompt: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.UPDATE_PROMPT, data),
|
||||
getSinglePrompt: (id: string): Promise<any> =>
|
||||
apiClient.get(endpoints.USER.SINGLE_PROMPT(id)),
|
||||
deletePath: (docPath: string): Promise<any> =>
|
||||
apiClient.get(endpoints.USER.DELETE_PATH(docPath)),
|
||||
};
|
||||
|
||||
export default userService;
|
||||
Reference in New Issue
Block a user