From f0ac186da72def039275ee30800db72bd3cc6729 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Thu, 21 Dec 2023 11:04:21 -0800 Subject: [PATCH] cleanup PRs --- backend/endpoints/v1/documents/index.js | 1 - backend/storage/settings.json | 512 +++++++++--------- frontend/src/components/Header/index.tsx | 122 +---- .../FragmentList/SearchView/index.tsx | 4 - .../pages/DocumentView/FragmentList/index.tsx | 1 - 5 files changed, 258 insertions(+), 382 deletions(-) diff --git a/backend/endpoints/v1/documents/index.js b/backend/endpoints/v1/documents/index.js index db4c56e..8ac7179 100644 --- a/backend/endpoints/v1/documents/index.js +++ b/backend/endpoints/v1/documents/index.js @@ -409,7 +409,6 @@ function documentEndpoints(app) { method, query ); - response.status(200).json({ fragments, error }); } catch (e) { console.log(e.message, e); diff --git a/backend/storage/settings.json b/backend/storage/settings.json index 98f127d..49c5de5 100644 --- a/backend/storage/settings.json +++ b/backend/storage/settings.json @@ -611,154 +611,6 @@ "readonly": false } }, - "document_vectors": { - "slug": "document_vectors", - "table": { - "name": "document_vectors", - "pk": "id", - "verbose": "document_vectors" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "docId", - "verbose": "docId", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "vectorId", - "verbose": "vectorId", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "document_id", - "verbose": "document_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "workspace_id", - "verbose": "workspace_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "users": { "slug": "users", "table": { @@ -875,12 +727,12 @@ "readonly": false } }, - "system_settings": { - "slug": "system_settings", + "document_vectors": { + "slug": "document_vectors", "table": { - "name": "system_settings", + "name": "document_vectors", "pk": "id", - "verbose": "system_settings" + "verbose": "document_vectors" }, "columns": [ { @@ -900,8 +752,8 @@ } }, { - "name": "label", - "verbose": "label", + "name": "docId", + "verbose": "docId", "control": { "text": true }, @@ -916,8 +768,8 @@ } }, { - "name": "value", - "verbose": "value", + "name": "vectorId", + "verbose": "vectorId", "control": { "text": true }, @@ -931,6 +783,54 @@ "show": true } }, + { + "name": "document_id", + "verbose": "document_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "workspace_id", + "verbose": "workspace_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, { "name": "createdAt", "verbose": "createdAt", @@ -1139,6 +1039,206 @@ "readonly": false } }, + "system_settings": { + "slug": "system_settings", + "table": { + "name": "system_settings", + "pk": "id", + "verbose": "system_settings" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "label", + "verbose": "label", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "value", + "verbose": "value", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, + "organization_users": { + "slug": "organization_users", + "table": { + "name": "organization_users", + "pk": "id", + "verbose": "organization_users" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "user_id", + "verbose": "user_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, "organization_notifications": { "slug": "organization_notifications", "table": { @@ -1303,106 +1403,6 @@ "readonly": false } }, - "organization_users": { - "slug": "organization_users", - "table": { - "name": "organization_users", - "pk": "id", - "verbose": "organization_users" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "user_id", - "verbose": "user_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "organization_rag_tests": { "slug": "organization_rag_tests", "table": { diff --git a/frontend/src/components/Header/index.tsx b/frontend/src/components/Header/index.tsx index 9c11d3c..494d37e 100644 --- a/frontend/src/components/Header/index.tsx +++ b/frontend/src/components/Header/index.tsx @@ -1,11 +1,4 @@ -import { Link } from 'react-router-dom'; -import Logo from '../../images/logo/logo-light.png'; -import { CheckCircle, Copy } from 'react-feather'; import { useEffect, useState } from 'react'; -import paths from '../../utils/paths'; -import { STORE_TOKEN, STORE_USER } from '../../utils/constants'; -import truncate from 'truncate'; -import Notifications from './Notifications'; export default function Header(props: { entity?: any | null; @@ -17,12 +10,7 @@ export default function Header(props: { }) { const [copied, setCopied] = useState(false); if (!props.entity) return null; - const { entity, property, nameProp, extendedItems = <> } = props; - - const handleCopy = () => { - window.navigator.clipboard.writeText(entity[property]); - setCopied(true); - }; + const { extendedItems = <> } = props; useEffect(() => { function manageCopy() { @@ -35,114 +23,8 @@ export default function Header(props: { }, [copied]); return ( - //
- //
- //
- // {/* */} - // - // {/* */} - - // - // Logo - // - //
- - //
- //
- //
- //

- // {truncate(entity[nameProp ?? 'name'], 20)} - //

- // - // {extendedItems} - //
- //
- // - // - //
- //
- //
- //
- //
-
- {/*
- Organization {'>'} Workspace 1 {'>'} Document 1 -
-
- - -
*/} - {extendedItems} -
+
{extendedItems}
); } diff --git a/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx b/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx index 0ba2635..7c4bfe4 100644 --- a/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx +++ b/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx @@ -38,14 +38,12 @@ export default function SearchView({ }) { const formEl = useRef(null); const [showSearchMethods, setShowSearchMethods] = useState(false); - const [sourceDoc, setSourceDoc] = useState(null); const clearSearch = (e: SyntheticEvent) => { e.preventDefault(); setSearchBy('exactText'); setSearching(false); setSearchMode(false); - setSourceDoc(null); (formEl.current as HTMLFormElement).reset(); }; const handleSearch = async (e: SyntheticEvent) => { @@ -69,8 +67,6 @@ export default function SearchView({ setSearchFragments([]); return; } - const metadataForIds = await Document.metadatas(document.id, vectorIds); - setSourceDoc(metadataForIds); setSearchFragments(matches); setSearching(false); }; diff --git a/frontend/src/pages/DocumentView/FragmentList/index.tsx b/frontend/src/pages/DocumentView/FragmentList/index.tsx index 5943e86..b244922 100644 --- a/frontend/src/pages/DocumentView/FragmentList/index.tsx +++ b/frontend/src/pages/DocumentView/FragmentList/index.tsx @@ -3,7 +3,6 @@ import PreLoader from '../../../components/Preloader'; import Document from '../../../models/document'; import truncate from 'truncate'; import pluralize from 'pluralize'; -import { useParams } from 'react-router-dom'; import DocumentListPagination from '../../../components/DocumentPaginator'; import SearchView from './SearchView'; import MetadataEditor from './MetadataEditor';