mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
enhancement: implement api client in remaining places
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
const endpoints = {
|
||||
USER: {
|
||||
DOCS: '/api/combine',
|
||||
DOCS_CHECK: '/api/docs_check',
|
||||
API_KEYS: '/api/get_api_keys',
|
||||
CREATE_API_KEY: '/api/create_api_key',
|
||||
DELETE_API_KEY: '/api/delete_api_key',
|
||||
@@ -9,14 +11,22 @@ const endpoints = {
|
||||
UPDATE_PROMPT: '/api/update_prompt',
|
||||
SINGLE_PROMPT: (id: string) => `/api/get_single_prompt?id=${id}`,
|
||||
DELETE_PATH: (docPath: string) => `/api/delete_old?path=${docPath}`,
|
||||
TASK_STATUS: (task_id: string) => `/api/task_status?task_id=${task_id}`,
|
||||
},
|
||||
CONVERSATION: {
|
||||
ANSWER: '/api/answer',
|
||||
ANSWER_STREAMING: '/stream',
|
||||
SEARCH: '/api/search',
|
||||
FEEDBACK: '/api/feedback',
|
||||
CONVERSATION: (id: string) => `/api/get_single_conversation?id=${id}`,
|
||||
CONVERSATIONS: '/api/get_conversations',
|
||||
SHARE_CONVERSATION: (isPromptable: boolean) =>
|
||||
`/api/share?isPromptable=${isPromptable}`,
|
||||
SHARED_CONVERSATION: (identifier: string) =>
|
||||
`/api/shared_conversation/${identifier}`,
|
||||
DELETE: (id: string) => `/api/delete_conversation?id=${id}`,
|
||||
DELETE_ALL: '/api/delete_all_conversations',
|
||||
UPDATE: '/api/update_conversation_name',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -10,8 +10,23 @@ const conversationService = {
|
||||
apiClient.post(endpoints.CONVERSATION.SEARCH, data),
|
||||
feedback: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.FEEDBACK, data),
|
||||
getConversation: (id: string): Promise<any> =>
|
||||
apiClient.get(endpoints.CONVERSATION.CONVERSATION(id)),
|
||||
getConversations: (): Promise<any> =>
|
||||
apiClient.get(endpoints.CONVERSATION.CONVERSATIONS),
|
||||
shareConversation: (isPromptable: boolean, data: any): Promise<any> =>
|
||||
apiClient.post(
|
||||
endpoints.CONVERSATION.SHARE_CONVERSATION(isPromptable),
|
||||
data,
|
||||
),
|
||||
getSharedConversation: (identifier: string): Promise<any> =>
|
||||
apiClient.get(endpoints.CONVERSATION.SHARED_CONVERSATION(identifier)),
|
||||
delete: (id: string, data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.DELETE(id), data),
|
||||
deleteAll: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.DELETE_ALL, data),
|
||||
update: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.CONVERSATION.UPDATE, data),
|
||||
};
|
||||
|
||||
export default conversationService;
|
||||
|
||||
@@ -2,6 +2,9 @@ import apiClient from '../client';
|
||||
import endpoints from '../endpoints';
|
||||
|
||||
const userService = {
|
||||
getDocs: (): Promise<any> => apiClient.get(endpoints.USER.DOCS),
|
||||
checkDocs: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.DOCS_CHECK, data),
|
||||
getAPIKeys: (): Promise<any> => apiClient.get(endpoints.USER.API_KEYS),
|
||||
createAPIKey: (data: any): Promise<any> =>
|
||||
apiClient.post(endpoints.USER.CREATE_API_KEY, data),
|
||||
@@ -18,6 +21,8 @@ const userService = {
|
||||
apiClient.get(endpoints.USER.SINGLE_PROMPT(id)),
|
||||
deletePath: (docPath: string): Promise<any> =>
|
||||
apiClient.get(endpoints.USER.DELETE_PATH(docPath)),
|
||||
getTaskStatus: (task_id: string): Promise<any> =>
|
||||
apiClient.get(endpoints.USER.TASK_STATUS(task_id)),
|
||||
};
|
||||
|
||||
export default userService;
|
||||
|
||||
Reference in New Issue
Block a user