cleanup PRs

This commit is contained in:
timothycarambat
2023-12-21 11:04:21 -08:00
parent 03f5c38f33
commit f0ac186da7
5 changed files with 258 additions and 382 deletions
-1
View File
@@ -409,7 +409,6 @@ function documentEndpoints(app) {
method,
query
);
response.status(200).json({ fragments, error });
} catch (e) {
console.log(e.message, e);
+256 -256
View File
@@ -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": {
+2 -120
View File
@@ -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 (
// <header className="sticky top-0 z-999 flex w-full bg-slate-900 drop-shadow-1 dark:bg-boxdark dark:drop-shadow-none md:bg-white">
// <div className="flex flex-grow items-center justify-between px-4 py-4 shadow-2 md:px-6 2xl:px-11">
// <div className="flex items-center gap-2 sm:gap-4 lg:hidden">
// {/* <!-- Hamburger Toggle BTN --> */}
// <button
// aria-controls="sidebar"
// onClick={(e) => {
// e.stopPropagation();
// props.setSidebarOpen(!props.sidebarOpen);
// }}
// className="z-99999 block rounded-sm border border-stroke bg-white p-1.5 shadow-sm dark:border-strokedark dark:bg-boxdark lg:hidden"
// >
// <span className="relative block h-5.5 w-5.5 cursor-pointer">
// <span className="du-block absolute right-0 h-full w-full">
// <span
// className={`relative left-0 top-0 my-1 block h-0.5 w-0 rounded-sm bg-black delay-[0] duration-200 ease-in-out dark:bg-white ${
// !props.sidebarOpen && '!w-full delay-300'
// }`}
// ></span>
// <span
// className={`relative left-0 top-0 my-1 block h-0.5 w-0 rounded-sm bg-black delay-150 duration-200 ease-in-out dark:bg-white ${
// !props.sidebarOpen && 'delay-400 !w-full'
// }`}
// ></span>
// <span
// className={`relative left-0 top-0 my-1 block h-0.5 w-0 rounded-sm bg-black delay-200 duration-200 ease-in-out dark:bg-white ${
// !props.sidebarOpen && '!w-full delay-500'
// }`}
// ></span>
// </span>
// <span className="absolute right-0 h-full w-full rotate-45">
// <span
// className={`absolute left-2.5 top-0 block h-full w-0.5 rounded-sm bg-black delay-300 duration-200 ease-in-out dark:bg-white ${
// !props.sidebarOpen && '!h-0 !delay-[0]'
// }`}
// ></span>
// <span
// className={`delay-400 absolute left-0 top-2.5 block h-0.5 w-full rounded-sm bg-black duration-200 ease-in-out dark:bg-white ${
// !props.sidebarOpen && '!h-0 !delay-200'
// }`}
// ></span>
// </span>
// </span>
// </button>
// {/* <!-- Hamburger Toggle BTN --> */}
// <Link className="flex w-full justify-center lg:hidden" to="/">
// <img src={Logo} alt="Logo" className="h-14" />
// </Link>
// </div>
// <div className="hidden w-full sm:block">
// <div className="flex w-full items-center justify-between">
// <div className="flex items-center gap-x-4">
// <p className="text-4xl font-semibold text-slate-800">
// {truncate(entity[nameProp ?? 'name'], 20)}
// </p>
// <button
// onClick={handleCopy}
// disabled={copied}
// className="transition-duration-300 font-mono flex items-center gap-x-2 rounded-md bg-slate-200 px-4 py-2 text-sm text-slate-700 transition disabled:bg-green-300"
// >
// <p className="">ID: {entity[property]}</p>
// {copied ? (
// <CheckCircle className="h-4 w-4" />
// ) : (
// <Copy className="h-4 w-4" />
// )}
// </button>
// {extendedItems}
// </div>
// <div className="flex w-fit items-center gap-x-2">
// <Notifications />
// <button
// onClick={() => {
// if (!window) return;
// window.localStorage.removeItem(STORE_USER);
// window.localStorage.removeItem(STORE_TOKEN);
// window.location.replace(paths.home());
// }}
// className="rounded-lg px-4 py-2 text-slate-800 hover:bg-slate-200"
// >
// Logout
// </button>
// </div>
// </div>
// </div>
// </div>
// </header>
<header className="mr-26 flex h-[76px] w-full rounded-t-xl bg-main">
<div className="flex w-full justify-between p-4">
{/* <div className="w-fit rounded-xl border-2 border-white/20 px-5 py-2 text-sky-400">
Organization {'>'} Workspace 1 {'>'} Document 1
</div>
<div className="flex gap-x-3">
<button className="inline-flex h-11 w-[74px] flex-col items-center justify-center gap-2.5 rounded-lg bg-white bg-opacity-10 px-5 py-2.5 transition-all duration-300 hover:bg-opacity-5">
<div className="h-[25.53px] w-11 text-center font-['Satoshi'] text-base font-bold text-white">
Clone
</div>
</button>
<button className="inline-flex h-11 w-[74px] flex-col items-center justify-center gap-2.5 rounded-lg border border-white border-opacity-20 px-3.5 py-2.5 transition-all duration-300 hover:bg-red-500">
<div className="h-[25.53px] w-[59px] text-center font-['Satoshi'] text-base font-bold text-white">
Delete
</div>
</button>
</div> */}
{extendedItems}
</div>
<div className="flex w-full justify-between p-4">{extendedItems}</div>
</header>
);
}
@@ -38,14 +38,12 @@ export default function SearchView({
}) {
const formEl = useRef<HTMLFormElement>(null);
const [showSearchMethods, setShowSearchMethods] = useState(false);
const [sourceDoc, setSourceDoc] = useState(null);
const clearSearch = (e: SyntheticEvent<HTMLElement, SubmitEvent>) => {
e.preventDefault();
setSearchBy('exactText');
setSearching(false);
setSearchMode(false);
setSourceDoc(null);
(formEl.current as HTMLFormElement).reset();
};
const handleSearch = async (e: SyntheticEvent<HTMLElement, SubmitEvent>) => {
@@ -69,8 +67,6 @@ export default function SearchView({
setSearchFragments([]);
return;
}
const metadataForIds = await Document.metadatas(document.id, vectorIds);
setSourceDoc(metadataForIds);
setSearchFragments(matches);
setSearching(false);
};
@@ -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';