refactor: 优化代码结构和UI组件,移除前台和后台功能冲突的组件 (#34)
本次提交主要对代码进行了重构,移除了未使用的代码和注释,优化了部分UI组件的布局和样式。具体包括: 1. 移除了多个文件中的未使用代码和注释。 2. 调整了部分UI组件的布局,使其更加简洁和一致。 3. 更新了logo.svg文件,优化了图标的设计。 4. 修复了部分组件中的样式问题,提升了用户体验。
This commit is contained in:
parent
fa17fd40bd
commit
61d924a4fa
|
@ -45,15 +45,15 @@ def signal_handler(sig, frame):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logging.info(r"""
|
logging.info(r"""
|
||||||
____ ___ ______ ______ __
|
_____ ___ _____ _____ _ _____ _ __ _____ _ _ _ _____
|
||||||
/ __ \ / | / ____// ____// /____ _ __
|
| _ \ / | / ___| | ___| | | / _ \ | | / / | _ \ | | | | | | / ___/
|
||||||
/ /_/ // /| | / / __ / /_ / // __ \| | /| / /
|
| |_| | / /| | | | | |__ | | | | | | | | __ / / | |_| | | | | | | | | |___
|
||||||
/ _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ /
|
| _ / / / | | | | _ | __| | | | | | | | | / | / / | ___/ | | | | | | \___ \
|
||||||
/_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/
|
| | \ \ / / | | | |_| | | | | |___ | |_| | | |/ |/ / | | | |___ | |_| | ___| |
|
||||||
|
|_| \_\ /_/ |_| \_____/ |_| |_____| \_____/ |___/|___/ |_| |_____| \_____/ /_____/
|
||||||
""")
|
""")
|
||||||
logging.info(
|
logging.info(
|
||||||
f'RAGFlow version: {get_ragflow_version()}'
|
f'RAGFlow base version: {get_ragflow_version()}'
|
||||||
)
|
)
|
||||||
logging.info(
|
logging.info(
|
||||||
f'project base: {utils.file_utils.get_project_base_directory()}'
|
f'project base: {utils.file_utils.get_project_base_directory()}'
|
||||||
|
|
|
@ -162,7 +162,7 @@ def _create_task_record(doc_id, chunk_ids_list):
|
||||||
|
|
||||||
|
|
||||||
def get_text_from_block(block):
|
def get_text_from_block(block):
|
||||||
"""从 preproc_blocks 中的一个块提取所有文本内容 (简化版)"""
|
"""从 preproc_blocks 中的一个块提取所有文本内容"""
|
||||||
block_text = ""
|
block_text = ""
|
||||||
if "lines" in block:
|
if "lines" in block:
|
||||||
for line in block.get("lines", []):
|
for line in block.get("lines", []):
|
||||||
|
@ -352,7 +352,7 @@ def perform_parse(doc_id, doc_info, file_info):
|
||||||
page_idx = 0 # 默认页面索引
|
page_idx = 0 # 默认页面索引
|
||||||
bbox = [0, 0, 0, 0] # 默认 bbox
|
bbox = [0, 0, 0, 0] # 默认 bbox
|
||||||
|
|
||||||
# -- 尝试匹配并获取 page_idx 和 bbox --
|
# 匹配并获取 page_idx 和 bbox
|
||||||
if middle_block_idx < len(block_info_list):
|
if middle_block_idx < len(block_info_list):
|
||||||
block_info = block_info_list[middle_block_idx]
|
block_info = block_info_list[middle_block_idx]
|
||||||
page_idx = block_info.get("page_idx", 0)
|
page_idx = block_info.get("page_idx", 0)
|
||||||
|
@ -362,7 +362,7 @@ def perform_parse(doc_id, doc_info, file_info):
|
||||||
# 如果 block_info_list 耗尽,打印警告
|
# 如果 block_info_list 耗尽,打印警告
|
||||||
if processed_text_chunks == len(block_info_list) + 1: # 只在第一次耗尽时警告一次
|
if processed_text_chunks == len(block_info_list) + 1: # 只在第一次耗尽时警告一次
|
||||||
print(f"[Parser-WARNING] middle_data 提供的块信息少于 content_list 中的文本块数量。后续文本块将使用默认 page/bbox。")
|
print(f"[Parser-WARNING] middle_data 提供的块信息少于 content_list 中的文本块数量。后续文本块将使用默认 page/bbox。")
|
||||||
# -- 匹配结束 --
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 上传文本块到 MinIO
|
# 上传文本块到 MinIO
|
||||||
|
@ -393,8 +393,8 @@ def perform_parse(doc_id, doc_info, file_info):
|
||||||
"content_ltks": content_tokens,
|
"content_ltks": content_tokens,
|
||||||
"content_sm_ltks": content_tokens,
|
"content_sm_ltks": content_tokens,
|
||||||
"page_num_int": [page_idx + 1],
|
"page_num_int": [page_idx + 1],
|
||||||
"position_int": [[page_idx + 1] + bbox_reordered], # 格式: [[page, x1, y1, x2, y2]]
|
"position_int": [[page_idx + 1] + bbox_reordered], # 格式: [[page, x1, x2, y1, y2]]
|
||||||
"top_int": [1], # 简化处理
|
"top_int": [1],
|
||||||
"create_time": current_time_es,
|
"create_time": current_time_es,
|
||||||
"create_timestamp_flt": current_timestamp_es,
|
"create_timestamp_flt": current_timestamp_es,
|
||||||
"img_id": "",
|
"img_id": "",
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 8.3 KiB |
|
@ -1,11 +1,8 @@
|
||||||
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
||||||
import apiDoc from '@parent/docs/references/http_api_reference.md';
|
|
||||||
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
||||||
import { Button, Card, Flex, Space } from 'antd';
|
import { Button, Card, Flex, Space } from 'antd';
|
||||||
import ChatApiKeyModal from '../chat-api-key-modal';
|
import ChatApiKeyModal from '../chat-api-key-modal';
|
||||||
import { usePreviewChat } from '../hooks';
|
import { usePreviewChat } from '../hooks';
|
||||||
import BackendServiceApi from './backend-service-api';
|
import BackendServiceApi from './backend-service-api';
|
||||||
import MarkdownToc from './markdown-toc';
|
|
||||||
|
|
||||||
const ApiContent = ({
|
const ApiContent = ({
|
||||||
id,
|
id,
|
||||||
|
@ -43,10 +40,10 @@ const ApiContent = ({
|
||||||
</Flex>
|
</Flex>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
<div style={{ position: 'relative' }}>
|
{/* <div style={{ position: 'relative' }}>
|
||||||
<MarkdownToc content={apiDoc} />
|
<MarkdownToc content={apiDoc} />
|
||||||
</div>
|
</div>
|
||||||
<MarkdownPreview source={apiDoc}></MarkdownPreview>
|
<MarkdownPreview source={apiDoc}></MarkdownPreview> */}
|
||||||
</Flex>
|
</Flex>
|
||||||
{apiKeyVisible && (
|
{apiKeyVisible && (
|
||||||
<ChatApiKeyModal
|
<ChatApiKeyModal
|
||||||
|
|
|
@ -431,7 +431,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
|
||||||
knowledgeBasesMessage: '请选择',
|
knowledgeBasesMessage: '请选择',
|
||||||
knowledgeBasesTip: '选择关联的知识库。',
|
knowledgeBasesTip: '选择关联的知识库。',
|
||||||
system: '系统提示词',
|
system: '系统提示词',
|
||||||
systemInitialValue: `你是一个智能助手,请总结知识库的内容来回答问题,请列举知识库中的数据详细回答。当所有知识库内容都与问题无关时,你的回答必须包括“知识库中未找到您要的答案!”这句话。回答需要考虑聊天历史。
|
systemInitialValue: `你是一个学术领域的专家,请根据知识库的内容来尽可能详细的回答问题。
|
||||||
以下是知识库:
|
以下是知识库:
|
||||||
{knowledge}
|
{knowledge}
|
||||||
以上是知识库。`,
|
以上是知识库。`,
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import { ReactComponent as CancelIcon } from '@/assets/svg/cancel.svg';
|
// import { ReactComponent as CancelIcon } from '@/assets/svg/cancel.svg';
|
||||||
import { ReactComponent as DeleteIcon } from '@/assets/svg/delete.svg';
|
// import { ReactComponent as DeleteIcon } from '@/assets/svg/delete.svg';
|
||||||
import { ReactComponent as DisableIcon } from '@/assets/svg/disable.svg';
|
// import { ReactComponent as DisableIcon } from '@/assets/svg/disable.svg';
|
||||||
import { ReactComponent as EnableIcon } from '@/assets/svg/enable.svg';
|
// import { ReactComponent as EnableIcon } from '@/assets/svg/enable.svg';
|
||||||
import { ReactComponent as RunIcon } from '@/assets/svg/run.svg';
|
// import { ReactComponent as RunIcon } from '@/assets/svg/run.svg';
|
||||||
import { useShowDeleteConfirm, useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
|
// import {
|
||||||
|
// useRemoveNextDocument,
|
||||||
|
// useRunNextDocument,
|
||||||
|
// useSetNextDocumentStatus,
|
||||||
|
// } from '@/hooks/document-hooks';
|
||||||
import {
|
import {
|
||||||
useRemoveNextDocument,
|
// DownOutlined,
|
||||||
useRunNextDocument,
|
// FileOutlined,
|
||||||
useSetNextDocumentStatus,
|
// FileTextOutlined,
|
||||||
} from '@/hooks/document-hooks';
|
// PlusOutlined,
|
||||||
import {
|
|
||||||
DownOutlined,
|
|
||||||
FileOutlined,
|
|
||||||
FileTextOutlined,
|
|
||||||
PlusOutlined,
|
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { Button, Dropdown, Flex, Input, MenuProps, Space } from 'antd';
|
import { Input, Space } from 'antd';
|
||||||
import { useCallback, useMemo } from 'react';
|
// import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
|
@ -32,163 +32,163 @@ interface IProps {
|
||||||
|
|
||||||
const DocumentToolbar = ({
|
const DocumentToolbar = ({
|
||||||
searchString,
|
searchString,
|
||||||
selectedRowKeys,
|
// selectedRowKeys,
|
||||||
showCreateModal,
|
// showCreateModal,
|
||||||
showDocumentUploadModal,
|
// showDocumentUploadModal,
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const { t } = useTranslate('knowledgeDetails');
|
const { t } = useTranslate('knowledgeDetails');
|
||||||
const { removeDocument } = useRemoveNextDocument();
|
// const { removeDocument } = useRemoveNextDocument();
|
||||||
const showDeleteConfirm = useShowDeleteConfirm();
|
// const showDeleteConfirm = useShowDeleteConfirm();
|
||||||
const { runDocumentByIds } = useRunNextDocument();
|
// const { runDocumentByIds } = useRunNextDocument();
|
||||||
const { setDocumentStatus } = useSetNextDocumentStatus();
|
// const { setDocumentStatus } = useSetNextDocumentStatus();
|
||||||
|
|
||||||
const actionItems: MenuProps['items'] = useMemo(() => {
|
// const actionItems: MenuProps['items'] = useMemo(() => {
|
||||||
return [
|
// return [
|
||||||
{
|
// {
|
||||||
key: '1',
|
// key: '1',
|
||||||
onClick: showDocumentUploadModal,
|
// onClick: showDocumentUploadModal,
|
||||||
label: (
|
// label: (
|
||||||
<div>
|
// <div>
|
||||||
<Button type="link">
|
// <Button type="link">
|
||||||
<Space>
|
// <Space>
|
||||||
<FileTextOutlined />
|
// <FileTextOutlined />
|
||||||
{t('localFiles')}
|
// {t('localFiles')}
|
||||||
</Space>
|
// </Space>
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{ type: 'divider' },
|
// { type: 'divider' },
|
||||||
{
|
// {
|
||||||
key: '3',
|
// key: '3',
|
||||||
onClick: showCreateModal,
|
// onClick: showCreateModal,
|
||||||
label: (
|
// label: (
|
||||||
<div>
|
// <div>
|
||||||
<Button type="link">
|
// <Button type="link">
|
||||||
<FileOutlined />
|
// <FileOutlined />
|
||||||
{t('emptyFiles')}
|
// {t('emptyFiles')}
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
}, [showDocumentUploadModal, showCreateModal, t]);
|
// }, [showDocumentUploadModal, showCreateModal, t]);
|
||||||
|
|
||||||
const handleDelete = useCallback(() => {
|
// const handleDelete = useCallback(() => {
|
||||||
showDeleteConfirm({
|
// showDeleteConfirm({
|
||||||
onOk: () => {
|
// onOk: () => {
|
||||||
removeDocument(selectedRowKeys);
|
// removeDocument(selectedRowKeys);
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
}, [removeDocument, showDeleteConfirm, selectedRowKeys]);
|
// }, [removeDocument, showDeleteConfirm, selectedRowKeys]);
|
||||||
|
|
||||||
const runDocument = useCallback(
|
// const runDocument = useCallback(
|
||||||
(run: number) => {
|
// (run: number) => {
|
||||||
runDocumentByIds({
|
// runDocumentByIds({
|
||||||
documentIds: selectedRowKeys,
|
// documentIds: selectedRowKeys,
|
||||||
run,
|
// run,
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
[runDocumentByIds, selectedRowKeys],
|
// [runDocumentByIds, selectedRowKeys],
|
||||||
);
|
// );
|
||||||
|
|
||||||
const handleRunClick = useCallback(() => {
|
// const handleRunClick = useCallback(() => {
|
||||||
runDocument(1);
|
// runDocument(1);
|
||||||
}, [runDocument]);
|
// }, [runDocument]);
|
||||||
|
|
||||||
const handleCancelClick = useCallback(() => {
|
// const handleCancelClick = useCallback(() => {
|
||||||
runDocument(2);
|
// runDocument(2);
|
||||||
}, [runDocument]);
|
// }, [runDocument]);
|
||||||
|
|
||||||
const onChangeStatus = useCallback(
|
// const onChangeStatus = useCallback(
|
||||||
(enabled: boolean) => {
|
// (enabled: boolean) => {
|
||||||
selectedRowKeys.forEach((id) => {
|
// selectedRowKeys.forEach((id) => {
|
||||||
setDocumentStatus({ status: enabled, documentId: id });
|
// setDocumentStatus({ status: enabled, documentId: id });
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
[selectedRowKeys, setDocumentStatus],
|
// [selectedRowKeys, setDocumentStatus],
|
||||||
);
|
// );
|
||||||
|
|
||||||
const handleEnableClick = useCallback(() => {
|
// const handleEnableClick = useCallback(() => {
|
||||||
onChangeStatus(true);
|
// onChangeStatus(true);
|
||||||
}, [onChangeStatus]);
|
// }, [onChangeStatus]);
|
||||||
|
|
||||||
const handleDisableClick = useCallback(() => {
|
// const handleDisableClick = useCallback(() => {
|
||||||
onChangeStatus(false);
|
// onChangeStatus(false);
|
||||||
}, [onChangeStatus]);
|
// }, [onChangeStatus]);
|
||||||
|
|
||||||
const disabled = selectedRowKeys.length === 0;
|
// const disabled = selectedRowKeys.length === 0;
|
||||||
|
|
||||||
const items: MenuProps['items'] = useMemo(() => {
|
// const items: MenuProps['items'] = useMemo(() => {
|
||||||
return [
|
// return [
|
||||||
{
|
// {
|
||||||
key: '0',
|
// key: '0',
|
||||||
onClick: handleEnableClick,
|
// onClick: handleEnableClick,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<EnableIcon></EnableIcon>
|
// <EnableIcon></EnableIcon>
|
||||||
<b>{t('enabled')}</b>
|
// <b>{t('enabled')}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
key: '1',
|
// key: '1',
|
||||||
onClick: handleDisableClick,
|
// onClick: handleDisableClick,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<DisableIcon></DisableIcon>
|
// <DisableIcon></DisableIcon>
|
||||||
<b>{t('disabled')}</b>
|
// <b>{t('disabled')}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{ type: 'divider' },
|
// { type: 'divider' },
|
||||||
{
|
// {
|
||||||
key: '2',
|
// key: '2',
|
||||||
onClick: handleRunClick,
|
// onClick: handleRunClick,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<RunIcon></RunIcon>
|
// <RunIcon></RunIcon>
|
||||||
<b>{t('run')}</b>
|
// <b>{t('run')}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
key: '3',
|
// key: '3',
|
||||||
onClick: handleCancelClick,
|
// onClick: handleCancelClick,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<CancelIcon />
|
// <CancelIcon />
|
||||||
<b>{t('cancel')}</b>
|
// <b>{t('cancel')}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{ type: 'divider' },
|
// { type: 'divider' },
|
||||||
{
|
// {
|
||||||
key: '4',
|
// key: '4',
|
||||||
onClick: handleDelete,
|
// onClick: handleDelete,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<span className={styles.deleteIconWrapper}>
|
// <span className={styles.deleteIconWrapper}>
|
||||||
<DeleteIcon width={18} />
|
// <DeleteIcon width={18} />
|
||||||
</span>
|
// </span>
|
||||||
<b>{t('delete', { keyPrefix: 'common' })}</b>
|
// <b>{t('delete', { keyPrefix: 'common' })}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
}, [
|
// }, [
|
||||||
handleDelete,
|
// handleDelete,
|
||||||
handleRunClick,
|
// handleRunClick,
|
||||||
handleCancelClick,
|
// handleCancelClick,
|
||||||
t,
|
// t,
|
||||||
handleDisableClick,
|
// handleDisableClick,
|
||||||
handleEnableClick,
|
// handleEnableClick,
|
||||||
]);
|
// ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.filter}>
|
<div className={styles.filter}>
|
||||||
<Dropdown
|
{/* <Dropdown
|
||||||
menu={{ items }}
|
menu={{ items }}
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
arrow={false}
|
arrow={false}
|
||||||
|
@ -200,8 +200,8 @@ const DocumentToolbar = ({
|
||||||
<DownOutlined />
|
<DownOutlined />
|
||||||
</Space>
|
</Space>
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown> */}
|
||||||
<Space>
|
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t('searchFiles')}
|
placeholder={t('searchFiles')}
|
||||||
value={searchString}
|
value={searchString}
|
||||||
|
@ -211,11 +211,11 @@ const DocumentToolbar = ({
|
||||||
prefix={<SearchOutlined />}
|
prefix={<SearchOutlined />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Dropdown menu={{ items: actionItems }} trigger={['click']}>
|
{/* <Dropdown menu={{ items: actionItems }} trigger={['click']}>
|
||||||
<Button type="primary" icon={<PlusOutlined />}>
|
<Button type="primary" icon={<PlusOutlined />}>
|
||||||
{t('addFile')}
|
{t('addFile')}
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown> */}
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,7 +22,6 @@ import {
|
||||||
useRenameDocument,
|
useRenameDocument,
|
||||||
useShowMetaModal,
|
useShowMetaModal,
|
||||||
} from './hooks';
|
} from './hooks';
|
||||||
import ParsingActionCell from './parsing-action-cell';
|
|
||||||
import ParsingStatusCell from './parsing-status-cell';
|
import ParsingStatusCell from './parsing-status-cell';
|
||||||
import RenameModal from './rename-modal';
|
import RenameModal from './rename-modal';
|
||||||
import WebCrawlModal from './web-crawl-modal';
|
import WebCrawlModal from './web-crawl-modal';
|
||||||
|
@ -163,19 +162,19 @@ const KnowledgeFile = () => {
|
||||||
return <ParsingStatusCell record={record}></ParsingStatusCell>;
|
return <ParsingStatusCell record={record}></ParsingStatusCell>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: t('action'),
|
// title: t('action'),
|
||||||
key: 'action',
|
// key: 'action',
|
||||||
render: (_, record) => (
|
// render: (_, record) => (
|
||||||
<ParsingActionCell
|
// <ParsingActionCell
|
||||||
setCurrentRecord={setRecord}
|
// setCurrentRecord={setRecord}
|
||||||
showRenameModal={showRenameModal}
|
// showRenameModal={showRenameModal}
|
||||||
showChangeParserModal={showChangeParserModal}
|
// showChangeParserModal={showChangeParserModal}
|
||||||
showSetMetaModal={showSetMetaModal}
|
// showSetMetaModal={showSetMetaModal}
|
||||||
record={record}
|
// record={record}
|
||||||
></ParsingActionCell>
|
// ></ParsingActionCell>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
const finalColumns = columns.map((x) => ({
|
const finalColumns = columns.map((x) => ({
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
import { useShowDeleteConfirm, useTranslate } from '@/hooks/common-hooks';
|
// import { useShowDeleteConfirm, useTranslate } from '@/hooks/common-hooks';
|
||||||
import { useRemoveNextDocument } from '@/hooks/document-hooks';
|
// import { useRemoveNextDocument } from '@/hooks/document-hooks';
|
||||||
import { IDocumentInfo } from '@/interfaces/database/document';
|
// import { IDocumentInfo } from '@/interfaces/database/document';
|
||||||
import { downloadDocument } from '@/utils/file-util';
|
// import { downloadDocument } from '@/utils/file-util';
|
||||||
import {
|
// import {
|
||||||
DeleteOutlined,
|
// DeleteOutlined,
|
||||||
DownloadOutlined,
|
// DownloadOutlined,
|
||||||
EditOutlined,
|
// EditOutlined,
|
||||||
ToolOutlined,
|
// ToolOutlined,
|
||||||
} from '@ant-design/icons';
|
// } from '@ant-design/icons';
|
||||||
import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
|
import { Space } from 'antd';
|
||||||
import { isParserRunning } from '../utils';
|
// import { isParserRunning } from '../utils';
|
||||||
|
|
||||||
import { useCallback } from 'react';
|
// import { useCallback } from 'react';
|
||||||
import { DocumentType } from '../constant';
|
// import { DocumentType } from '../constant';
|
||||||
import styles from './index.less';
|
// import styles from './index.less';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
record: IDocumentInfo;
|
record: IDocumentInfo;
|
||||||
|
@ -23,83 +23,85 @@ interface IProps {
|
||||||
showSetMetaModal: () => void;
|
showSetMetaModal: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ParsingActionCell = ({
|
const ParsingActionCell = (
|
||||||
record,
|
{
|
||||||
setCurrentRecord,
|
// record,
|
||||||
showRenameModal,
|
// setCurrentRecord,
|
||||||
showChangeParserModal,
|
// showRenameModal,
|
||||||
showSetMetaModal,
|
// showChangeParserModal,
|
||||||
}: IProps) => {
|
// showSetMetaModal,
|
||||||
const documentId = record.id;
|
}: IProps,
|
||||||
const isRunning = isParserRunning(record.run);
|
) => {
|
||||||
const { t } = useTranslate('knowledgeDetails');
|
// const documentId = record.id;
|
||||||
const { removeDocument } = useRemoveNextDocument();
|
// const isRunning = isParserRunning(record.run);
|
||||||
const showDeleteConfirm = useShowDeleteConfirm();
|
// const { t } = useTranslate('knowledgeDetails');
|
||||||
const isVirtualDocument = record.type === DocumentType.Virtual;
|
// const { removeDocument } = useRemoveNextDocument();
|
||||||
|
// const showDeleteConfirm = useShowDeleteConfirm();
|
||||||
|
// const isVirtualDocument = record.type === DocumentType.Virtual;
|
||||||
|
|
||||||
const onRmDocument = () => {
|
// const onRmDocument = () => {
|
||||||
if (!isRunning) {
|
// if (!isRunning) {
|
||||||
showDeleteConfirm({
|
// showDeleteConfirm({
|
||||||
onOk: () => removeDocument([documentId]),
|
// onOk: () => removeDocument([documentId]),
|
||||||
content: record?.parser_config?.graphrag?.use_graphrag
|
// content: record?.parser_config?.graphrag?.use_graphrag
|
||||||
? t('deleteDocumentConfirmContent')
|
// ? t('deleteDocumentConfirmContent')
|
||||||
: '',
|
// : '',
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
const onDownloadDocument = () => {
|
// const onDownloadDocument = () => {
|
||||||
downloadDocument({
|
// downloadDocument({
|
||||||
id: documentId,
|
// id: documentId,
|
||||||
filename: record.name,
|
// filename: record.name,
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
const setRecord = useCallback(() => {
|
// const setRecord = useCallback(() => {
|
||||||
setCurrentRecord(record);
|
// setCurrentRecord(record);
|
||||||
}, [record, setCurrentRecord]);
|
// }, [record, setCurrentRecord]);
|
||||||
|
|
||||||
const onShowRenameModal = () => {
|
// const onShowRenameModal = () => {
|
||||||
setRecord();
|
// setRecord();
|
||||||
showRenameModal();
|
// showRenameModal();
|
||||||
};
|
// };
|
||||||
const onShowChangeParserModal = () => {
|
// const onShowChangeParserModal = () => {
|
||||||
setRecord();
|
// setRecord();
|
||||||
showChangeParserModal();
|
// showChangeParserModal();
|
||||||
};
|
// };
|
||||||
|
|
||||||
const onShowSetMetaModal = useCallback(() => {
|
// const onShowSetMetaModal = useCallback(() => {
|
||||||
setRecord();
|
// setRecord();
|
||||||
showSetMetaModal();
|
// showSetMetaModal();
|
||||||
}, [setRecord, showSetMetaModal]);
|
// }, [setRecord, showSetMetaModal]);
|
||||||
|
|
||||||
const chunkItems: MenuProps['items'] = [
|
// const chunkItems: MenuProps['items'] = [
|
||||||
{
|
// {
|
||||||
key: '1',
|
// key: '1',
|
||||||
label: (
|
// label: (
|
||||||
<div className="flex flex-col">
|
// <div className="flex flex-col">
|
||||||
<Button type="link" onClick={onShowChangeParserModal}>
|
// <Button type="link" onClick={onShowChangeParserModal}>
|
||||||
{t('chunkMethod')}
|
// {t('chunkMethod')}
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{ type: 'divider' },
|
// { type: 'divider' },
|
||||||
{
|
// {
|
||||||
key: '2',
|
// key: '2',
|
||||||
label: (
|
// label: (
|
||||||
<div className="flex flex-col">
|
// <div className="flex flex-col">
|
||||||
<Button type="link" onClick={onShowSetMetaModal}>
|
// <Button type="link" onClick={onShowSetMetaModal}>
|
||||||
{t('setMetaData')}
|
// {t('setMetaData')}
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space size={0}>
|
<Space size={0}>
|
||||||
{isVirtualDocument || (
|
{/* {isVirtualDocument || (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
menu={{ items: chunkItems }}
|
menu={{ items: chunkItems }}
|
||||||
trigger={['click']}
|
trigger={['click']}
|
||||||
|
@ -141,7 +143,7 @@ const ParsingActionCell = ({
|
||||||
<DownloadOutlined size={20} />
|
<DownloadOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)} */}
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,16 +3,7 @@ import { ReactComponent as RefreshIcon } from '@/assets/svg/refresh.svg';
|
||||||
import { ReactComponent as RunIcon } from '@/assets/svg/run.svg';
|
import { ReactComponent as RunIcon } from '@/assets/svg/run.svg';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { IDocumentInfo } from '@/interfaces/database/document';
|
import { IDocumentInfo } from '@/interfaces/database/document';
|
||||||
import {
|
import { Badge, DescriptionsProps, Flex, Popover, Space, Tag } from 'antd';
|
||||||
Badge,
|
|
||||||
DescriptionsProps,
|
|
||||||
Flex,
|
|
||||||
Popconfirm,
|
|
||||||
Popover,
|
|
||||||
Space,
|
|
||||||
Tag,
|
|
||||||
} from 'antd';
|
|
||||||
import classNames from 'classnames';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import reactStringReplace from 'react-string-replace';
|
import reactStringReplace from 'react-string-replace';
|
||||||
import { DocumentType, RunningStatus, RunningStatusMap } from '../constant';
|
import { DocumentType, RunningStatus, RunningStatusMap } from '../constant';
|
||||||
|
@ -121,7 +112,7 @@ export const ParsingStatusCell = ({ record }: IProps) => {
|
||||||
)}
|
)}
|
||||||
</Tag>
|
</Tag>
|
||||||
</Popover>
|
</Popover>
|
||||||
<Popconfirm
|
{/* <Popconfirm
|
||||||
title={t(`knowledgeDetails.redo`, { chunkNum: record.chunk_num })}
|
title={t(`knowledgeDetails.redo`, { chunkNum: record.chunk_num })}
|
||||||
onConfirm={handleOperationIconClick(true)}
|
onConfirm={handleOperationIconClick(true)}
|
||||||
onCancel={handleOperationIconClick(false)}
|
onCancel={handleOperationIconClick(false)}
|
||||||
|
@ -139,7 +130,7 @@ export const ParsingStatusCell = ({ record }: IProps) => {
|
||||||
>
|
>
|
||||||
<OperationIcon />
|
<OperationIcon />
|
||||||
</div>
|
</div>
|
||||||
</Popconfirm>
|
</Popconfirm> */}
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,7 +65,7 @@ const CategoryPanel = ({ chunkMethod }: { chunkMethod: string }) => {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Empty description={''} image={null}>
|
<Empty description={''} image={null}>
|
||||||
<p>{t('methodEmpty')}</p>
|
{/* <p>{t('methodEmpty')}</p> */}
|
||||||
<SvgIcon name={'chunk-method/chunk-empty'} width={'100%'}></SvgIcon>
|
<SvgIcon name={'chunk-method/chunk-empty'} width={'100%'}></SvgIcon>
|
||||||
</Empty>
|
</Empty>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -109,7 +109,7 @@ export const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<ConfigurationComponent></ConfigurationComponent>
|
{/* <ConfigurationComponent></ConfigurationComponent> */}
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<div className={styles.buttonWrapper}>
|
<div className={styles.buttonWrapper}>
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { Button, Card, Divider, Flex, Form, Input } from 'antd';
|
||||||
import { FormInstance } from 'antd/lib';
|
import { FormInstance } from 'antd/lib';
|
||||||
import { LabelWordCloud } from './label-word-cloud';
|
import { LabelWordCloud } from './label-word-cloud';
|
||||||
|
|
||||||
import { UseKnowledgeGraphItem } from '@/components/use-knowledge-graph-item';
|
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
type FieldType = {
|
type FieldType = {
|
||||||
|
@ -39,7 +38,7 @@ const TestingControl = ({ form, handleTesting }: IProps) => {
|
||||||
<Form name="testing" layout="vertical" form={form}>
|
<Form name="testing" layout="vertical" form={form}>
|
||||||
<SimilaritySlider isTooltipShown></SimilaritySlider>
|
<SimilaritySlider isTooltipShown></SimilaritySlider>
|
||||||
<Rerank></Rerank>
|
<Rerank></Rerank>
|
||||||
<UseKnowledgeGraphItem filedName={['use_kg']}></UseKnowledgeGraphItem>
|
{/* <UseKnowledgeGraphItem filedName={['use_kg']}></UseKnowledgeGraphItem> */}
|
||||||
<Card size="small" title={t('testText')}>
|
<Card size="small" title={t('testText')}>
|
||||||
<Form.Item<FieldType>
|
<Form.Item<FieldType>
|
||||||
name={'question'}
|
name={'question'}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import KnowledgeBaseItem from '@/components/knowledge-base-item';
|
import KnowledgeBaseItem from '@/components/knowledge-base-item';
|
||||||
import { TavilyItem } from '@/components/tavily-item';
|
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
@ -130,7 +129,7 @@ const AssistantSetting = ({
|
||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label={t('keyword')}
|
label={t('keyword')}
|
||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
name={['prompt_config', 'keyword']}
|
name={['prompt_config', 'keyword']}
|
||||||
|
@ -138,8 +137,8 @@ const AssistantSetting = ({
|
||||||
initialValue={false}
|
initialValue={false}
|
||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label={t('tts')}
|
label={t('tts')}
|
||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
name={['prompt_config', 'tts']}
|
name={['prompt_config', 'tts']}
|
||||||
|
@ -147,8 +146,8 @@ const AssistantSetting = ({
|
||||||
initialValue={false}
|
initialValue={false}
|
||||||
>
|
>
|
||||||
<Switch onChange={handleTtsChange} />
|
<Switch onChange={handleTtsChange} />
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
<TavilyItem></TavilyItem>
|
{/* <TavilyItem></TavilyItem> */}
|
||||||
<KnowledgeBaseItem
|
<KnowledgeBaseItem
|
||||||
required={false}
|
required={false}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import SimilaritySlider from '@/components/similarity-slider';
|
import SimilaritySlider from '@/components/similarity-slider';
|
||||||
import { DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
import { DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
Button,
|
|
||||||
Col,
|
Col,
|
||||||
Divider,
|
Divider,
|
||||||
Form,
|
Form,
|
||||||
|
@ -20,7 +19,6 @@ import {
|
||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { v4 as uuid } from 'uuid';
|
|
||||||
import {
|
import {
|
||||||
VariableTableDataType as DataType,
|
VariableTableDataType as DataType,
|
||||||
IPromptConfigParameters,
|
IPromptConfigParameters,
|
||||||
|
@ -30,7 +28,7 @@ import { EditableCell, EditableRow } from './editable-cell';
|
||||||
|
|
||||||
import Rerank from '@/components/rerank';
|
import Rerank from '@/components/rerank';
|
||||||
import TopNItem from '@/components/top-n-item';
|
import TopNItem from '@/components/top-n-item';
|
||||||
import { UseKnowledgeGraphItem } from '@/components/use-knowledge-graph-item';
|
// import { UseKnowledgeGraphItem } from '@/components/use-knowledge-graph-item';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { useSelectPromptConfigParameters } from '../hooks';
|
import { useSelectPromptConfigParameters } from '../hooks';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
@ -66,16 +64,16 @@ const PromptEngine = (
|
||||||
setDataSource(newData);
|
setDataSource(newData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAdd = () => {
|
// const handleAdd = () => {
|
||||||
setDataSource((state) => [
|
// setDataSource((state) => [
|
||||||
...state,
|
// ...state,
|
||||||
{
|
// {
|
||||||
key: uuid(),
|
// key: uuid(),
|
||||||
variable: '',
|
// variable: '',
|
||||||
optional: true,
|
// optional: true,
|
||||||
},
|
// },
|
||||||
]);
|
// ]);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const handleOptionalChange = (row: DataType) => (checked: boolean) => {
|
const handleOptionalChange = (row: DataType) => (checked: boolean) => {
|
||||||
const newData = [...dataSource];
|
const newData = [...dataSource];
|
||||||
|
@ -157,25 +155,25 @@ const PromptEngine = (
|
||||||
<Divider></Divider>
|
<Divider></Divider>
|
||||||
<SimilaritySlider isTooltipShown></SimilaritySlider>
|
<SimilaritySlider isTooltipShown></SimilaritySlider>
|
||||||
<TopNItem></TopNItem>
|
<TopNItem></TopNItem>
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label={t('multiTurn')}
|
label={t('multiTurn')}
|
||||||
tooltip={t('multiTurnTip')}
|
tooltip={t('multiTurnTip')}
|
||||||
name={['prompt_config', 'refine_multiturn']}
|
name={['prompt_config', 'refine_multiturn']}
|
||||||
initialValue={false}
|
initialValue={false}
|
||||||
>
|
>
|
||||||
<Switch></Switch>
|
<Switch></Switch>
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
<UseKnowledgeGraphItem
|
{/* <UseKnowledgeGraphItem
|
||||||
filedName={['prompt_config', 'use_kg']}
|
filedName={['prompt_config', 'use_kg']}
|
||||||
></UseKnowledgeGraphItem>
|
></UseKnowledgeGraphItem> */}
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label={t('reasoning')}
|
label={t('reasoning')}
|
||||||
tooltip={t('reasoningTip')}
|
tooltip={t('reasoningTip')}
|
||||||
name={['prompt_config', 'reasoning']}
|
name={['prompt_config', 'reasoning']}
|
||||||
initialValue={false}
|
initialValue={false}
|
||||||
>
|
>
|
||||||
<Switch></Switch>
|
<Switch></Switch>
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
<Rerank></Rerank>
|
<Rerank></Rerank>
|
||||||
<section className={classNames(styles.variableContainer)}>
|
<section className={classNames(styles.variableContainer)}>
|
||||||
<Row align={'middle'} justify="end">
|
<Row align={'middle'} justify="end">
|
||||||
|
@ -188,9 +186,9 @@ const PromptEngine = (
|
||||||
</label>
|
</label>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={15} className={styles.variableAlign}>
|
<Col span={15} className={styles.variableAlign}>
|
||||||
<Button size="small" onClick={handleAdd}>
|
{/* <Button size="small" onClick={handleAdd}>
|
||||||
{t('add')}
|
{t('add')}
|
||||||
</Button>
|
</Button> */}
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{dataSource.length > 0 && (
|
{dataSource.length > 0 && (
|
||||||
|
|
|
@ -103,7 +103,7 @@ export const useSelectPromptConfigParameters = (): VariableTableDataType[] => {
|
||||||
const parameters = currentDialog?.prompt_config?.parameters ?? [];
|
const parameters = currentDialog?.prompt_config?.parameters ?? [];
|
||||||
if (!currentDialog.id) {
|
if (!currentDialog.id) {
|
||||||
// The newly created chat has a default parameter
|
// The newly created chat has a default parameter
|
||||||
return [{ key: uuid(), variable: 'knowledge', optional: false }];
|
return [{ key: uuid(), variable: 'knowledge', optional: true }];
|
||||||
}
|
}
|
||||||
return parameters.map((x) => ({
|
return parameters.map((x) => ({
|
||||||
key: uuid(),
|
key: uuid(),
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
import NewDocumentLink from '@/components/new-document-link';
|
import NewDocumentLink from '@/components/new-document-link';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { useDownloadFile } from '@/hooks/file-manager-hooks';
|
// import { useDownloadFile } from '@/hooks/file-manager-hooks';
|
||||||
import { IFile } from '@/interfaces/database/file-manager';
|
import { IFile } from '@/interfaces/database/file-manager';
|
||||||
import {
|
import {
|
||||||
getExtension,
|
getExtension,
|
||||||
isSupportedPreviewDocumentType,
|
isSupportedPreviewDocumentType,
|
||||||
} from '@/utils/document-util';
|
} from '@/utils/document-util';
|
||||||
import {
|
import {
|
||||||
DownloadOutlined,
|
// DownloadOutlined,
|
||||||
EditOutlined,
|
// EditOutlined,
|
||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
LinkOutlined,
|
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { Button, Space, Tooltip } from 'antd';
|
import { Button, Space, Tooltip } from 'antd';
|
||||||
import { FolderInput, Trash2 } from 'lucide-react';
|
// import { FolderInput, Trash2 } from 'lucide-react';
|
||||||
import { useHandleDeleteFile } from '../hooks';
|
// import { useHandleDeleteFile } from '../hooks';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
record: IFile;
|
record: IFile;
|
||||||
|
@ -27,65 +26,64 @@ interface IProps {
|
||||||
|
|
||||||
const ActionCell = ({
|
const ActionCell = ({
|
||||||
record,
|
record,
|
||||||
setCurrentRecord,
|
// setCurrentRecord,
|
||||||
showRenameModal,
|
// showRenameModal,
|
||||||
showConnectToKnowledgeModal,
|
// showConnectToKnowledgeModal,
|
||||||
setSelectedRowKeys,
|
// setSelectedRowKeys,
|
||||||
showMoveFileModal,
|
// showMoveFileModal,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const documentId = record.id;
|
const documentId = record.id;
|
||||||
const beingUsed = false;
|
// const beingUsed = false;
|
||||||
const { t } = useTranslate('fileManager');
|
const { t } = useTranslate('fileManager');
|
||||||
const { handleRemoveFile } = useHandleDeleteFile(
|
// const { handleRemoveFile } = useHandleDeleteFile(
|
||||||
[documentId],
|
// [documentId],
|
||||||
setSelectedRowKeys,
|
// setSelectedRowKeys,
|
||||||
);
|
// );
|
||||||
const { downloadFile, loading } = useDownloadFile();
|
// const { downloadFile, loading } = useDownloadFile();
|
||||||
const extension = getExtension(record.name);
|
const extension = getExtension(record.name);
|
||||||
const isKnowledgeBase = record.source_type === 'knowledgebase';
|
// const isKnowledgeBase = record.source_type === 'knowledgebase';
|
||||||
|
|
||||||
const onDownloadDocument = () => {
|
// const onDownloadDocument = () => {
|
||||||
downloadFile({
|
// downloadFile({
|
||||||
id: documentId,
|
// id: documentId,
|
||||||
filename: record.name,
|
// filename: record.name,
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
const setRecord = () => {
|
// const setRecord = () => {
|
||||||
setCurrentRecord(record);
|
// setCurrentRecord(record);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const onShowRenameModal = () => {
|
// const onShowRenameModal = () => {
|
||||||
setRecord();
|
// setRecord();
|
||||||
showRenameModal(record);
|
// showRenameModal(record);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const onShowConnectToKnowledgeModal = () => {
|
// const onShowConnectToKnowledgeModal = () => {
|
||||||
showConnectToKnowledgeModal(record);
|
// showConnectToKnowledgeModal(record);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const onShowMoveFileModal = () => {
|
// const onShowMoveFileModal = () => {
|
||||||
showMoveFileModal([documentId]);
|
// showMoveFileModal([documentId]);
|
||||||
};
|
// };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space size={0}>
|
<Space size={0}>
|
||||||
{isKnowledgeBase || (
|
{/* {isKnowledgeBase || (
|
||||||
<Tooltip title={t('addToKnowledge')}>
|
<Tooltip title={t('addToKnowledge')}>
|
||||||
<Button type="text" onClick={onShowConnectToKnowledgeModal}>
|
<Button type="text" onClick={onShowConnectToKnowledgeModal}>
|
||||||
<LinkOutlined size={20} />
|
<LinkOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)} */}
|
||||||
|
{/* { {isKnowledgeBase || (
|
||||||
{isKnowledgeBase || (
|
|
||||||
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
|
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
|
||||||
<Button type="text" disabled={beingUsed} onClick={onShowRenameModal}>
|
<Button type="text" disabled={beingUsed} onClick={onShowRenameModal}>
|
||||||
<EditOutlined size={20} />
|
<EditOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)} }
|
||||||
{isKnowledgeBase || (
|
{ {isKnowledgeBase || (
|
||||||
<Tooltip title={t('move', { keyPrefix: 'common' })}>
|
<Tooltip title={t('move', { keyPrefix: 'common' })}>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -96,8 +94,8 @@ const ActionCell = ({
|
||||||
<FolderInput className="size-4" />
|
<FolderInput className="size-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)} }
|
||||||
{isKnowledgeBase || (
|
{ {isKnowledgeBase || (
|
||||||
<Tooltip title={t('delete', { keyPrefix: 'common' })}>
|
<Tooltip title={t('delete', { keyPrefix: 'common' })}>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -108,8 +106,8 @@ const ActionCell = ({
|
||||||
<Trash2 className="size-4" />
|
<Trash2 className="size-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)} }
|
||||||
{record.type !== 'folder' && (
|
{ {record.type !== 'folder' && (
|
||||||
<Tooltip title={t('download', { keyPrefix: 'common' })}>
|
<Tooltip title={t('download', { keyPrefix: 'common' })}>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -120,7 +118,9 @@ const ActionCell = ({
|
||||||
<DownloadOutlined size={20} />
|
<DownloadOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)} }
|
||||||
|
*/}
|
||||||
|
|
||||||
{isSupportedPreviewDocumentType(extension) && (
|
{isSupportedPreviewDocumentType(extension) && (
|
||||||
<NewDocumentLink
|
<NewDocumentLink
|
||||||
documentId={documentId}
|
documentId={documentId}
|
||||||
|
|
|
@ -1,33 +1,30 @@
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
|
import { IListResult } from '@/hooks/file-manager-hooks';
|
||||||
import {
|
import {
|
||||||
IListResult,
|
// DownOutlined,
|
||||||
useFetchParentFolderList,
|
// FileTextOutlined,
|
||||||
} from '@/hooks/file-manager-hooks';
|
// FolderOpenOutlined,
|
||||||
import {
|
// PlusOutlined,
|
||||||
DownOutlined,
|
|
||||||
FileTextOutlined,
|
|
||||||
FolderOpenOutlined,
|
|
||||||
PlusOutlined,
|
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
BreadcrumbProps,
|
BreadcrumbProps,
|
||||||
Button,
|
// Button,
|
||||||
Dropdown,
|
// Dropdown,
|
||||||
Flex,
|
// Flex,
|
||||||
Input,
|
Input,
|
||||||
MenuProps,
|
// MenuProps,
|
||||||
Space,
|
Space,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { useCallback, useMemo } from 'react';
|
// import { useCallback, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
useHandleBreadcrumbClick,
|
useHandleBreadcrumbClick,
|
||||||
useHandleDeleteFile,
|
// useHandleDeleteFile,
|
||||||
useSelectBreadcrumbItems,
|
useSelectBreadcrumbItems,
|
||||||
} from './hooks';
|
} from './hooks';
|
||||||
|
|
||||||
import { FolderInput, Trash2 } from 'lucide-react';
|
// import { FolderInput, Trash2 } from 'lucide-react';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
interface IProps
|
interface IProps
|
||||||
|
@ -40,20 +37,20 @@ interface IProps
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileToolbar = ({
|
const FileToolbar = ({
|
||||||
selectedRowKeys,
|
// selectedRowKeys,
|
||||||
showFolderCreateModal,
|
// showFolderCreateModal,
|
||||||
showFileUploadModal,
|
// showFileUploadModal,
|
||||||
setSelectedRowKeys,
|
// setSelectedRowKeys,
|
||||||
searchString,
|
searchString,
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
showMoveFileModal,
|
// showMoveFileModal,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const { t } = useTranslate('knowledgeDetails');
|
const { t } = useTranslate('knowledgeDetails');
|
||||||
const breadcrumbItems = useSelectBreadcrumbItems();
|
const breadcrumbItems = useSelectBreadcrumbItems();
|
||||||
const { handleBreadcrumbClick } = useHandleBreadcrumbClick();
|
const { handleBreadcrumbClick } = useHandleBreadcrumbClick();
|
||||||
const parentFolderList = useFetchParentFolderList();
|
// const parentFolderList = useFetchParentFolderList();
|
||||||
const isKnowledgeBase =
|
// const isKnowledgeBase =
|
||||||
parentFolderList.at(-1)?.source_type === 'knowledgebase';
|
// parentFolderList.at(-1)?.source_type === 'knowledgebase';
|
||||||
|
|
||||||
const itemRender: BreadcrumbProps['itemRender'] = (
|
const itemRender: BreadcrumbProps['itemRender'] = (
|
||||||
currentRoute,
|
currentRoute,
|
||||||
|
@ -74,85 +71,85 @@ const FileToolbar = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const actionItems: MenuProps['items'] = useMemo(() => {
|
// const actionItems: MenuProps['items'] = useMemo(() => {
|
||||||
return [
|
// return [
|
||||||
{
|
// {
|
||||||
key: '1',
|
// key: '1',
|
||||||
onClick: showFileUploadModal,
|
// onClick: showFileUploadModal,
|
||||||
label: (
|
// label: (
|
||||||
<div>
|
// <div>
|
||||||
<Button type="link">
|
// <Button type="link">
|
||||||
<Space>
|
// <Space>
|
||||||
<FileTextOutlined />
|
// <FileTextOutlined />
|
||||||
{t('uploadFile', { keyPrefix: 'fileManager' })}
|
// {t('uploadFile', { keyPrefix: 'fileManager' })}
|
||||||
</Space>
|
// </Space>
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{ type: 'divider' },
|
// { type: 'divider' },
|
||||||
{
|
// {
|
||||||
key: '2',
|
// key: '2',
|
||||||
onClick: showFolderCreateModal,
|
// onClick: showFolderCreateModal,
|
||||||
label: (
|
// label: (
|
||||||
<div>
|
// <div>
|
||||||
<Button type="link">
|
// <Button type="link">
|
||||||
<Space>
|
// <Space>
|
||||||
<FolderOpenOutlined />
|
// <FolderOpenOutlined />
|
||||||
{t('newFolder', { keyPrefix: 'fileManager' })}
|
// {t('newFolder', { keyPrefix: 'fileManager' })}
|
||||||
</Space>
|
// </Space>
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
}, [t, showFolderCreateModal, showFileUploadModal]);
|
// }, [t, showFolderCreateModal, showFileUploadModal]);
|
||||||
|
|
||||||
const { handleRemoveFile } = useHandleDeleteFile(
|
// const { handleRemoveFile } = useHandleDeleteFile(
|
||||||
selectedRowKeys,
|
// selectedRowKeys,
|
||||||
setSelectedRowKeys,
|
// setSelectedRowKeys,
|
||||||
);
|
// );
|
||||||
|
|
||||||
const handleShowMoveFileModal = useCallback(() => {
|
// const handleShowMoveFileModal = useCallback(() => {
|
||||||
showMoveFileModal(selectedRowKeys);
|
// showMoveFileModal(selectedRowKeys);
|
||||||
}, [selectedRowKeys, showMoveFileModal]);
|
// }, [selectedRowKeys, showMoveFileModal]);
|
||||||
|
|
||||||
const disabled = selectedRowKeys.length === 0;
|
// const disabled = selectedRowKeys.length === 0;
|
||||||
|
|
||||||
const items: MenuProps['items'] = useMemo(() => {
|
// const items: MenuProps['items'] = useMemo(() => {
|
||||||
return [
|
// return [
|
||||||
{
|
// {
|
||||||
key: '4',
|
// key: '4',
|
||||||
onClick: handleRemoveFile,
|
// onClick: handleRemoveFile,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<span className="flex items-center justify-center">
|
// <span className="flex items-center justify-center">
|
||||||
<Trash2 className="size-4" />
|
// <Trash2 className="size-4" />
|
||||||
</span>
|
// </span>
|
||||||
<b>{t('delete', { keyPrefix: 'common' })}</b>
|
// <b>{t('delete', { keyPrefix: 'common' })}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
key: '5',
|
// key: '5',
|
||||||
onClick: handleShowMoveFileModal,
|
// onClick: handleShowMoveFileModal,
|
||||||
label: (
|
// label: (
|
||||||
<Flex gap={10}>
|
// <Flex gap={10}>
|
||||||
<span className="flex items-center justify-center">
|
// <span className="flex items-center justify-center">
|
||||||
<FolderInput className="size-4"></FolderInput>
|
// <FolderInput className="size-4"></FolderInput>
|
||||||
</span>
|
// </span>
|
||||||
<b>{t('move', { keyPrefix: 'common' })}</b>
|
// <b>{t('move', { keyPrefix: 'common' })}</b>
|
||||||
</Flex>
|
// </Flex>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
}, [handleShowMoveFileModal, t, handleRemoveFile]);
|
// }, [handleShowMoveFileModal, t, handleRemoveFile]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.filter}>
|
<div className={styles.filter}>
|
||||||
<Breadcrumb items={breadcrumbItems} itemRender={itemRender} />
|
<Breadcrumb items={breadcrumbItems} itemRender={itemRender} />
|
||||||
<Space>
|
<Space>
|
||||||
{isKnowledgeBase || (
|
{/* {isKnowledgeBase || (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
menu={{ items }}
|
menu={{ items }}
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
|
@ -166,7 +163,7 @@ const FileToolbar = ({
|
||||||
</Space>
|
</Space>
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
)}
|
)} */}
|
||||||
<Input
|
<Input
|
||||||
placeholder={t('searchFiles')}
|
placeholder={t('searchFiles')}
|
||||||
value={searchString}
|
value={searchString}
|
||||||
|
@ -176,13 +173,13 @@ const FileToolbar = ({
|
||||||
prefix={<SearchOutlined />}
|
prefix={<SearchOutlined />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{isKnowledgeBase || (
|
{/* {isKnowledgeBase || (
|
||||||
<Dropdown menu={{ items: actionItems }} trigger={['click']}>
|
<Dropdown menu={{ items: actionItems }} trigger={['click']}>
|
||||||
<Button type="primary" icon={<PlusOutlined />}>
|
<Button type="primary" icon={<PlusOutlined />}>
|
||||||
{t('addFile')}
|
{t('addFile')}
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
)}
|
)} */}
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -50,13 +50,13 @@ const BedrockModal = ({
|
||||||
footer={(originNode: React.ReactNode) => {
|
footer={(originNode: React.ReactNode) => {
|
||||||
return (
|
return (
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<a
|
{/* <a
|
||||||
href="https://console.aws.amazon.com/"
|
href="https://console.aws.amazon.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
{t('ollamaLink', { name: llmFactory })}
|
{t('ollamaLink', { name: llmFactory })}
|
||||||
</a>
|
</a> */}
|
||||||
<Space>{originNode}</Space>
|
<Space>{originNode}</Space>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|
|
@ -111,10 +111,10 @@ const OllamaModal = ({
|
||||||
okButtonProps={{ loading }}
|
okButtonProps={{ loading }}
|
||||||
footer={(originNode: React.ReactNode) => {
|
footer={(originNode: React.ReactNode) => {
|
||||||
return (
|
return (
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'flex-end'}>
|
||||||
<a href={url} target="_blank" rel="noreferrer">
|
{/* <a href={url} target="_blank" rel="noreferrer">
|
||||||
{t('ollamaLink', { name: llmFactory })}
|
{t('ollamaLink', { name: llmFactory })}
|
||||||
</a>
|
</a> */}
|
||||||
<Space>{originNode}</Space>
|
<Space>{originNode}</Space>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|
|
@ -81,13 +81,13 @@ const SystemModelSettingModal = ({
|
||||||
<Select options={allOptions[LlmModelType.Image2text]} allowClear />
|
<Select options={allOptions[LlmModelType.Image2text]} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label={t('sequence2txtModel')}
|
label={t('sequence2txtModel')}
|
||||||
name="asr_id"
|
name="asr_id"
|
||||||
tooltip={t('sequence2txtModelTip')}
|
tooltip={t('sequence2txtModelTip')}
|
||||||
>
|
>
|
||||||
<Select options={allOptions[LlmModelType.Speech2text]} allowClear />
|
<Select options={allOptions[LlmModelType.Speech2text]} allowClear />
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t('rerankModel')}
|
label={t('rerankModel')}
|
||||||
name="rerank_id"
|
name="rerank_id"
|
||||||
|
@ -95,13 +95,13 @@ const SystemModelSettingModal = ({
|
||||||
>
|
>
|
||||||
<Select options={allOptions[LlmModelType.Rerank]} allowClear />
|
<Select options={allOptions[LlmModelType.Rerank]} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label={t('ttsModel')}
|
label={t('ttsModel')}
|
||||||
name="tts_id"
|
name="tts_id"
|
||||||
tooltip={t('ttsModelTip')}
|
tooltip={t('ttsModelTip')}
|
||||||
>
|
>
|
||||||
<Select options={allOptions[LlmModelType.TTS]} allowClear />
|
<Select options={allOptions[LlmModelType.TTS]} allowClear />
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,13 +53,13 @@ const VolcEngineModal = ({
|
||||||
footer={(originNode: React.ReactNode) => {
|
footer={(originNode: React.ReactNode) => {
|
||||||
return (
|
return (
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<a
|
{/* <a
|
||||||
href="https://www.volcengine.com/docs/82379/1302008"
|
href="https://www.volcengine.com/docs/82379/1302008"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
{t('ollamaLink', { name: llmFactory })}
|
{t('ollamaLink', { name: llmFactory })}
|
||||||
</a>
|
</a> */}
|
||||||
<Space>{originNode}</Space>
|
<Space>{originNode}</Space>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue