sync with ui-v2

This commit is contained in:
timothycarambat
2023-12-21 11:38:27 -08:00
144 changed files with 531 additions and 1153 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);
+1 -1
View File
@@ -305,7 +305,7 @@ function workspaceEndpoints(app) {
documents: "countForEntity",
vectors: "calcVectors",
"cache-size": "calcVectorCache",
"dimensions": "calcDimensions",
dimensions: "calcDimensions",
};
if (!Object.keys(methods).includes(statistic)) {
+7 -3
View File
@@ -16,17 +16,21 @@ const Organization = {
organization: null,
message: "No Organization name provided.",
};
var slug = slugify(orgName, { lower: true });
// If the new name contains bad characters
// replace them with spaces and continue creation.
const newOrgName = orgName.replace(/[:\.,<>@]/g, " ");
var slug = slugify(newOrgName, { lower: true });
const existingBySlug = await this.get({ slug });
if (!!existingBySlug) {
const slugSeed = Math.floor(10000000 + Math.random() * 90000000);
slug = slugify(`${orgName}-${slugSeed}`, { lower: true });
slug = slugify(`${newOrgName}-${slugSeed}`, { lower: true });
}
const organization = await prisma.organizations.create({
data: {
name: orgName,
name: newOrgName,
slug,
uuid: this.makeKey(),
},
+1 -3
View File
@@ -170,9 +170,8 @@ const WorkspaceDocument = {
include: { organization: true },
});
const connector = await OrganizationConnection.get({
organization_id: workspace.organization.id
organization_id: workspace.organization.id,
});
const vectorDb = selectConnector(connector);
@@ -204,7 +203,6 @@ const WorkspaceDocument = {
return 0;
}
},
};
module.exports.WorkspaceDocument = WorkspaceDocument;
File diff suppressed because it is too large Load Diff
@@ -72,6 +72,7 @@ class Chroma {
return { result: totalVectors, error: null };
}
// TODO: Solve this issue
async indexDimensions() {
// Chroma does not support this, defaulting to openai's 1536
return 1536;
@@ -77,9 +77,6 @@ async function validatePinecone({ environment, index, apiKey }) {
indexName: index,
});
// TODO: CHECK INDEX SIZE (client.indexDimensions()) and store in return so we can store it in the database
if (!status.ready) throw new Error("Pinecone::Index not ready or found.");
return { valid: true, message: null };
} catch (e) {
+2 -113
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;
@@ -18,18 +11,7 @@ export default function Header(props: {
}) {
const [copied, setCopied] = useState(false);
if (!props.entity) return null;
const {
entity,
property,
nameProp,
extendedItems = <></>,
quickActions = false,
} = props;
const handleCopy = () => {
window.navigator.clipboard.writeText(entity[property]);
setCopied(true);
};
const { extendedItems = <></> } = props;
useEffect(() => {
function manageCopy() {
@@ -42,100 +24,7 @@ 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={`${
quickActions ? 'mr-[235px]' : 'mr-[104px]'
} flex h-[76px] w-full rounded-t-xl bg-main`}
>
<header className="mr-26 flex h-[76px] w-full rounded-t-xl bg-main">
<div className="flex w-full justify-between p-4">{extendedItems}</div>
</header>
);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More