quivr/frontend/lib/api/knowledge/useKnowledgeApi.ts
Zineb El Bachiri d2b4ef4aff
feat: knowledge tab list (#1222)
*  get all knowledge utils

*  add remove knowledge and update router

*  new knowledge provider

* 🚨 remove eslint -disable

*  new useKnowledgeApi

*  set up KnowledgeItem

*  add KnowledgeTable component in knowledge tab

* 🔥 remove DocumentData replaced by KnowledgeItem

* 🐛 fix weird characters instead of '/'

* 💄 truncate knowledge name

*  add DownloadUploadedKnowledge component

* ⚰️ unused code

* 🏷️ introduce UploadedKnowledge and CrawledKnowledge types

* 💄 remove thread

* 💄 bin for delete knowledge

* 🌐 update wording for knowledge tab

* 🔇 remove logs and comments
2023-09-22 16:06:04 +02:00

26 lines
756 B
TypeScript

import { UUID } from "crypto";
import { useAxios } from "@/lib/hooks";
import {
deleteKnowledge,
DeleteKnowledgeInputProps,
generateSignedUrlKnowledge,
getAllKnowledge,
GetAllKnowledgeInputProps,
} from "./knowledge";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useKnowledgeApi = () => {
const { axiosInstance } = useAxios();
return {
getAllKnowledge: async (props: GetAllKnowledgeInputProps) =>
getAllKnowledge(props, axiosInstance),
deleteKnowledge: async (props: DeleteKnowledgeInputProps) =>
deleteKnowledge(props, axiosInstance),
generateSignedUrlKnowledge: async (props: { knowledgeId: UUID }) =>
generateSignedUrlKnowledge(props, axiosInstance),
};
};