From 7bee849c650f62cb2691318788a1cd62aa8f9dfe Mon Sep 17 00:00:00 2001 From: timothycarambat <rambat1010@gmail.com> Date: Wed, 20 Dec 2023 10:45:03 -0800 Subject: [PATCH] chore: Force VectorCache to always be on; update file picker spacing for attributes --- docker/.env.example | 1 - .../MangeWorkspace/Documents/Directory/FileRow/index.jsx | 8 +++++--- .../Modals/MangeWorkspace/Documents/Directory/index.jsx | 4 ++-- .../WorkspaceDirectory/WorkspaceFileRow/index.jsx | 8 +++++--- .../MangeWorkspace/Documents/WorkspaceDirectory/index.jsx | 8 ++++---- server/.env.example | 1 - server/utils/files/index.js | 3 --- server/utils/helpers/updateENV.js | 1 - 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/docker/.env.example b/docker/.env.example index 650fad8d6..8bbdd1dd6 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -1,5 +1,4 @@ SERVER_PORT=3001 -CACHE_VECTORS="true" STORAGE_DIR="/app/server/storage" UID='1000' GID='1000' diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/FileRow/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/FileRow/index.jsx index cd695dfcf..61187f55b 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/FileRow/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/FileRow/index.jsx @@ -60,7 +60,7 @@ export default function FileRow({ selected ? "bg-sky-500/20" : "" } ${expanded ? "bg-sky-500/10" : ""}`}`} > - <div className="pl-2 col-span-6 flex gap-x-[4px] items-center"> + <div className="pl-2 col-span-5 flex gap-x-[4px] items-center"> <div className="shrink-0 w-3 h-3 rounded border-[1px] border-white flex justify-center items-center cursor-pointer" role="checkbox" @@ -88,10 +88,12 @@ export default function FileRow({ )} </div> </div> - <p className="col-span-2 pl-3.5 whitespace-nowrap"> + <p className="col-span-3 pl-3.5 whitespace-nowrap"> {formatDate(item?.published)} </p> - <p className="col-span-2 pl-2 uppercase">{getFileExtension(item.url)}</p> + <p className="col-span-2 pl-2 uppercase overflow-x-hidden"> + {getFileExtension(item.url)} + </p> <div className="col-span-2 flex justify-end items-center"> {item?.cached && ( <div className="bg-white/10 rounded-3xl"> diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/index.jsx index 1dd83de9a..8a140a410 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/Directory/index.jsx @@ -71,8 +71,8 @@ export default function Directory({ <div className="relative w-[560px] h-[310px] bg-zinc-900 rounded-2xl"> <div className="rounded-t-2xl text-white/80 text-xs grid grid-cols-12 py-2 px-8 border-b border-white/20 shadow-lg bg-zinc-900 sticky top-0 z-10"> - <p className="col-span-6">Name</p> - <p className="col-span-2">Date</p> + <p className="col-span-5">Name</p> + <p className="col-span-3">Date</p> <p className="col-span-2">Kind</p> <p className="col-span-2">Cached</p> </div> diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx index ceb751558..99493dbaf 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx @@ -54,7 +54,7 @@ export default function WorkspaceFileRow({ className={`items-center transition-all duration-200 text-white/80 text-xs grid grid-cols-12 py-2 pl-3.5 pr-8 border-b border-white/20 hover:bg-sky-500/20 cursor-pointer ${isMovedItem ? "bg-green-800/40" : ""}`} > - <div className="col-span-6 flex gap-x-[4px] items-center"> + <div className="col-span-5 flex gap-x-[4px] items-center"> <File className="text-base font-bold w-4 h-4 ml-3 mr-[3px]" weight="fill" @@ -74,10 +74,12 @@ export default function WorkspaceFileRow({ )} </div> </div> - <p className="col-span-2 pl-3.5 whitespace-nowrap"> + <p className="col-span-3 pl-3.5 whitespace-nowrap"> {formatDate(item?.published)} </p> - <p className="col-span-2 pl-2 uppercase">{getFileExtension(item.url)}</p> + <p className="col-span-2 pl-2 uppercase overflow-x-hidden"> + {getFileExtension(item.url)} + </p> <div className="col-span-2 flex justify-end items-center"> {item?.cached && ( <div className="bg-white/10 rounded-3xl"> diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/index.jsx index e1ec21dd4..12080b9b2 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/WorkspaceDirectory/index.jsx @@ -26,8 +26,8 @@ export default function WorkspaceDirectory({ </div> <div className="relative w-[560px] h-[445px] bg-zinc-900 rounded-2xl mt-5"> <div className="text-white/80 text-xs grid grid-cols-12 py-2 px-8 border-b border-white/20"> - <p className="col-span-6">Name</p> - <p className="col-span-2">Date</p> + <p className="col-span-5">Name</p> + <p className="col-span-3">Date</p> <p className="col-span-2">Kind</p> <p className="col-span-2">Cached</p> </div> @@ -55,8 +55,8 @@ export default function WorkspaceDirectory({ }`} > <div className="text-white/80 text-xs grid grid-cols-12 py-2 px-8 border-b border-white/20 bg-zinc-900 sticky top-0 z-10"> - <p className="col-span-6">Name</p> - <p className="col-span-2">Date</p> + <p className="col-span-5">Name</p> + <p className="col-span-3">Date</p> <p className="col-span-2">Kind</p> <p className="col-span-2">Cached</p> </div> diff --git a/server/.env.example b/server/.env.example index 242eec265..a4bc9fe5b 100644 --- a/server/.env.example +++ b/server/.env.example @@ -1,5 +1,4 @@ SERVER_PORT=3001 -CACHE_VECTORS="true" JWT_SECRET="my-random-string-for-seeding" # Please generate random string at least 12 chars long. ########################################### diff --git a/server/utils/files/index.js b/server/utils/files/index.js index c86221876..b6c7a3070 100644 --- a/server/utils/files/index.js +++ b/server/utils/files/index.js @@ -99,8 +99,6 @@ async function viewLocalFiles() { // Searches the vector-cache folder for existing information so we dont have to re-embed a // document and can instead push directly to vector db. async function cachedVectorInformation(filename = null, checkOnly = false) { - if (!process.env.CACHE_VECTORS) - return checkOnly ? false : { exists: false, chunks: [] }; if (!filename) return checkOnly ? false : { exists: false, chunks: [] }; const digest = uuidv5(filename, uuidv5.URL); @@ -123,7 +121,6 @@ async function cachedVectorInformation(filename = null, checkOnly = false) { // vectorData: pre-chunked vectorized data for a given file that includes the proper metadata and chunk-size limit so it can be iterated and dumped into Pinecone, etc // filename is the fullpath to the doc so we can compare by filename to find cached matches. async function storeVectorResult(vectorData = [], filename = null) { - if (!process.env.CACHE_VECTORS) return; if (!filename) return; console.log( `Caching vectorized results of ${filename} to prevent duplicated embedding.` diff --git a/server/utils/helpers/updateENV.js b/server/utils/helpers/updateENV.js index e995fb63f..3a8ea55dd 100644 --- a/server/utils/helpers/updateENV.js +++ b/server/utils/helpers/updateENV.js @@ -314,7 +314,6 @@ async function dumpENV() { const frozenEnvs = {}; const protectedKeys = [ ...Object.values(KEY_MAPPING).map((values) => values.envKey), - "CACHE_VECTORS", "STORAGE_DIR", "SERVER_PORT", // Password Schema Keys if present.