mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
(feat:sources) renamed docs,fe
This commit is contained in:
@@ -77,7 +77,7 @@ const LineNumberedTextarea: React.FC<LineNumberedTextareaProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface DocumentChunksProps {
|
||||
interface ChunksProps {
|
||||
documentId: string;
|
||||
documentName?: string;
|
||||
handleGoBack: () => void;
|
||||
@@ -85,7 +85,7 @@ interface DocumentChunksProps {
|
||||
renderFileSearch?: () => React.ReactNode;
|
||||
}
|
||||
|
||||
const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
const Chunks: React.FC<ChunksProps> = ({
|
||||
documentId,
|
||||
documentName,
|
||||
handleGoBack,
|
||||
@@ -406,13 +406,13 @@ const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
? `${(totalChunks / 1000000).toFixed(2)}M`
|
||||
: totalChunks > 999
|
||||
? `${(totalChunks / 1000).toFixed(2)}K`
|
||||
: totalChunks} {t('settings.documents.chunks')}
|
||||
: totalChunks} {t('settings.sources.chunks')}
|
||||
</div>
|
||||
<div className="h-full w-[1px] bg-[#D1D9E0] dark:bg-[#6A6A6A]"></div>
|
||||
<div className="flex-1 h-full">
|
||||
<input
|
||||
type="text"
|
||||
placeholder={t('settings.documents.searchPlaceholder')}
|
||||
placeholder={t('settings.sources.searchPlaceholder')}
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
className="w-full h-full px-3 py-2 bg-transparent border-none outline-none font-normal text-[13.56px] leading-[100%] dark:text-[#E0E0E0]"
|
||||
@@ -421,14 +421,14 @@ const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
</div>
|
||||
<button
|
||||
className="bg-purple-30 hover:bg-violets-are-blue flex h-[38px] w-full sm:w-auto min-w-[108px] items-center justify-center rounded-full px-4 text-sm whitespace-normal text-white shrink-0"
|
||||
title={t('settings.documents.addNew')}
|
||||
title={t('settings.sources.addNew')}
|
||||
onClick={() => {
|
||||
setIsAddingChunk(true);
|
||||
setEditingTitle('');
|
||||
setEditingText('');
|
||||
}}
|
||||
>
|
||||
{t('settings.documents.addNew')}
|
||||
{t('settings.sources.addNew')}
|
||||
</button>
|
||||
</div>
|
||||
{loading ? (
|
||||
@@ -441,10 +441,10 @@ const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
<div className="col-span-full w-full min-h-[50vh] flex flex-col items-center justify-center text-center text-gray-500 dark:text-gray-400">
|
||||
<img
|
||||
src={isDarkTheme ? NoFilesDarkIcon : NoFilesIcon}
|
||||
alt={t('settings.documents.noChunksAlt')}
|
||||
alt={t('settings.sources.noChunksAlt')}
|
||||
className="mx-auto mb-2 h-24 w-24"
|
||||
/>
|
||||
{t('settings.documents.noChunks')}
|
||||
{t('settings.sources.noChunks')}
|
||||
</div>
|
||||
) : (
|
||||
filteredChunks.map((chunk, index) => (
|
||||
@@ -460,7 +460,7 @@ const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
<div className="w-full">
|
||||
<div className="flex w-full items-center justify-between border-b border-[#D1D9E0] bg-[#F6F8FA] dark:bg-[#27282D] dark:border-[#6A6A6A] px-4 py-3">
|
||||
<div className="text-[#59636E] text-sm dark:text-[#E0E0E0]">
|
||||
{chunk.metadata.token_count ? chunk.metadata.token_count.toLocaleString() : '-'} {t('settings.documents.tokensUnit')}
|
||||
{chunk.metadata.token_count ? chunk.metadata.token_count.toLocaleString() : '-'} {t('settings.sources.tokensUnit')}
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 pt-3 pb-6">
|
||||
@@ -491,7 +491,7 @@ const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
<div className="relative flex flex-col rounded-[5.86px] border border-[#D1D9E0] dark:border-[#6A6A6A] overflow-hidden w-full">
|
||||
<div className="flex w-full items-center justify-between border-b border-[#D1D9E0] bg-[#F6F8FA] dark:bg-[#27282D] dark:border-[#6A6A6A] px-4 py-3">
|
||||
<div className="text-[#59636E] text-sm dark:text-[#E0E0E0]">
|
||||
{editingChunk.metadata.token_count ? editingChunk.metadata.token_count.toLocaleString() : '-'} {t('settings.documents.tokensUnit')}
|
||||
{editingChunk.metadata.token_count ? editingChunk.metadata.token_count.toLocaleString() : '-'} {t('settings.sources.tokensUnit')}
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-4 overflow-hidden">
|
||||
@@ -535,4 +535,4 @@ const DocumentChunks: React.FC<DocumentChunksProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default DocumentChunks;
|
||||
export default Chunks;
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSelector } from 'react-redux';
|
||||
import DocumentChunks from './DocumentChunks';
|
||||
import Chunks from './Chunks';
|
||||
import ContextMenu, { MenuOption } from './ContextMenu';
|
||||
import userService from '../api/services/userService';
|
||||
import FileIcon from '../assets/file.svg';
|
||||
@@ -201,19 +201,21 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
): MenuOption[] => {
|
||||
const options: MenuOption[] = [];
|
||||
|
||||
if (isFile) {
|
||||
options.push({
|
||||
icon: EyeView,
|
||||
label: t('settings.documents.view'),
|
||||
label: t('settings.sources.view'),
|
||||
onClick: (event: React.SyntheticEvent) => {
|
||||
event.stopPropagation();
|
||||
if (isFile) {
|
||||
handleFileClick(name);
|
||||
} else {
|
||||
navigateToDirectory(name);
|
||||
}
|
||||
},
|
||||
iconWidth: 18,
|
||||
iconHeight: 18,
|
||||
variant: 'primary',
|
||||
});
|
||||
}
|
||||
|
||||
options.push({
|
||||
icon: Trash,
|
||||
@@ -494,7 +496,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
<div className="flex items-center">
|
||||
<img
|
||||
src={FolderIcon}
|
||||
alt={t('settings.documents.parentFolderAlt')}
|
||||
alt={t('settings.sources.parentFolderAlt')}
|
||||
className="mr-2 h-4 w-4 flex-shrink-0"
|
||||
/>
|
||||
<span className="text-sm dark:text-[#E0E0E0] truncate">..</span>
|
||||
@@ -523,7 +525,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
>
|
||||
<td className="px-2 lg:px-4 py-2">
|
||||
<div className="flex items-center min-w-0">
|
||||
<img src={FolderIcon} alt={t('settings.documents.folderAlt')} className="mr-2 h-4 w-4 flex-shrink-0" />
|
||||
<img src={FolderIcon} alt={t('settings.sources.folderAlt')} className="mr-2 h-4 w-4 flex-shrink-0" />
|
||||
<span className="text-sm dark:text-[#E0E0E0] truncate">{name}</span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -544,7 +546,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
>
|
||||
<img
|
||||
src={ThreeDots}
|
||||
alt={t('settings.documents.menuAlt')}
|
||||
alt={t('settings.sources.menuAlt')}
|
||||
className="opacity-60 hover:opacity-100"
|
||||
/>
|
||||
</button>
|
||||
@@ -575,7 +577,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
>
|
||||
<td className="px-2 lg:px-4 py-2">
|
||||
<div className="flex items-center min-w-0">
|
||||
<img src={FileIcon} alt={t('settings.documents.fileAlt')} className="mr-2 h-4 w-4 flex-shrink-0" />
|
||||
<img src={FileIcon} alt={t('settings.sources.fileAlt')} className="mr-2 h-4 w-4 flex-shrink-0" />
|
||||
<span className="text-sm dark:text-[#E0E0E0] truncate">{name}</span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -594,7 +596,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
>
|
||||
<img
|
||||
src={ThreeDots}
|
||||
alt={t('settings.documents.menuAlt')}
|
||||
alt={t('settings.sources.menuAlt')}
|
||||
className="opacity-60 hover:opacity-100"
|
||||
/>
|
||||
</button>
|
||||
@@ -671,7 +673,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
setSearchResults(searchFiles(e.target.value, directoryStructure));
|
||||
}
|
||||
}}
|
||||
placeholder={t('settings.documents.searchFiles')}
|
||||
placeholder={t('settings.sources.searchFiles')}
|
||||
className={`w-full px-4 py-2 pl-10 border border-[#D1D9E0] dark:border-[#6A6A6A] ${
|
||||
searchQuery ? 'rounded-t-md rounded-b-none border-b-0' : 'rounded-md'
|
||||
} bg-transparent dark:text-[#E0E0E0] focus:outline-none`}
|
||||
@@ -687,7 +689,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
<div className="absolute z-10 w-full border border-[#D1D9E0] dark:border-[#6A6A6A] rounded-b-md bg-white dark:bg-[#1F2023] shadow-lg max-h-[calc(100vh-200px)] overflow-y-auto">
|
||||
{searchResults.length === 0 ? (
|
||||
<div className="text-sm text-gray-500 dark:text-gray-400 text-center py-2">
|
||||
{t('settings.documents.noResults')}
|
||||
{t('settings.sources.noResults')}
|
||||
</div>
|
||||
) : (
|
||||
searchResults.map((result, index) => (
|
||||
@@ -701,7 +703,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
>
|
||||
<img
|
||||
src={result.isFile ? FileIcon : FolderIcon}
|
||||
alt={result.isFile ? t('settings.documents.fileAlt') : t('settings.documents.folderAlt')}
|
||||
alt={result.isFile ? t('settings.sources.fileAlt') : t('settings.sources.folderAlt')}
|
||||
className="flex-shrink-0 w-4 h-4 mr-2"
|
||||
/>
|
||||
<span className="text-sm dark:text-[#E0E0E0]">
|
||||
@@ -722,7 +724,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
{selectedFile ? (
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<DocumentChunks
|
||||
<Chunks
|
||||
documentId={docId}
|
||||
documentName={sourceName}
|
||||
handleGoBack={() => setSelectedFile(null)}
|
||||
@@ -750,16 +752,16 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
<thead className="bg-gray-100 dark:bg-[#27282D]">
|
||||
<tr className="border-b border-[#D1D9E0] dark:border-[#6A6A6A]">
|
||||
<th className="min-w-[200px] px-2 lg:px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-[#59636E]">
|
||||
{t('settings.documents.fileName')}
|
||||
{t('settings.sources.fileName')}
|
||||
</th>
|
||||
<th className="min-w-[80px] px-2 lg:px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-[#59636E]">
|
||||
{t('settings.documents.tokens')}
|
||||
{t('settings.sources.tokens')}
|
||||
</th>
|
||||
<th className="min-w-[80px] px-2 lg:px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-[#59636E]">
|
||||
{t('settings.documents.size')}
|
||||
{t('settings.sources.size')}
|
||||
</th>
|
||||
<th className="w-[60px] px-2 lg:px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-[#59636E]">
|
||||
<span className="sr-only">{t('settings.documents.actions')}</span>
|
||||
<span className="sr-only">{t('settings.sources.actions')}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -775,7 +777,7 @@ const FileTreeComponent: React.FC<FileTreeComponentProps> = ({
|
||||
<ConfirmationModal
|
||||
message={
|
||||
itemToDelete?.isFile
|
||||
? t('settings.documents.confirmDelete')
|
||||
? t('settings.sources.confirmDelete')
|
||||
: `Are you sure you want to delete the directory "${itemToDelete?.name}" and all its contents? This action cannot be undone.`
|
||||
}
|
||||
modalState={deleteModalState}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
interface DocumentHeadProps {
|
||||
interface HeadProps {
|
||||
title?: string;
|
||||
description?: string;
|
||||
keywords?: string;
|
||||
@@ -13,7 +13,7 @@ interface DocumentHeadProps {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export function DocumentHead({
|
||||
export function Head({
|
||||
title,
|
||||
description,
|
||||
keywords,
|
||||
@@ -24,7 +24,7 @@ export function DocumentHead({
|
||||
twitterTitle,
|
||||
twitterDescription,
|
||||
children,
|
||||
}: DocumentHeadProps) {
|
||||
}: HeadProps) {
|
||||
return (
|
||||
<>
|
||||
{title && <title>{title}</title>}
|
||||
@@ -10,7 +10,7 @@ const useTabs = () => {
|
||||
const { t } = useTranslation();
|
||||
const tabs = [
|
||||
t('settings.general.label'),
|
||||
t('settings.documents.label'),
|
||||
t('settings.sources.label'),
|
||||
t('settings.analytics.label'),
|
||||
t('settings.logs.label'),
|
||||
t('settings.tools.label'),
|
||||
|
||||
@@ -158,7 +158,7 @@ function SourceDropdown({
|
||||
</div>
|
||||
)}
|
||||
<ConfirmationModal
|
||||
message={t('settings.documents.deleteWarning', {
|
||||
message={t('settings.sources.deleteWarning', {
|
||||
name: documentToDelete?.name,
|
||||
})}
|
||||
modalState={deleteModalState}
|
||||
|
||||
@@ -135,7 +135,7 @@ export default function SourcesPopup({
|
||||
type="text"
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
placeholder={t('settings.documents.searchPlaceholder')}
|
||||
placeholder={t('settings.sources.searchPlaceholder')}
|
||||
borderVariant="thin"
|
||||
className="mb-4"
|
||||
labelBgClassName="bg-lotion dark:bg-charleston-green-2"
|
||||
@@ -203,11 +203,11 @@ export default function SourcesPopup({
|
||||
|
||||
<div className="shrink-0 px-4 py-4 opacity-75 transition-opacity duration-200 hover:opacity-100 md:px-6">
|
||||
<a
|
||||
href="/settings/documents"
|
||||
href="/settings/sources"
|
||||
className="text-violets-are-blue inline-flex items-center gap-2 text-base font-medium"
|
||||
onClick={onClose}
|
||||
>
|
||||
{t('settings.documents.goToDocuments')}
|
||||
{t('settings.sources.goToSources')}
|
||||
<img src={RedirectIcon} alt="Redirect" className="h-3 w-3" />
|
||||
</a>
|
||||
</div>
|
||||
@@ -217,7 +217,7 @@ export default function SourcesPopup({
|
||||
onClick={handleUploadClick}
|
||||
className="border-violets-are-blue text-violets-are-blue hover:bg-violets-are-blue w-auto rounded-full border px-4 py-2 text-[14px] font-medium transition-colors duration-200 hover:text-white"
|
||||
>
|
||||
{t('settings.documents.uploadNew')}
|
||||
{t('settings.sources.uploadNew')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
updateQuery,
|
||||
} from './sharedConversationSlice';
|
||||
import { selectCompletedAttachments } from '../upload/uploadSlice';
|
||||
import { DocumentHead } from '../components/DocumentHead';
|
||||
import { Head as DocumentHead } from '../components/Head';
|
||||
|
||||
export const SharedConversation = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
"default": "Default",
|
||||
"add": "Add"
|
||||
},
|
||||
"documents": {
|
||||
"title": "This table contains all the documents that are available to you and those you have uploaded",
|
||||
"label": "Documents",
|
||||
"name": "Document Name",
|
||||
"sources": {
|
||||
"title": "Here you can manage all of the source file that are available to you and those you have uploaded.",
|
||||
"label": "Sources",
|
||||
"name": "Source Name",
|
||||
"date": "Vector Date",
|
||||
"type": "Type",
|
||||
"tokenUsage": "Token Usage",
|
||||
"noData": "No existing Documents",
|
||||
"noData": "No existing Sources",
|
||||
"searchPlaceholder": "Search...",
|
||||
"addNew": "Add New",
|
||||
"preLoaded": "Pre-loaded",
|
||||
@@ -74,11 +74,12 @@
|
||||
"actions": "Actions",
|
||||
"view": "View",
|
||||
"deleteWarning": "Are you sure you want to delete \"{{name}}\"?",
|
||||
"backToAll": "Back to all documents",
|
||||
"confirmDelete": "Are you sure you want to delete this file? This action cannot be undone.",
|
||||
"backToAll": "Back to all sources",
|
||||
"chunks": "Chunks",
|
||||
"noChunks": "No chunks found",
|
||||
"noChunksAlt": "No chunks found",
|
||||
"goToDocuments": "Go to Documents",
|
||||
"goToSources": "Go to Sources",
|
||||
"uploadNew": "Upload new",
|
||||
"searchFiles": "Search files...",
|
||||
"noResults": "No results found",
|
||||
@@ -89,6 +90,7 @@
|
||||
"folderAlt": "Folder",
|
||||
"parentFolderAlt": "Parent folder",
|
||||
"menuAlt": "Menu",
|
||||
"menuAlt": "Menu",
|
||||
"tokensUnit": "tokens",
|
||||
"editAlt": "Edit"
|
||||
},
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
"default": "Predeterminado",
|
||||
"addNew": "Añadir Nuevo"
|
||||
},
|
||||
"documents": {
|
||||
"title": "Esta tabla contiene todos los documentos que están disponibles para ti y los que has subido",
|
||||
"label": "Documentos",
|
||||
"name": "Nombre del Documento",
|
||||
"sources": {
|
||||
"title": "Aquí puedes gestionar todos los archivos fuente que están disponibles para ti y los que has subido.",
|
||||
"label": "Fuentes",
|
||||
"name": "Nombre de la Fuente",
|
||||
"date": "Fecha de Vector",
|
||||
"type": "Tipo",
|
||||
"tokenUsage": "Uso de Tokens",
|
||||
"noData": "No hay documentos existentes",
|
||||
"noData": "No hay fuentes existentes",
|
||||
"searchPlaceholder": "Buscar...",
|
||||
"addNew": "Agregar Nuevo",
|
||||
"preLoaded": "Precargado",
|
||||
@@ -74,11 +74,12 @@
|
||||
"actions": "Acciones",
|
||||
"view": "Ver",
|
||||
"deleteWarning": "¿Estás seguro de que deseas eliminar \"{{name}}\"?",
|
||||
"backToAll": "Volver a todos los documentos",
|
||||
"confirmDelete": "¿Estás seguro de que deseas eliminar este archivo? Esta acción no se puede deshacer.",
|
||||
"backToAll": "Volver a todas las fuentes",
|
||||
"chunks": "Fragmentos",
|
||||
"noChunks": "No se encontraron fragmentos",
|
||||
"noChunksAlt": "No se encontraron fragmentos",
|
||||
"goToDocuments": "Ir a Documentos",
|
||||
"goToSources": "Ir a Fuentes",
|
||||
"uploadNew": "Subir nuevo",
|
||||
"searchFiles": "Buscar archivos...",
|
||||
"noResults": "No se encontraron resultados",
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
"default": "デフォルト",
|
||||
"add": "追加"
|
||||
},
|
||||
"documents": {
|
||||
"title": "この表には、利用可能なすべてのドキュメントとアップロードしたドキュメントが含まれています",
|
||||
"label": "ドキュメント",
|
||||
"name": "ドキュメント名",
|
||||
"sources": {
|
||||
"title": "ここでは、利用可能なすべてのソースファイルとアップロードしたファイルを管理できます。",
|
||||
"label": "ソース",
|
||||
"name": "ソース名",
|
||||
"date": "ベクトル日付",
|
||||
"type": "タイプ",
|
||||
"tokenUsage": "トークン使用量",
|
||||
"noData": "既存のドキュメントがありません",
|
||||
"noData": "既存のソースがありません",
|
||||
"searchPlaceholder": "検索...",
|
||||
"addNew": "新規追加",
|
||||
"preLoaded": "プリロード済み",
|
||||
@@ -74,11 +74,12 @@
|
||||
"actions": "アクション",
|
||||
"view": "表示",
|
||||
"deleteWarning": "\"{{name}}\"を削除してもよろしいですか?",
|
||||
"backToAll": "すべてのドキュメントに戻る",
|
||||
"confirmDelete": "このファイルを削除してもよろしいですか?この操作は元に戻せません。",
|
||||
"backToAll": "すべてのソースに戻る",
|
||||
"chunks": "チャンク",
|
||||
"noChunks": "チャンクが見つかりません",
|
||||
"noChunksAlt": "チャンクが見つかりません",
|
||||
"goToDocuments": "ドキュメントへ移動",
|
||||
"goToSources": "ソースへ移動",
|
||||
"uploadNew": "新規アップロード",
|
||||
"searchFiles": "ファイルを検索...",
|
||||
"noResults": "結果が見つかりません",
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
"default": "По умолчанию",
|
||||
"add": "Добавить"
|
||||
},
|
||||
"documents": {
|
||||
"title": "Эта таблица содержит все документы, которые доступны вам и те, которые вы загрузили",
|
||||
"label": "Документы",
|
||||
"name": "Название документа",
|
||||
"sources": {
|
||||
"title": "Здесь вы можете управлять всеми исходными файлами, которые доступны вам и которые вы загрузили.",
|
||||
"label": "Источники",
|
||||
"name": "Название источника",
|
||||
"date": "Дата вектора",
|
||||
"type": "Тип",
|
||||
"tokenUsage": "Использование токена",
|
||||
"noData": "Нет существующих документов",
|
||||
"noData": "Нет существующих источников",
|
||||
"searchPlaceholder": "Поиск...",
|
||||
"addNew": "добавить новый",
|
||||
"preLoaded": "Предзагруженный",
|
||||
@@ -74,11 +74,12 @@
|
||||
"actions": "Действия",
|
||||
"view": "Просмотр",
|
||||
"deleteWarning": "Вы уверены, что хотите удалить \"{{name}}\"?",
|
||||
"backToAll": "Вернуться ко всем документам",
|
||||
"confirmDelete": "Вы уверены, что хотите удалить этот файл? Это действие нельзя отменить.",
|
||||
"backToAll": "Вернуться ко всем источникам",
|
||||
"chunks": "Фрагменты",
|
||||
"noChunks": "Фрагменты не найдены",
|
||||
"noChunksAlt": "Фрагменты не найдены",
|
||||
"goToDocuments": "Перейти к документам",
|
||||
"goToSources": "Перейти к источникам",
|
||||
"uploadNew": "Загрузить новый",
|
||||
"searchFiles": "Поиск файлов...",
|
||||
"noResults": "Результаты не найдены",
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
"default": "預設",
|
||||
"add": "添加"
|
||||
},
|
||||
"documents": {
|
||||
"title": "此表格包含所有可供您使用的文件以及您上傳的文件",
|
||||
"label": "文件",
|
||||
"name": "文件名稱",
|
||||
"sources": {
|
||||
"title": "在這裡您可以管理所有可用的來源檔案以及您上傳的檔案。",
|
||||
"label": "來源",
|
||||
"name": "來源名稱",
|
||||
"date": "向量日期",
|
||||
"type": "類型",
|
||||
"tokenUsage": "Token 使用量",
|
||||
"noData": "沒有現有的文件",
|
||||
"noData": "沒有現有的來源",
|
||||
"searchPlaceholder": "搜尋...",
|
||||
"addNew": "新增文件",
|
||||
"preLoaded": "預載入",
|
||||
@@ -74,11 +74,12 @@
|
||||
"actions": "操作",
|
||||
"view": "查看",
|
||||
"deleteWarning": "您確定要刪除 \"{{name}}\" 嗎?",
|
||||
"backToAll": "返回所有文件",
|
||||
"confirmDelete": "您確定要刪除此檔案嗎?此操作無法復原。",
|
||||
"backToAll": "返回所有來源",
|
||||
"chunks": "文本塊",
|
||||
"noChunks": "未找到文本塊",
|
||||
"noChunksAlt": "未找到文本塊",
|
||||
"goToDocuments": "前往文件",
|
||||
"goToSources": "前往來源",
|
||||
"uploadNew": "上傳新文件",
|
||||
"searchFiles": "搜尋檔案...",
|
||||
"noResults": "未找到結果",
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
"default": "默认",
|
||||
"add": "添加"
|
||||
},
|
||||
"documents": {
|
||||
"title": "此表格包含所有可供您使用的文档以及您上传的文档",
|
||||
"label": "文档",
|
||||
"name": "文件名称",
|
||||
"sources": {
|
||||
"title": "在这里您可以管理所有可用的源文件以及您上传的文件。",
|
||||
"label": "来源",
|
||||
"name": "来源名称",
|
||||
"date": "向量日期",
|
||||
"type": "类型",
|
||||
"tokenUsage": "令牌使用",
|
||||
"noData": "没有现有的文档",
|
||||
"noData": "没有现有的来源",
|
||||
"searchPlaceholder": "搜索...",
|
||||
"addNew": "添加新文档",
|
||||
"preLoaded": "预加载",
|
||||
@@ -74,11 +74,12 @@
|
||||
"actions": "操作",
|
||||
"view": "查看",
|
||||
"deleteWarning": "您确定要删除 \"{{name}}\" 吗?",
|
||||
"backToAll": "返回所有文档",
|
||||
"confirmDelete": "您确定要删除此文件吗?此操作无法撤销。",
|
||||
"backToAll": "返回所有来源",
|
||||
"chunks": "文本块",
|
||||
"noChunks": "未找到文本块",
|
||||
"noChunksAlt": "未找到文本块",
|
||||
"goToDocuments": "前往文档",
|
||||
"goToSources": "前往来源",
|
||||
"uploadNew": "上传新文档",
|
||||
"searchFiles": "搜索文件...",
|
||||
"noResults": "未找到结果",
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
import Upload from '../upload/Upload';
|
||||
import { formatDate } from '../utils/dateTimeUtils';
|
||||
import FileTreeComponent from '../components/FileTreeComponent';
|
||||
import DocumentChunks from '../components/DocumentChunks';
|
||||
import Chunks from '../components/Chunks';
|
||||
|
||||
const formatTokens = (tokens: number): string => {
|
||||
const roundToTwoDecimals = (num: number): string => {
|
||||
@@ -46,7 +46,7 @@ const formatTokens = (tokens: number): string => {
|
||||
}
|
||||
};
|
||||
|
||||
export default function Documents({
|
||||
export default function Sources({
|
||||
paginatedDocuments,
|
||||
handleDeleteDocument,
|
||||
}: DocumentsProps) {
|
||||
@@ -97,10 +97,10 @@ export default function Documents({
|
||||
|
||||
const currentDocuments = paginatedDocuments ?? [];
|
||||
const syncOptions = [
|
||||
{ label: t('settings.documents.syncFrequency.never'), value: 'never' },
|
||||
{ label: t('settings.documents.syncFrequency.daily'), value: 'daily' },
|
||||
{ label: t('settings.documents.syncFrequency.weekly'), value: 'weekly' },
|
||||
{ label: t('settings.documents.syncFrequency.monthly'), value: 'monthly' },
|
||||
{ label: t('settings.sources.syncFrequency.never'), value: 'never' },
|
||||
{ label: t('settings.sources.syncFrequency.daily'), value: 'daily' },
|
||||
{ label: t('settings.sources.syncFrequency.weekly'), value: 'weekly' },
|
||||
{ label: t('settings.sources.syncFrequency.monthly'), value: 'monthly' },
|
||||
];
|
||||
const [documentToView, setDocumentToView] = useState<Doc>();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
@@ -215,7 +215,7 @@ export default function Documents({
|
||||
const actions: MenuOption[] = [
|
||||
{
|
||||
icon: EyeView,
|
||||
label: t('settings.documents.view'),
|
||||
label: t('settings.sources.view'),
|
||||
onClick: () => {
|
||||
setDocumentToView(document);
|
||||
},
|
||||
@@ -228,7 +228,7 @@ export default function Documents({
|
||||
if (document.syncFrequency) {
|
||||
actions.push({
|
||||
icon: SyncIcon,
|
||||
label: t('settings.documents.sync'),
|
||||
label: t('settings.sources.sync'),
|
||||
onClick: () => {
|
||||
setSyncMenuState({
|
||||
isOpen: true,
|
||||
@@ -268,7 +268,7 @@ export default function Documents({
|
||||
onBackToDocuments={() => setDocumentToView(undefined)}
|
||||
/>
|
||||
) : (
|
||||
<DocumentChunks
|
||||
<Chunks
|
||||
documentId={documentToView.id || ''}
|
||||
documentName={documentToView.name}
|
||||
handleGoBack={() => setDocumentToView(undefined)}
|
||||
@@ -280,17 +280,17 @@ export default function Documents({
|
||||
<div className="relative flex grow flex-col">
|
||||
<div className="mb-6">
|
||||
<h2 className="text-sonic-silver text-base font-medium">
|
||||
{t('settings.documents.title')}
|
||||
{t('settings.sources.title')}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="mb-6 flex flex-col items-start justify-between gap-3 sm:flex-row sm:items-center">
|
||||
<div className="w-full sm:w-auto">
|
||||
<label htmlFor="document-search-input" className="sr-only">
|
||||
{t('settings.documents.searchPlaceholder')}
|
||||
{t('settings.sources.searchPlaceholder')}
|
||||
</label>
|
||||
<Input
|
||||
maxLength={256}
|
||||
placeholder={t('settings.documents.searchPlaceholder')}
|
||||
placeholder={t('settings.sources.searchPlaceholder')}
|
||||
name="Document-search-input"
|
||||
type="text"
|
||||
id="document-search-input"
|
||||
@@ -304,13 +304,13 @@ export default function Documents({
|
||||
</div>
|
||||
<button
|
||||
className="bg-purple-30 hover:bg-violets-are-blue flex h-[32px] min-w-[108px] items-center justify-center rounded-full px-4 text-sm whitespace-normal text-white"
|
||||
title={t('settings.documents.addNew')}
|
||||
title={t('settings.sources.addNew')}
|
||||
onClick={() => {
|
||||
setIsOnboarding(false);
|
||||
setModalState('ACTIVE');
|
||||
}}
|
||||
>
|
||||
{t('settings.documents.addNew')}
|
||||
{t('settings.sources.addNew')}
|
||||
</button>
|
||||
</div>
|
||||
<div className="relative w-full">
|
||||
@@ -322,11 +322,11 @@ export default function Documents({
|
||||
<div className="flex flex-col items-center justify-center py-12">
|
||||
<img
|
||||
src={isDarkTheme ? NoFilesDarkIcon : NoFilesIcon}
|
||||
alt={t('settings.documents.noData')}
|
||||
alt={t('settings.sources.noData')}
|
||||
className="mx-auto mb-6 h-32 w-32"
|
||||
/>
|
||||
<p className="text-center text-lg text-gray-500 dark:text-gray-400">
|
||||
{t('settings.documents.noData')}
|
||||
{t('settings.sources.noData')}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
@@ -357,7 +357,7 @@ export default function Documents({
|
||||
>
|
||||
{document.syncFrequency && (
|
||||
<DropdownMenu
|
||||
name={t('settings.documents.sync')}
|
||||
name={t('settings.sources.sync')}
|
||||
options={syncOptions}
|
||||
onSelect={(value: string) => {
|
||||
handleManageSync(document, value);
|
||||
@@ -407,7 +407,7 @@ export default function Documents({
|
||||
</div>
|
||||
<div className="font-inter text-[12px] leading-[18px]">
|
||||
<span className="dark:text-bright-gray font-[400] text-[#18181B]">
|
||||
{t('settings.documents.tokenUsage')}:
|
||||
{t('settings.sources.tokenUsage')}:
|
||||
</span>
|
||||
<span className="ml-1 font-[400] text-[#848484] dark:text-[#848484]">
|
||||
{document.tokens
|
||||
@@ -470,7 +470,7 @@ export default function Documents({
|
||||
|
||||
{deleteModalState === 'ACTIVE' && documentToDelete && (
|
||||
<ConfirmationModal
|
||||
message={t('settings.documents.deleteWarning', {
|
||||
message={t('settings.sources.deleteWarning', {
|
||||
name: documentToDelete.document.name,
|
||||
})}
|
||||
modalState={deleteModalState}
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
setSourceDocs,
|
||||
} from '../preferences/preferenceSlice';
|
||||
import Analytics from './Analytics';
|
||||
import Documents from './Documents';
|
||||
import Sources from './Sources';
|
||||
import General from './General';
|
||||
import Logs from './Logs';
|
||||
import Tools from './Tools';
|
||||
@@ -38,8 +38,8 @@ export default function Settings() {
|
||||
|
||||
const getActiveTabFromPath = () => {
|
||||
const path = location.pathname;
|
||||
if (path.includes('/settings/documents'))
|
||||
return t('settings.documents.label');
|
||||
if (path.includes('/settings/sources'))
|
||||
return t('settings.sources.label');
|
||||
if (path.includes('/settings/analytics'))
|
||||
return t('settings.analytics.label');
|
||||
if (path.includes('/settings/logs')) return t('settings.logs.label');
|
||||
@@ -53,8 +53,8 @@ export default function Settings() {
|
||||
const handleTabChange = (tab: string) => {
|
||||
setActiveTab(tab);
|
||||
if (tab === t('settings.general.label')) navigate('/settings');
|
||||
else if (tab === t('settings.documents.label'))
|
||||
navigate('/settings/documents');
|
||||
else if (tab === t('settings.sources.label'))
|
||||
navigate('/settings/sources');
|
||||
else if (tab === t('settings.analytics.label'))
|
||||
navigate('/settings/analytics');
|
||||
else if (tab === t('settings.logs.label')) navigate('/settings/logs');
|
||||
@@ -113,9 +113,9 @@ export default function Settings() {
|
||||
<Routes>
|
||||
<Route index element={<General />} />
|
||||
<Route
|
||||
path="documents"
|
||||
path="sources"
|
||||
element={
|
||||
<Documents
|
||||
<Sources
|
||||
paginatedDocuments={paginatedDocuments}
|
||||
handleDeleteDocument={handleDeleteClick}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user