mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-15 13:42:08 +03:00
ea227df30e
https://github.com/StanGirard/quivr/assets/63923024/08554dd5-2765-436a-b900-48b38d582f6c https://github.com/StanGirard/quivr/issues/1389
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { useAxios } from "@/lib/hooks";
|
|
|
|
import {
|
|
addQuestionAndAnswer,
|
|
QuestionAndAnwser,
|
|
} from "./addQuestionAndAnswer";
|
|
import {
|
|
addQuestion,
|
|
AddQuestionParams,
|
|
ChatUpdatableProperties,
|
|
createChat,
|
|
deleteChat,
|
|
getChatItems,
|
|
getChats,
|
|
updateChat,
|
|
} from "./chat";
|
|
|
|
// TODO: split './chat.ts' into multiple files, per function for example
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
export const useChatApi = () => {
|
|
const { axiosInstance } = useAxios();
|
|
|
|
return {
|
|
createChat: async (chatName: string) => createChat(chatName, axiosInstance),
|
|
getChats: async () => getChats(axiosInstance),
|
|
deleteChat: async (chatId: string) => deleteChat(chatId, axiosInstance),
|
|
addQuestion: async (props: AddQuestionParams) =>
|
|
addQuestion(props, axiosInstance),
|
|
getChatItems: async (chatId: string) => getChatItems(chatId, axiosInstance),
|
|
updateChat: async (chatId: string, props: ChatUpdatableProperties) =>
|
|
updateChat(chatId, props, axiosInstance),
|
|
addQuestionAndAnswer: async (
|
|
chatId: string,
|
|
questionAndAnswer: QuestionAndAnwser
|
|
) => addQuestionAndAnswer(chatId, questionAndAnswer, axiosInstance),
|
|
};
|
|
};
|