patch: fix some imports for types, solve white bg at bottom of screens, update document view

This commit is contained in:
timothycarambat
2023-12-11 17:05:22 -08:00
parent bf0b067a24
commit 89eeccf8f3
8 changed files with 475 additions and 665 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -42,7 +42,7 @@ const AppLayout = ({
loadMoreWorkspaces={loadMoreWorkspaces}
/>
<div className="no-scrollbar w-full overflow-x-hidden overflow-y-hidden">
<div className="no-scrollbar w-full overflow-x-hidden">
{!!headerEntity && (
<div className="flex w-full items-center">
<Header
+1 -2
View File
@@ -1,5 +1,4 @@
import { ISearchTypes } from '../pages/DocumentView/FragmentList/SearchView';
import { API_BASE } from '../utils/constants';
import { API_BASE, ISearchTypes } from '../utils/constants';
import { baseHeaders, getAPIUrlString } from '../utils/request';
const Document = {
+1 -2
View File
@@ -1,5 +1,4 @@
import { ISearchTypes } from '../pages/WorkspaceDashboard/DocumentsList/SearchView';
import { API_BASE } from '../utils/constants';
import { API_BASE, ISearchTypes } from '../utils/constants';
import { baseHeaders, getAPIUrlString } from '../utils/request';
const Workspace = {
@@ -5,13 +5,9 @@ import {
useRef,
useState,
} from 'react';
import { Loader } from 'react-feather';
import { CaretDown, MagnifyingGlass, X } from '@phosphor-icons/react';
import Document from '../../../../models/document';
import { set } from 'lodash';
import { SEARCH_MODES } from '../../../../utils/constants';
export type ISearchTypes = 'semantic' | 'exactText' | 'metadata' | 'vectorId';
import { SEARCH_MODES, ISearchTypes } from '../../../../utils/constants';
export default function SearchView({
searchMode,
@@ -156,7 +152,7 @@ export default function SearchView({
) : (
<button
type="submit"
className="absolute right-0 top-0 mr-4.5 flex h-full items-center justify-center p-2.5 text-sm font-medium text-white focus:outline-none"
className="absolute -right-1 top-0 mr-4.5 flex h-full items-center justify-center rounded-r-[100px] bg-[#303237] p-2.5 text-sm font-medium text-white focus:outline-none"
>
<MagnifyingGlass
className="text-sky-400 transition-all duration-300 hover:text-sky-700"
@@ -4,12 +4,11 @@ import Document from '../../../models/document';
import truncate from 'truncate';
import pluralize from 'pluralize';
import { useParams } from 'react-router-dom';
import paths from '../../../utils/paths';
import DocumentListPagination from '../../../components/DocumentPaginator';
import SearchView from './SearchView';
import MetadataEditor from './MetadataEditor';
import { Trash } from '@phosphor-icons/react';
import { SEARCH_MODES } from '../../../utils/constants';
import { ISearchTypes, SEARCH_MODES } from '../../../utils/constants';
const DeleteEmbeddingConfirmation = lazy(
() => import('./DeleteEmbeddingConfirmation')
);
@@ -27,7 +26,6 @@ export default function FragmentList({
document: any;
canEdit: boolean;
}) {
const { slug, workspaceSlug } = useParams();
const [loading, setLoading] = useState(true);
const [searchMode, setSearchMode] = useState(false);
const [fragments, setFragments] = useState([]);
@@ -44,19 +42,6 @@ export default function FragmentList({
setCurrentPage(page);
};
const deleteDocument = async () => {
if (!document) return false;
if (
!confirm(
'Are you sure you want to delete this document? This will remove the document from your vector database and remove it from the cache. This process cannot be undone.'
)
)
return false;
const success = await Document.delete(document.id);
if (!success) return false;
window.location.replace(paths.workspace(slug, workspaceSlug));
};
const getFragments = async (page = 1) => {
if (!document?.id) return;
setLoading(true);
@@ -79,7 +64,7 @@ export default function FragmentList({
}, [document, currentPage]);
return (
<>
<div className="h-screen bg-main">
<div className="max-h-[100vh] bg-main">
<div className="">
<div className="flex flex-col">
<div className="mb-6 flex w-full items-center justify-between gap-x-12">
@@ -180,13 +165,13 @@ export default function FragmentList({
</div>
)}
</div>
{/* {!searchMode && (
{!searchMode && (
<DocumentListPagination
pageCount={totalPages}
currentPage={currentPage}
gotoPage={handlePageChange}
/>
)} */}
)}
</div>
</>
);
@@ -5,29 +5,7 @@ import truncate from 'truncate';
import moment from 'moment';
import paths from '../../../../utils/paths';
import Workspace from '../../../../models/workspace';
export type ISearchTypes = 'semantic' | 'exactText' | 'metadata' | 'vectorId';
const SEARCH_MODES = {
exactText: {
display: 'Fuzzy Text Search',
placeholder: 'Find documents via a fuzzy text match on your query.',
},
semantic: {
display: 'Semantic Search',
placeholder:
'Search with natural language finding the most similar text by meaning. Use of this search will cost OpenAI credits to embed the query.',
},
metadata: {
display: 'Metadata',
placeholder:
'Find documents by exact key:value pair. Formatted as key:value_to_look_for',
},
vectorId: {
display: 'Vector Id',
placeholder: 'Find a document which contains a specific vector ID',
},
};
import { SEARCH_MODES, ISearchTypes } from '../../../../utils/constants';
export default function SearchView({
organization,
+1
View File
@@ -10,6 +10,7 @@ export const SUPPORTED_VECTOR_DBS = [
'weaviate',
];
export type ISearchTypes = 'semantic' | 'exactText' | 'metadata' | 'vectorId';
export const SEARCH_MODES = {
exactText: {
display: 'Fuzzy Text Search',