From dd153576c6b8e7bc9d371d12a59b42f27ecb7bb2 Mon Sep 17 00:00:00 2001 From: thewbuk <57405495+thewbuk@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:02:13 +0100 Subject: [PATCH] move type back --- packages/toolkit/package.json | 4 ++-- .../src/lib/react-query-service}/knowledge/types.ts | 0 .../knowledge/useCreateKnowledgeBase.ts | 2 +- .../knowledge/useDeleteKnowledgeBase.ts | 2 +- .../react-query-service/knowledge/useGetFileDetails.ts | 2 +- .../react-query-service/knowledge/useGetKnowledgeBases.ts | 2 +- .../knowledge/useListKnowledgeBaseFiles.ts | 2 +- .../knowledge/useProcessKnowledgeBaseFiles.ts | 2 +- .../lib/react-query-service/knowledge/useUpdateChunk.ts | 2 +- .../knowledge/useUploadKnowledgeBaseFile.ts | 2 +- packages/toolkit/src/view/knowledge/KnowledgeBaseView.tsx | 8 +------- .../toolkit/src/view/knowledge/components/ChunkCard.tsx | 2 +- .../view/knowledge/components/CreateKnowledgeBaseCard.tsx | 2 +- .../toolkit/src/view/knowledge/components/FileChunks.tsx | 2 +- .../toolkit/src/view/knowledge/components/FileTable.tsx | 2 +- .../src/view/knowledge/components/FileTableHeader.tsx | 2 +- .../src/view/knowledge/components/FileTableRow.tsx | 7 +++---- .../toolkit/src/view/knowledge/components/Sidebar.tsx | 2 +- .../view/knowledge/components/tabs/CatalogFilesTab.tsx | 2 +- .../src/view/knowledge/components/tabs/ChunkTab.tsx | 2 +- .../src/view/knowledge/components/tabs/ImageTab.tsx | 2 +- .../view/knowledge/components/tabs/KnowledgeBaseTab.tsx | 4 +--- .../src/view/knowledge/components/tabs/MarkdownTab.tsx | 2 +- .../view/knowledge/components/tabs/RetrieveTestTab.tsx | 2 +- .../view/knowledge/components/tabs/UploadExploreTab.tsx | 2 +- 25 files changed, 27 insertions(+), 36 deletions(-) rename packages/{sdk/src => toolkit/src/lib/react-query-service}/knowledge/types.ts (100%) diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index 706a415006..975e3c187e 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@instill-ai/toolkit", - "version": "0.97.0-rc.28", + "version": "0.97.0-rc.29", "description": "Instill AI's frontend toolkit", "repository": "https://github.com/instill-ai/design-system.git", "bugs": "https://github.com/instill-ai/design-system/issues", @@ -170,4 +170,4 @@ "eslint --cache --fix" ] } -} \ No newline at end of file +} diff --git a/packages/sdk/src/knowledge/types.ts b/packages/toolkit/src/lib/react-query-service/knowledge/types.ts similarity index 100% rename from packages/sdk/src/knowledge/types.ts rename to packages/toolkit/src/lib/react-query-service/knowledge/types.ts diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useCreateKnowledgeBase.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useCreateKnowledgeBase.ts index 2b9cd58cea..ecc4c2191a 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useCreateKnowledgeBase.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useCreateKnowledgeBase.ts @@ -1,7 +1,7 @@ import { useMutation } from "@tanstack/react-query"; -import { KnowledgeBase } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { KnowledgeBase } from "./types"; async function createKnowledgeBaseMutation({ payload, diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useDeleteKnowledgeBase.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useDeleteKnowledgeBase.ts index bb53880990..f02be0b9e4 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useDeleteKnowledgeBase.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useDeleteKnowledgeBase.ts @@ -1,7 +1,7 @@ import { useMutation } from "@tanstack/react-query"; -import { KnowledgeBase } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { KnowledgeBase } from "./types"; async function deleteKnowledgeBaseMutation({ ownerId, diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useGetFileDetails.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useGetFileDetails.ts index dfdaea855b..8049edc1d0 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useGetFileDetails.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useGetFileDetails.ts @@ -2,8 +2,8 @@ import { useQuery } from "@tanstack/react-query"; import { Nullable } from "@instill-ai/toolkit"; -import { File } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { File } from "./types"; export function useGetFileDetails({ fileUid, diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useGetKnowledgeBases.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useGetKnowledgeBases.ts index f415ca654c..5afbe89659 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useGetKnowledgeBases.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useGetKnowledgeBases.ts @@ -1,7 +1,7 @@ import { useQuery } from "@tanstack/react-query"; -import { KnowledgeBase } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { KnowledgeBase } from "./types"; async function getKnowledgeBases({ ownerId, diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useListKnowledgeBaseFiles.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useListKnowledgeBaseFiles.ts index d663412d5e..79dbafcc2e 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useListKnowledgeBaseFiles.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useListKnowledgeBaseFiles.ts @@ -2,8 +2,8 @@ import { useQuery } from "@tanstack/react-query"; import { Nullable } from "@instill-ai/toolkit"; -import { File } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { File } from "./types"; export function useListKnowledgeBaseFiles({ namespaceId, diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useProcessKnowledgeBaseFiles.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useProcessKnowledgeBaseFiles.ts index dce4ae6908..415a583b2a 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useProcessKnowledgeBaseFiles.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useProcessKnowledgeBaseFiles.ts @@ -2,8 +2,8 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { Nullable } from "@instill-ai/toolkit"; -import { File } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { File } from "./types"; export function useProcessKnowledgeBaseFiles() { const queryClient = useQueryClient(); diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useUpdateChunk.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useUpdateChunk.ts index 0c285d10df..4de8ed7792 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useUpdateChunk.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useUpdateChunk.ts @@ -2,8 +2,8 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { Nullable } from "@instill-ai/toolkit"; -import { Chunk } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { Chunk } from "./types"; export function useUpdateChunk() { const queryClient = useQueryClient(); diff --git a/packages/toolkit/src/lib/react-query-service/knowledge/useUploadKnowledgeBaseFile.ts b/packages/toolkit/src/lib/react-query-service/knowledge/useUploadKnowledgeBaseFile.ts index 7ae728d569..51242d4faa 100644 --- a/packages/toolkit/src/lib/react-query-service/knowledge/useUploadKnowledgeBaseFile.ts +++ b/packages/toolkit/src/lib/react-query-service/knowledge/useUploadKnowledgeBaseFile.ts @@ -2,8 +2,8 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { Nullable } from "@instill-ai/toolkit"; -import { File } from "../../../../../sdk/src/knowledge/types"; import { createInstillAxiosClient } from "../../vdp-sdk/helper"; +import { File } from "./types"; export function useUploadKnowledgeBaseFile() { const queryClient = useQueryClient(); diff --git a/packages/toolkit/src/view/knowledge/KnowledgeBaseView.tsx b/packages/toolkit/src/view/knowledge/KnowledgeBaseView.tsx index 7eab669526..fe2ae60277 100644 --- a/packages/toolkit/src/view/knowledge/KnowledgeBaseView.tsx +++ b/packages/toolkit/src/view/knowledge/KnowledgeBaseView.tsx @@ -5,7 +5,6 @@ import { Nullable } from "@instill-ai/toolkit"; import { GeneralAppPageProp, InstillStore, - useAuthenticatedUser, useInstillStore, useShallow, } from "../../lib"; @@ -14,7 +13,7 @@ import { useGetKnowledgeBases, useListKnowledgeBaseFiles, } from "../../lib/react-query-service/knowledge"; -import { KnowledgeBase } from "../../../../sdk/src/knowledge/types"; +import { KnowledgeBase } from "../../lib/react-query-service/knowledge/types"; import { DeleteKnowledgeBaseNotification, CreditUsageFileNotification } from "./components/notifications"; import { Sidebar } from "./components"; import { CatalogFilesTab, ChunkTab, ImageTab, KnowledgeBaseTab, MarkdownTab, RetrieveTestTab, UploadExploreTab } from "./components/tabs"; @@ -47,11 +46,6 @@ export const KnowledgeBaseView = (props: KnowledgeBaseViewProps) => { })), ); - const me = useAuthenticatedUser({ - enabled: enabledQuery, - accessToken, - }); - const deleteKnowledgeBase = useDeleteKnowledgeBase(); const { refetch: refetchKnowledgeBases } = useGetKnowledgeBases({ accessToken, diff --git a/packages/toolkit/src/view/knowledge/components/ChunkCard.tsx b/packages/toolkit/src/view/knowledge/components/ChunkCard.tsx index 3eabb41ce1..e9e79756c9 100644 --- a/packages/toolkit/src/view/knowledge/components/ChunkCard.tsx +++ b/packages/toolkit/src/view/knowledge/components/ChunkCard.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { Icons, Separator, Switch, Tag } from "@instill-ai/design-system"; -import { Chunk } from "../../../../../sdk/src/knowledge/types"; +import { Chunk } from "../../../lib/react-query-service/knowledge/types"; type ChunkCardProps = { chunk: Chunk; diff --git a/packages/toolkit/src/view/knowledge/components/CreateKnowledgeBaseCard.tsx b/packages/toolkit/src/view/knowledge/components/CreateKnowledgeBaseCard.tsx index 519ee7bb99..6234336b9c 100644 --- a/packages/toolkit/src/view/knowledge/components/CreateKnowledgeBaseCard.tsx +++ b/packages/toolkit/src/view/knowledge/components/CreateKnowledgeBaseCard.tsx @@ -11,7 +11,7 @@ import { import { InstillStore, useInstillStore, useShallow } from "../../../lib"; import { useListChunks } from "../../../lib/react-query-service/knowledge"; -import { KnowledgeBase } from "../../../../../sdk/src/knowledge/types"; +import { KnowledgeBase } from "../../../lib/react-query-service/knowledge/types"; import { EditKnowledgeDialog } from "./EditKnowledgeDialog"; type EditKnowledgeDialogData = { diff --git a/packages/toolkit/src/view/knowledge/components/FileChunks.tsx b/packages/toolkit/src/view/knowledge/components/FileChunks.tsx index 6ba31e58bd..8ae118514a 100644 --- a/packages/toolkit/src/view/knowledge/components/FileChunks.tsx +++ b/packages/toolkit/src/view/knowledge/components/FileChunks.tsx @@ -10,7 +10,7 @@ import { Chunk, KnowledgeBase, KnowledgeFile, -} from "../../../../../sdk/src/knowledge/types"; +} from "../../../lib/react-query-service/knowledge/types"; import ChunkCard from "./ChunkCard"; type FileChunksProps = { diff --git a/packages/toolkit/src/view/knowledge/components/FileTable.tsx b/packages/toolkit/src/view/knowledge/components/FileTable.tsx index a4b8d58526..e6fb0d02bb 100644 --- a/packages/toolkit/src/view/knowledge/components/FileTable.tsx +++ b/packages/toolkit/src/view/knowledge/components/FileTable.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { File, FileStatus } from "../../../../../sdk/src/knowledge/types"; +import { File, FileStatus } from "../../../lib/react-query-service/knowledge/types"; import { FileTableRow } from "./FileTableRow"; import { FileTableHeader } from "./FileTableHeader"; diff --git a/packages/toolkit/src/view/knowledge/components/FileTableHeader.tsx b/packages/toolkit/src/view/knowledge/components/FileTableHeader.tsx index 18608244de..7bc7d7f0f5 100644 --- a/packages/toolkit/src/view/knowledge/components/FileTableHeader.tsx +++ b/packages/toolkit/src/view/knowledge/components/FileTableHeader.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Button, Icons } from "@instill-ai/design-system"; -import { File } from "../../../../../sdk/src/knowledge/types"; +import { File } from "../../../lib/react-query-service/knowledge/types"; type FileTableHeaderProps = { sortConfig: { diff --git a/packages/toolkit/src/view/knowledge/components/FileTableRow.tsx b/packages/toolkit/src/view/knowledge/components/FileTableRow.tsx index 3c31557be9..f5cce83300 100644 --- a/packages/toolkit/src/view/knowledge/components/FileTableRow.tsx +++ b/packages/toolkit/src/view/knowledge/components/FileTableRow.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Button, Icons } from "@instill-ai/design-system"; -import { File } from "../../../../../sdk/src/knowledge/types"; +import { File } from "../../../lib/react-query-service/knowledge/types"; import { StatusTag } from "./StatusTag"; type FileTableRowProps = { @@ -18,9 +18,8 @@ export const FileTableRow: React.FC = ({ }) => { return (