mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 14:18:57 +08:00
### What problem does this PR solve? feat: change all file names to lowercase #1574 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
06fd35d420
commit
58e95f76c1
@ -1,7 +1,7 @@
|
||||
import {
|
||||
useFetchTenantInfo,
|
||||
useSelectParserList,
|
||||
} from '@/hooks/userSettingHook';
|
||||
} from '@/hooks/user-setting-hooks';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
const ParserListMap = new Map([
|
||||
|
@ -21,7 +21,7 @@ import omit from 'lodash/omit';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { useFetchParserListOnMount } from './hooks';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import LayoutRecognize from '../layout-recognize';
|
||||
import ParseConfiguration, {
|
||||
showRaptorParseConfiguration,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
|
||||
import { Tooltip } from 'antd';
|
||||
import { useState } from 'react';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { InboxOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
|
||||
import { Form, Select } from 'antd';
|
||||
|
||||
const KnowledgeBaseItem = () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Switch } from 'antd';
|
||||
|
||||
const LayoutRecognize = () => {
|
||||
|
@ -6,8 +6,8 @@ import {
|
||||
import { Divider, Flex, Form, InputNumber, Select, Slider, Switch } from 'antd';
|
||||
import camelCase from 'lodash/camelCase';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSelectLlmOptionsByModelType } from '@/hooks/llm-hooks';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import styles from './index.less';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Flex, Form, InputNumber, Slider } from 'antd';
|
||||
|
||||
const MaxTokenNumber = () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { ReactComponent as AssistantIcon } from '@/assets/svg/assistant.svg';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useGetDocumentUrl } from '@/hooks/documentHooks';
|
||||
import { useSelectFileThumbnails } from '@/hooks/knowledgeHook';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useGetDocumentUrl } from '@/hooks/document-hooks';
|
||||
import { useSelectFileThumbnails } from '@/hooks/knowledge-hooks';
|
||||
import { IReference, Message } from '@/interfaces/database/chat';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import classNames from 'classnames';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useShowDeleteConfirm } from '@/hooks/commonHooks';
|
||||
import { useShowDeleteConfirm } from '@/hooks/common-hooks';
|
||||
import { DeleteOutlined, MoreOutlined } from '@ant-design/icons';
|
||||
import { Dropdown, MenuProps, Space } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
Button,
|
||||
@ -12,7 +12,7 @@ import {
|
||||
} from 'antd';
|
||||
import random from 'lodash/random';
|
||||
|
||||
export const excludedParseMethods = ['table', 'resume', 'one',"picture"];
|
||||
export const excludedParseMethods = ['table', 'resume', 'one', 'picture'];
|
||||
|
||||
export const showRaptorParseConfiguration = (parserId: string) => {
|
||||
return !excludedParseMethods.includes(parserId);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {
|
||||
useGetChunkHighlights,
|
||||
useGetDocumentUrl,
|
||||
} from '@/hooks/documentHooks';
|
||||
} from '@/hooks/document-hooks';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { Skeleton } from 'antd';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Input, Modal } from 'antd';
|
||||
import { useEffect } from 'react';
|
||||
import { IModalManagerChildrenProps } from '../modal-manager';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { LlmModelType } from '@/constants/knowledge';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSelectLlmOptionsByModelType } from '@/hooks/llm-hooks';
|
||||
import { Form, Select, Slider } from 'antd';
|
||||
|
||||
type FieldType = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Slider } from 'antd';
|
||||
|
||||
type FieldType = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Slider } from 'antd';
|
||||
|
||||
type FieldType = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useDispatch } from 'umi';
|
||||
import { useGetKnowledgeSearchParams } from './routeHook';
|
||||
import { useGetKnowledgeSearchParams } from './route-hook';
|
||||
|
||||
interface PayloadType {
|
||||
doc_id: string;
|
@ -6,8 +6,8 @@ import { UploadFile } from 'antd';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { IHighlight } from 'react-pdf-highlighter';
|
||||
import { useDispatch, useSelector } from 'umi';
|
||||
import { useGetKnowledgeSearchParams } from './routeHook';
|
||||
import { useOneNamespaceEffectsLoading } from './storeHooks';
|
||||
import { useGetKnowledgeSearchParams } from './route-hook';
|
||||
import { useOneNamespaceEffectsLoading } from './store-hooks';
|
||||
|
||||
export const useGetDocumentUrl = (documentId?: string) => {
|
||||
const getDocumentUrl = useCallback(
|
@ -1,9 +1,11 @@
|
||||
import { useShowDeleteConfirm } from '@/hooks/commonHooks';
|
||||
import { useShowDeleteConfirm } from '@/hooks/common-hooks';
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import kbService from '@/services/knowledge-service';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { useDispatch, useSearchParams, useSelector } from 'umi';
|
||||
import { useGetKnowledgeSearchParams } from './routeHook';
|
||||
import { useOneNamespaceEffectsLoading } from './storeHooks';
|
||||
import { useGetKnowledgeSearchParams } from './route-hook';
|
||||
import { useOneNamespaceEffectsLoading } from './store-hooks';
|
||||
|
||||
export const useKnowledgeBaseId = (): string => {
|
||||
const [searchParams] = useSearchParams();
|
||||
@ -158,6 +160,23 @@ export const useFetchKnowledgeList = (
|
||||
return { list, loading, fetchList };
|
||||
};
|
||||
|
||||
export const useNextFetchKnowledgeList = (): {
|
||||
data: any[];
|
||||
loading: boolean;
|
||||
} => {
|
||||
const { data, isFetching: loading } = useQuery({
|
||||
queryKey: ['fetchKnowledgeList'],
|
||||
initialData: [],
|
||||
queryFn: async () => {
|
||||
const { data } = await kbService.getList();
|
||||
|
||||
return data?.data ?? [];
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading };
|
||||
};
|
||||
|
||||
export const useSelectFileThumbnails = () => {
|
||||
const fileThumbnails: Record<string, string> = useSelector(
|
||||
(state: any) => state.kFModel.fileThumbnails,
|
@ -20,15 +20,15 @@ import {
|
||||
} from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDispatch } from 'umi';
|
||||
import { useSetModalState, useTranslate } from './commonHooks';
|
||||
import { useSetDocumentParser } from './documentHooks';
|
||||
import { useFetchLlmList } from './llmHooks';
|
||||
import { useOneNamespaceEffectsLoading } from './storeHooks';
|
||||
import { useSetModalState, useTranslate } from './common-hooks';
|
||||
import { useSetDocumentParser } from './document-hooks';
|
||||
import { useFetchLlmList } from './llm-hooks';
|
||||
import { useOneNamespaceEffectsLoading } from './store-hooks';
|
||||
import {
|
||||
useFetchTenantInfo,
|
||||
useSaveSetting,
|
||||
useSelectTenantInfo,
|
||||
} from './userSettingHook';
|
||||
} from './user-setting-hooks';
|
||||
|
||||
export const useChangeDocumentParser = (documentId: string) => {
|
||||
const setDocumentParser = useSetDocumentParser();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ITenantInfo } from '@/interfaces/database/knowledge';
|
||||
import { ISystemStatus, IUserInfo } from '@/interfaces/database/userSetting';
|
||||
import userService from '@/services/userService';
|
||||
import userService from '@/services/user-service';
|
||||
import authorizationUtil from '@/utils/authorizationUtil';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { history, useDispatch, useSelector } from 'umi';
|
@ -1,8 +1,8 @@
|
||||
import { ReactComponent as FileIcon } from '@/assets/svg/file-management.svg';
|
||||
import { ReactComponent as GraphIcon } from '@/assets/svg/graph.svg';
|
||||
import { ReactComponent as KnowledgeBaseIcon } from '@/assets/svg/knowledge-base.svg';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useNavigateWithFromState } from '@/hooks/routeHook';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useNavigateWithFromState } from '@/hooks/route-hook';
|
||||
import { Flex, Layout, Radio, Space, theme } from 'antd';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useLocation } from 'umi';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { DownOutlined, GithubOutlined } from '@ant-design/icons';
|
||||
import { Dropdown, MenuProps, Space } from 'antd';
|
||||
import camelCase from 'lodash/camelCase';
|
||||
|
@ -1,30 +1,33 @@
|
||||
import { useFetchUserInfo, useSelectUserInfo } from '@/hooks/userSettingHook';
|
||||
import { Avatar } from 'antd';
|
||||
import React from 'react';
|
||||
import { history } from 'umi';
|
||||
|
||||
import styles from '../../index.less';
|
||||
|
||||
const App: React.FC = () => {
|
||||
const userInfo = useSelectUserInfo();
|
||||
|
||||
const toSetting = () => {
|
||||
history.push('/user-setting');
|
||||
};
|
||||
|
||||
useFetchUserInfo();
|
||||
|
||||
return (
|
||||
<Avatar
|
||||
size={32}
|
||||
onClick={toSetting}
|
||||
className={styles.clickAvailable}
|
||||
src={
|
||||
userInfo.avatar ??
|
||||
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
import {
|
||||
useFetchUserInfo,
|
||||
useSelectUserInfo,
|
||||
} from '@/hooks/user-setting-hooks';
|
||||
import { Avatar } from 'antd';
|
||||
import React from 'react';
|
||||
import { history } from 'umi';
|
||||
|
||||
import styles from '../../index.less';
|
||||
|
||||
const App: React.FC = () => {
|
||||
const userInfo = useSelectUserInfo();
|
||||
|
||||
const toSetting = () => {
|
||||
history.push('/user-setting');
|
||||
};
|
||||
|
||||
useFetchUserInfo();
|
||||
|
||||
return (
|
||||
<Avatar
|
||||
size={32}
|
||||
onClick={toSetting}
|
||||
className={styles.clickAvailable}
|
||||
src={
|
||||
userInfo.avatar ??
|
||||
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useDeleteChunkByIds } from '@/hooks/knowledgeHook';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useDeleteChunkByIds } from '@/hooks/knowledge-hooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import { DeleteOutlined } from '@ant-design/icons';
|
||||
import { Checkbox, Divider, Form, Input, Modal, Space } from 'antd';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ReactComponent as FilterIcon } from '@/assets/filter.svg';
|
||||
import { KnowledgeRouteKey } from '@/constants/knowledge';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useKnowledgeBaseId } from '@/hooks/knowledgeHook';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useKnowledgeBaseId } from '@/hooks/knowledge-hooks';
|
||||
import {
|
||||
ArrowLeftOutlined,
|
||||
CheckCircleOutlined,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useGetKnowledgeSearchParams } from '@/hooks/routeHook';
|
||||
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
|
||||
import { api_host } from '@/utils/api';
|
||||
import { useSize } from 'ahooks';
|
||||
import { CustomTextRenderer } from 'node_modules/react-pdf/dist/esm/shared/types';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { buildChunkHighlights } from '@/utils/documentUtils';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useFetchChunkList } from '@/hooks/chunkHooks';
|
||||
import { useDeleteChunkByIds } from '@/hooks/knowledgeHook';
|
||||
import { useFetchChunkList } from '@/hooks/chunk-hooks';
|
||||
import { useDeleteChunkByIds } from '@/hooks/knowledge-hooks';
|
||||
import type { PaginationProps } from 'antd';
|
||||
import { Divider, Flex, Pagination, Space, Spin, message } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BaseState } from '@/interfaces/common';
|
||||
import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import kbService from '@/services/kbService';
|
||||
import kbService from '@/services/knowledge-service';
|
||||
import { message } from 'antd';
|
||||
import { pick } from 'lodash';
|
||||
// import { delay } from '@/utils/storeUtil';
|
||||
|
@ -6,17 +6,17 @@ import {
|
||||
useRunDocument,
|
||||
useSelectDocumentList,
|
||||
useUploadDocument,
|
||||
} from '@/hooks/documentHooks';
|
||||
} from '@/hooks/document-hooks';
|
||||
import {
|
||||
useDeleteDocumentById,
|
||||
useFetchKnowledgeDetail,
|
||||
useKnowledgeBaseId,
|
||||
} from '@/hooks/knowledgeHook';
|
||||
} from '@/hooks/knowledge-hooks';
|
||||
import {
|
||||
useChangeDocumentParser,
|
||||
useSetSelectedRecord,
|
||||
} from '@/hooks/logic-hooks';
|
||||
import { useFetchTenantInfo } from '@/hooks/userSettingHook';
|
||||
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { getExtension, isFileUploadDone } from '@/utils/documentUtils';
|
||||
import {
|
||||
@ -40,7 +40,7 @@ import classNames from 'classnames';
|
||||
import { ReactElement, useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { Link, useNavigate } from 'umi';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const { Dragger } = Upload;
|
||||
|
@ -3,13 +3,13 @@ import { ReactComponent as DeleteIcon } from '@/assets/svg/delete.svg';
|
||||
import { ReactComponent as DisableIcon } from '@/assets/svg/disable.svg';
|
||||
import { ReactComponent as EnableIcon } from '@/assets/svg/enable.svg';
|
||||
import { ReactComponent as RunIcon } from '@/assets/svg/run.svg';
|
||||
import { useShowDeleteConfirm, useTranslate } from '@/hooks/commonHooks';
|
||||
import { useShowDeleteConfirm, useTranslate } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useRemoveDocument,
|
||||
useRunDocument,
|
||||
useSetDocumentStatus,
|
||||
} from '@/hooks/documentHooks';
|
||||
import { useGetKnowledgeSearchParams } from '@/hooks/routeHook';
|
||||
} from '@/hooks/document-hooks';
|
||||
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
|
||||
import {
|
||||
DownOutlined,
|
||||
FileOutlined,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useSetModalState, useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useCreateDocument,
|
||||
useFetchDocumentList,
|
||||
@ -8,10 +8,10 @@ import {
|
||||
useSetDocumentParser,
|
||||
useUploadDocument,
|
||||
useWebCrawl,
|
||||
} from '@/hooks/documentHooks';
|
||||
import { useGetKnowledgeSearchParams } from '@/hooks/routeHook';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useFetchTenantInfo } from '@/hooks/userSettingHook';
|
||||
} from '@/hooks/document-hooks';
|
||||
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
||||
import { Pagination } from '@/interfaces/common';
|
||||
import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
|
||||
import { getUnSupportedFilesCount } from '@/utils/documentUtils';
|
||||
@ -296,13 +296,13 @@ export const useHandleWebCrawl = () => {
|
||||
const webCrawl = useWebCrawl();
|
||||
|
||||
const onWebCrawlUploadOk = useCallback(
|
||||
async (name: string, url: string ) => {
|
||||
async (name: string, url: string) => {
|
||||
const ret = await webCrawl(name, url);
|
||||
if (ret === 0) {
|
||||
hideWebCrawlUploadModal();
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
return -1
|
||||
return -1;
|
||||
},
|
||||
[webCrawl, hideWebCrawlUploadModal],
|
||||
);
|
||||
|
@ -3,9 +3,9 @@ import SvgIcon from '@/components/svg-icon';
|
||||
import {
|
||||
useSelectDocumentList,
|
||||
useSetDocumentStatus,
|
||||
} from '@/hooks/documentHooks';
|
||||
} from '@/hooks/document-hooks';
|
||||
import { useSetSelectedRecord } from '@/hooks/logic-hooks';
|
||||
import { useSelectParserList } from '@/hooks/userSettingHook';
|
||||
import { useSelectParserList } from '@/hooks/user-setting-hooks';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { getExtension } from '@/utils/documentUtils';
|
||||
import { Divider, Flex, Switch, Table, Typography } from 'antd';
|
||||
|
@ -1,276 +1,276 @@
|
||||
import { BaseState } from '@/interfaces/common';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import i18n from '@/locales/config';
|
||||
import kbService, { getDocumentFile } from '@/services/kbService';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import pick from 'lodash/pick';
|
||||
import { DvaModel } from 'umi';
|
||||
|
||||
export interface KFModelState extends BaseState {
|
||||
tenantIfo: any;
|
||||
data: IKnowledgeFile[];
|
||||
total: number;
|
||||
currentRecord: Nullable<IKnowledgeFile>;
|
||||
fileThumbnails: Record<string, string>;
|
||||
}
|
||||
|
||||
const model: DvaModel<KFModelState> = {
|
||||
namespace: 'kFModel',
|
||||
state: {
|
||||
tenantIfo: {},
|
||||
data: [],
|
||||
total: 0,
|
||||
currentRecord: null,
|
||||
searchString: '',
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
fileThumbnails: {} as Record<string, string>,
|
||||
},
|
||||
reducers: {
|
||||
updateState(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
...payload,
|
||||
};
|
||||
},
|
||||
|
||||
setCurrentRecord(state, { payload }) {
|
||||
return { ...state, currentRecord: payload };
|
||||
},
|
||||
setSearchString(state, { payload }) {
|
||||
return { ...state, searchString: payload };
|
||||
},
|
||||
setPagination(state, { payload }) {
|
||||
return { ...state, pagination: { ...state.pagination, ...payload } };
|
||||
},
|
||||
setFileThumbnails(state, { payload }) {
|
||||
return { ...state, fileThumbnails: payload };
|
||||
},
|
||||
},
|
||||
effects: {
|
||||
*createKf({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.createKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
},
|
||||
*updateKf({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.updateKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.modified'));
|
||||
}
|
||||
},
|
||||
*getKfDetail({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.get_kb_detail, payload);
|
||||
},
|
||||
*getKfList({ payload = {} }, { call, put, select }) {
|
||||
const state: KFModelState = yield select((state: any) => state.kFModel);
|
||||
const requestBody = {
|
||||
...payload,
|
||||
page: state.pagination.current,
|
||||
page_size: state.pagination.pageSize,
|
||||
};
|
||||
if (state.searchString) {
|
||||
requestBody['keywords'] = state.searchString;
|
||||
}
|
||||
const { data } = yield call(kbService.get_document_list, requestBody);
|
||||
const { retcode, data: res } = data;
|
||||
|
||||
if (retcode === 0) {
|
||||
yield put({
|
||||
type: 'updateState',
|
||||
payload: {
|
||||
data: res.docs,
|
||||
total: res.total,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
throttledGetDocumentList: [
|
||||
function* ({ payload }, { call, put }) {
|
||||
yield put({ type: 'getKfList', payload: { kb_id: payload } });
|
||||
},
|
||||
{ type: 'throttle', ms: 1000 }, // TODO: Provide type support for this effect
|
||||
],
|
||||
pollGetDocumentList: [
|
||||
function* ({ payload }, { call, put }) {
|
||||
yield put({ type: 'getKfList', payload: { kb_id: payload } });
|
||||
},
|
||||
{ type: 'poll', delay: 5000 }, // TODO: Provide type support for this effect
|
||||
],
|
||||
*updateDocumentStatus({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_change_status,
|
||||
pick(payload, ['doc_id', 'status']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.modified'));
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
},
|
||||
*document_rm({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.document_rm, {
|
||||
doc_id: payload.doc_id,
|
||||
});
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.deleted'));
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*document_rename({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_rename,
|
||||
omit(payload, ['kb_id']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.renamed'));
|
||||
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
|
||||
return retcode;
|
||||
},
|
||||
*document_create({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.document_create, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*document_run({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_run,
|
||||
omit(payload, ['knowledgeBaseId']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
if (payload.knowledgeBaseId) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.knowledgeBaseId },
|
||||
});
|
||||
}
|
||||
message.success(i18n.t('message.operated'));
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*document_change_parser({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_change_parser,
|
||||
omit(payload, ['kb_id']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
|
||||
message.success(i18n.t('message.modified'));
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*fetch_document_thumbnails({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.document_thumbnails, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setFileThumbnails', payload: data.data });
|
||||
}
|
||||
},
|
||||
*fetch_document_file({ payload = {} }, { call }) {
|
||||
const documentId = payload;
|
||||
try {
|
||||
const ret = yield call(getDocumentFile, documentId);
|
||||
return ret;
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
}
|
||||
},
|
||||
*upload_document({ payload = {} }, { call, put }) {
|
||||
const fileList = payload.fileList;
|
||||
const formData = new FormData();
|
||||
formData.append('kb_id', payload.kb_id);
|
||||
fileList.forEach((file: any) => {
|
||||
formData.append('file', file);
|
||||
});
|
||||
|
||||
const { data } = yield call(kbService.document_upload, formData);
|
||||
|
||||
const succeed = data.retcode === 0;
|
||||
|
||||
if (succeed) {
|
||||
message.success(i18n.t('message.uploaded'));
|
||||
}
|
||||
if (succeed || data.retcode === 500) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*web_crawl({ payload = {} }, { call, put }) {
|
||||
const formData = new FormData();
|
||||
formData.append('name', payload.name);
|
||||
formData.append('url', payload.url);
|
||||
formData.append('kb_id', payload.kb_id);
|
||||
|
||||
const { data } = yield call(kbService.web_crawl, formData);
|
||||
|
||||
const succeed = data.retcode === 0;
|
||||
|
||||
if (succeed) {
|
||||
message.success(i18n.t('message.uploaded'));
|
||||
}
|
||||
if (succeed || data.retcode === 500) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
},
|
||||
subscriptions: {
|
||||
setup({ dispatch, history }) {
|
||||
history.listen(({ location }) => {
|
||||
const state: { from: string } = (location.state ?? {
|
||||
from: '',
|
||||
}) as { from: string };
|
||||
if (
|
||||
state.from === '/knowledge' || // TODO: Just directly determine whether the current page is on the knowledge list page.
|
||||
location.pathname === '/knowledge/dataset/upload'
|
||||
) {
|
||||
dispatch({
|
||||
type: 'setPagination',
|
||||
payload: { current: 1, pageSize: 10 },
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
export default model;
|
||||
import { BaseState } from '@/interfaces/common';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import i18n from '@/locales/config';
|
||||
import kbService, { getDocumentFile } from '@/services/knowledge-service';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import pick from 'lodash/pick';
|
||||
import { DvaModel } from 'umi';
|
||||
|
||||
export interface KFModelState extends BaseState {
|
||||
tenantIfo: any;
|
||||
data: IKnowledgeFile[];
|
||||
total: number;
|
||||
currentRecord: Nullable<IKnowledgeFile>;
|
||||
fileThumbnails: Record<string, string>;
|
||||
}
|
||||
|
||||
const model: DvaModel<KFModelState> = {
|
||||
namespace: 'kFModel',
|
||||
state: {
|
||||
tenantIfo: {},
|
||||
data: [],
|
||||
total: 0,
|
||||
currentRecord: null,
|
||||
searchString: '',
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
fileThumbnails: {} as Record<string, string>,
|
||||
},
|
||||
reducers: {
|
||||
updateState(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
...payload,
|
||||
};
|
||||
},
|
||||
|
||||
setCurrentRecord(state, { payload }) {
|
||||
return { ...state, currentRecord: payload };
|
||||
},
|
||||
setSearchString(state, { payload }) {
|
||||
return { ...state, searchString: payload };
|
||||
},
|
||||
setPagination(state, { payload }) {
|
||||
return { ...state, pagination: { ...state.pagination, ...payload } };
|
||||
},
|
||||
setFileThumbnails(state, { payload }) {
|
||||
return { ...state, fileThumbnails: payload };
|
||||
},
|
||||
},
|
||||
effects: {
|
||||
*createKf({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.createKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
},
|
||||
*updateKf({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.updateKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.modified'));
|
||||
}
|
||||
},
|
||||
*getKfDetail({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.get_kb_detail, payload);
|
||||
},
|
||||
*getKfList({ payload = {} }, { call, put, select }) {
|
||||
const state: KFModelState = yield select((state: any) => state.kFModel);
|
||||
const requestBody = {
|
||||
...payload,
|
||||
page: state.pagination.current,
|
||||
page_size: state.pagination.pageSize,
|
||||
};
|
||||
if (state.searchString) {
|
||||
requestBody['keywords'] = state.searchString;
|
||||
}
|
||||
const { data } = yield call(kbService.get_document_list, requestBody);
|
||||
const { retcode, data: res } = data;
|
||||
|
||||
if (retcode === 0) {
|
||||
yield put({
|
||||
type: 'updateState',
|
||||
payload: {
|
||||
data: res.docs,
|
||||
total: res.total,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
throttledGetDocumentList: [
|
||||
function* ({ payload }, { call, put }) {
|
||||
yield put({ type: 'getKfList', payload: { kb_id: payload } });
|
||||
},
|
||||
{ type: 'throttle', ms: 1000 }, // TODO: Provide type support for this effect
|
||||
],
|
||||
pollGetDocumentList: [
|
||||
function* ({ payload }, { call, put }) {
|
||||
yield put({ type: 'getKfList', payload: { kb_id: payload } });
|
||||
},
|
||||
{ type: 'poll', delay: 5000 }, // TODO: Provide type support for this effect
|
||||
],
|
||||
*updateDocumentStatus({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_change_status,
|
||||
pick(payload, ['doc_id', 'status']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.modified'));
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
},
|
||||
*document_rm({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.document_rm, {
|
||||
doc_id: payload.doc_id,
|
||||
});
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.deleted'));
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*document_rename({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_rename,
|
||||
omit(payload, ['kb_id']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.renamed'));
|
||||
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
|
||||
return retcode;
|
||||
},
|
||||
*document_create({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.document_create, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*document_run({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_run,
|
||||
omit(payload, ['knowledgeBaseId']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
if (payload.knowledgeBaseId) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.knowledgeBaseId },
|
||||
});
|
||||
}
|
||||
message.success(i18n.t('message.operated'));
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*document_change_parser({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
kbService.document_change_parser,
|
||||
omit(payload, ['kb_id']),
|
||||
);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
|
||||
message.success(i18n.t('message.modified'));
|
||||
}
|
||||
return retcode;
|
||||
},
|
||||
*fetch_document_thumbnails({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.document_thumbnails, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setFileThumbnails', payload: data.data });
|
||||
}
|
||||
},
|
||||
*fetch_document_file({ payload = {} }, { call }) {
|
||||
const documentId = payload;
|
||||
try {
|
||||
const ret = yield call(getDocumentFile, documentId);
|
||||
return ret;
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
}
|
||||
},
|
||||
*upload_document({ payload = {} }, { call, put }) {
|
||||
const fileList = payload.fileList;
|
||||
const formData = new FormData();
|
||||
formData.append('kb_id', payload.kb_id);
|
||||
fileList.forEach((file: any) => {
|
||||
formData.append('file', file);
|
||||
});
|
||||
|
||||
const { data } = yield call(kbService.document_upload, formData);
|
||||
|
||||
const succeed = data.retcode === 0;
|
||||
|
||||
if (succeed) {
|
||||
message.success(i18n.t('message.uploaded'));
|
||||
}
|
||||
if (succeed || data.retcode === 500) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*web_crawl({ payload = {} }, { call, put }) {
|
||||
const formData = new FormData();
|
||||
formData.append('name', payload.name);
|
||||
formData.append('url', payload.url);
|
||||
formData.append('kb_id', payload.kb_id);
|
||||
|
||||
const { data } = yield call(kbService.web_crawl, formData);
|
||||
|
||||
const succeed = data.retcode === 0;
|
||||
|
||||
if (succeed) {
|
||||
message.success(i18n.t('message.uploaded'));
|
||||
}
|
||||
if (succeed || data.retcode === 500) {
|
||||
yield put({
|
||||
type: 'getKfList',
|
||||
payload: { kb_id: payload.kb_id },
|
||||
});
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
},
|
||||
subscriptions: {
|
||||
setup({ dispatch, history }) {
|
||||
history.listen(({ location }) => {
|
||||
const state: { from: string } = (location.state ?? {
|
||||
from: '',
|
||||
}) as { from: string };
|
||||
if (
|
||||
state.from === '/knowledge' || // TODO: Just directly determine whether the current page is on the knowledge list page.
|
||||
location.pathname === '/knowledge/dataset/upload'
|
||||
) {
|
||||
dispatch({
|
||||
type: 'setPagination',
|
||||
payload: { current: 1, pageSize: 10 },
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
export default model;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useShowDeleteConfirm, useTranslate } from '@/hooks/commonHooks';
|
||||
import { useRemoveDocument } from '@/hooks/documentHooks';
|
||||
import { useShowDeleteConfirm, useTranslate } from '@/hooks/common-hooks';
|
||||
import { useRemoveDocument } from '@/hooks/document-hooks';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { api_host } from '@/utils/api';
|
||||
import { downloadFile } from '@/utils/fileUtil';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ReactComponent as CancelIcon } from '@/assets/svg/cancel.svg';
|
||||
import { ReactComponent as RefreshIcon } from '@/assets/svg/refresh.svg';
|
||||
import { ReactComponent as RunIcon } from '@/assets/svg/run.svg';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { Badge, DescriptionsProps, Flex, Popover, Space, Tag } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Input, Modal } from 'antd';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Input, Modal } from 'antd';
|
||||
import React from 'react';
|
||||
import {useTranslate} from "@/hooks/commonHooks";
|
||||
|
||||
|
||||
interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
|
||||
loading: boolean;
|
||||
@ -36,14 +35,28 @@ const WebCrawlModal: React.FC<IProps> = ({ visible, hideModal, onOk }) => {
|
||||
<Form.Item
|
||||
label="Name"
|
||||
name="name"
|
||||
rules={[{ required: true, message: 'Please input name!' },{ max: 10, message: 'The maximum length of name is 128 characters' }]}
|
||||
rules={[
|
||||
{ required: true, message: 'Please input name!' },
|
||||
{
|
||||
max: 10,
|
||||
message: 'The maximum length of name is 128 characters',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input placeholder="Document name" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="URL"
|
||||
name="url"
|
||||
rules={[{ required: true, message: 'Please input url!' },{pattern: new RegExp('(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]'), message: 'Please enter a valid URL!'}]}
|
||||
rules={[
|
||||
{ required: true, message: 'Please input url!' },
|
||||
{
|
||||
pattern: new RegExp(
|
||||
'(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]',
|
||||
),
|
||||
message: 'Please enter a valid URL!',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input placeholder="https://www.baidu.com" />
|
||||
</Form.Item>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import SvgIcon from '@/components/svg-icon';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSelectParserList } from '@/hooks/userSettingHook';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSelectParserList } from '@/hooks/user-setting-hooks';
|
||||
import { Col, Divider, Empty, Row, Typography } from 'antd';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { useMemo } from 'react';
|
||||
|
@ -11,7 +11,7 @@ import MaxTokenNumber from '@/components/max-token-number';
|
||||
import ParseConfiguration, {
|
||||
showRaptorParseConfiguration,
|
||||
} from '@/components/parse-configuration';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import styles from './index.less';
|
||||
|
||||
|
@ -3,14 +3,14 @@ import {
|
||||
useKnowledgeBaseId,
|
||||
useSelectKnowledgeDetails,
|
||||
useUpdateKnowledge,
|
||||
} from '@/hooks/knowledgeHook';
|
||||
import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llmHooks';
|
||||
import { useNavigateToDataset } from '@/hooks/routeHook';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
} from '@/hooks/knowledge-hooks';
|
||||
import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llm-hooks';
|
||||
import { useNavigateToDataset } from '@/hooks/route-hook';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import {
|
||||
useFetchTenantInfo,
|
||||
useSelectParserList,
|
||||
} from '@/hooks/userSettingHook';
|
||||
} from '@/hooks/user-setting-hooks';
|
||||
import {
|
||||
getBase64FromUploadFileList,
|
||||
getUploadFileListFromBase64,
|
||||
|
@ -1,40 +1,40 @@
|
||||
import { Col, Divider, Row, Spin, Typography } from 'antd';
|
||||
import CategoryPanel from './category-panel';
|
||||
import ConfigurationForm from './configuration';
|
||||
import {
|
||||
useHandleChunkMethodChange,
|
||||
useSelectKnowledgeDetailsLoading,
|
||||
} from './hooks';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const { Title } = Typography;
|
||||
|
||||
const Configuration = () => {
|
||||
const loading = useSelectKnowledgeDetailsLoading();
|
||||
const { form, chunkMethod } = useHandleChunkMethodChange();
|
||||
const { t } = useTranslate('knowledgeConfiguration');
|
||||
|
||||
return (
|
||||
<div className={styles.configurationWrapper}>
|
||||
<Title level={5}>
|
||||
{t('configuration', { keyPrefix: 'knowledgeDetails' })}
|
||||
</Title>
|
||||
<p>{t('titleDescription')}</p>
|
||||
<Divider></Divider>
|
||||
<Spin spinning={loading}>
|
||||
<Row gutter={32}>
|
||||
<Col span={8}>
|
||||
<ConfigurationForm form={form}></ConfigurationForm>
|
||||
</Col>
|
||||
<Col span={16}>
|
||||
<CategoryPanel chunkMethod={chunkMethod}></CategoryPanel>
|
||||
</Col>
|
||||
</Row>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Configuration;
|
||||
import { Col, Divider, Row, Spin, Typography } from 'antd';
|
||||
import CategoryPanel from './category-panel';
|
||||
import ConfigurationForm from './configuration';
|
||||
import {
|
||||
useHandleChunkMethodChange,
|
||||
useSelectKnowledgeDetailsLoading,
|
||||
} from './hooks';
|
||||
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const { Title } = Typography;
|
||||
|
||||
const Configuration = () => {
|
||||
const loading = useSelectKnowledgeDetailsLoading();
|
||||
const { form, chunkMethod } = useHandleChunkMethodChange();
|
||||
const { t } = useTranslate('knowledgeConfiguration');
|
||||
|
||||
return (
|
||||
<div className={styles.configurationWrapper}>
|
||||
<Title level={5}>
|
||||
{t('configuration', { keyPrefix: 'knowledgeDetails' })}
|
||||
</Title>
|
||||
<p>{t('titleDescription')}</p>
|
||||
<Divider></Divider>
|
||||
<Spin spinning={loading}>
|
||||
<Row gutter={32}>
|
||||
<Col span={8}>
|
||||
<ConfigurationForm form={form}></ConfigurationForm>
|
||||
</Col>
|
||||
<Col span={16}>
|
||||
<CategoryPanel chunkMethod={chunkMethod}></CategoryPanel>
|
||||
</Col>
|
||||
</Row>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Configuration;
|
||||
|
@ -1,57 +1,57 @@
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import i18n from '@/locales/config';
|
||||
import kbService from '@/services/kbService';
|
||||
import { message } from 'antd';
|
||||
import { DvaModel } from 'umi';
|
||||
|
||||
export interface KSModelState {
|
||||
isShowPSwModal: boolean;
|
||||
tenantIfo: any;
|
||||
knowledgeDetails: IKnowledge;
|
||||
}
|
||||
|
||||
const model: DvaModel<KSModelState> = {
|
||||
namespace: 'kSModel',
|
||||
state: {
|
||||
isShowPSwModal: false,
|
||||
tenantIfo: {},
|
||||
knowledgeDetails: {} as any,
|
||||
},
|
||||
reducers: {
|
||||
updateState(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
...payload,
|
||||
};
|
||||
},
|
||||
setKnowledgeDetails(state, { payload }) {
|
||||
return { ...state, knowledgeDetails: payload };
|
||||
},
|
||||
},
|
||||
effects: {
|
||||
*createKb({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.createKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*updateKb({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.updateKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
yield put({ type: 'getKbDetail', payload: { kb_id: payload.kb_id } });
|
||||
message.success(i18n.t('message.updated'));
|
||||
}
|
||||
},
|
||||
*getKbDetail({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.get_kb_detail, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setKnowledgeDetails', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
},
|
||||
};
|
||||
export default model;
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import i18n from '@/locales/config';
|
||||
import kbService from '@/services/knowledge-service';
|
||||
import { message } from 'antd';
|
||||
import { DvaModel } from 'umi';
|
||||
|
||||
export interface KSModelState {
|
||||
isShowPSwModal: boolean;
|
||||
tenantIfo: any;
|
||||
knowledgeDetails: IKnowledge;
|
||||
}
|
||||
|
||||
const model: DvaModel<KSModelState> = {
|
||||
namespace: 'kSModel',
|
||||
state: {
|
||||
isShowPSwModal: false,
|
||||
tenantIfo: {},
|
||||
knowledgeDetails: {} as any,
|
||||
},
|
||||
reducers: {
|
||||
updateState(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
...payload,
|
||||
};
|
||||
},
|
||||
setKnowledgeDetails(state, { payload }) {
|
||||
return { ...state, knowledgeDetails: payload };
|
||||
},
|
||||
},
|
||||
effects: {
|
||||
*createKb({ payload = {} }, { call }) {
|
||||
const { data } = yield call(kbService.createKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*updateKb({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.updateKb, payload);
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
yield put({ type: 'getKbDetail', payload: { kb_id: payload.kb_id } });
|
||||
message.success(i18n.t('message.updated'));
|
||||
}
|
||||
},
|
||||
*getKbDetail({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(kbService.get_kb_detail, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setKnowledgeDetails', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
},
|
||||
};
|
||||
export default model;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { ReactComponent as ConfigurationIcon } from '@/assets/svg/knowledge-configration.svg';
|
||||
import { ReactComponent as DatasetIcon } from '@/assets/svg/knowledge-dataset.svg';
|
||||
import { ReactComponent as TestingIcon } from '@/assets/svg/knowledge-testing.svg';
|
||||
import { useFetchKnowledgeBaseConfiguration } from '@/hooks/knowledgeHook';
|
||||
import { useSecondPathName } from '@/hooks/routeHook';
|
||||
import { useFetchKnowledgeBaseConfiguration } from '@/hooks/knowledge-hooks';
|
||||
import { useSecondPathName } from '@/hooks/route-hook';
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { getWidth } from '@/utils';
|
||||
import { Avatar, Menu, MenuProps, Space } from 'antd';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTestChunkRetrieval } from '@/hooks/knowledgeHook';
|
||||
import { useTestChunkRetrieval } from '@/hooks/knowledge-hooks';
|
||||
import { Flex, Form } from 'antd';
|
||||
import { useEffect } from 'react';
|
||||
import { useDispatch } from 'umi';
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
ITestingChunk,
|
||||
ITestingDocument,
|
||||
} from '@/interfaces/database/knowledge';
|
||||
import kbService from '@/services/kbService';
|
||||
import kbService from '@/services/knowledge-service';
|
||||
import { DvaModel } from 'umi';
|
||||
|
||||
export interface TestingModelState extends Pick<BaseState, 'pagination'> {
|
||||
|
@ -3,9 +3,9 @@ import { Button, Card, Divider, Flex, Form, Input } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
|
||||
import Rerank from '@/components/rerank';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useFetchLlmList } from '@/hooks/llmHooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useFetchLlmList } from '@/hooks/llm-hooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import { useEffect } from 'react';
|
||||
import styles from './index.less';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ReactComponent as SelectedFilesCollapseIcon } from '@/assets/svg/selected-files-collapse.svg';
|
||||
import Image from '@/components/image';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { ITestingChunk } from '@/interfaces/database/knowledge';
|
||||
import {
|
||||
Card,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ReactComponent as NavigationPointerIcon } from '@/assets/svg/navigation-pointer.svg';
|
||||
import NewDocumentLink from '@/components/new-document-link';
|
||||
import { useGetDocumentUrl } from '@/hooks/documentHooks';
|
||||
import { useGetDocumentUrl } from '@/hooks/document-hooks';
|
||||
import { ITestingDocument } from '@/interfaces/database/knowledge';
|
||||
import { isPdf } from '@/utils/documentUtils';
|
||||
import { Table, TableProps } from 'antd';
|
||||
|
@ -1,93 +1,93 @@
|
||||
import { useKnowledgeBaseId } from '@/hooks/knowledgeHook';
|
||||
import {
|
||||
useNavigateWithFromState,
|
||||
useSecondPathName,
|
||||
useThirdPathName,
|
||||
} from '@/hooks/routeHook';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { ItemType } from 'antd/es/breadcrumb/Breadcrumb';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, Outlet, useDispatch, useLocation } from 'umi';
|
||||
import Siderbar from './components/knowledge-sidebar';
|
||||
import { KnowledgeDatasetRouteKey, KnowledgeRouteKey } from './constant';
|
||||
import styles from './index.less';
|
||||
|
||||
const KnowledgeAdding = () => {
|
||||
const dispatch = useDispatch();
|
||||
const knowledgeBaseId = useKnowledgeBaseId();
|
||||
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const activeKey: KnowledgeRouteKey =
|
||||
(useSecondPathName() as KnowledgeRouteKey) || KnowledgeRouteKey.Dataset;
|
||||
|
||||
const datasetActiveKey: KnowledgeDatasetRouteKey =
|
||||
useThirdPathName() as KnowledgeDatasetRouteKey;
|
||||
|
||||
const gotoList = useNavigateWithFromState();
|
||||
|
||||
const breadcrumbItems: ItemType[] = useMemo(() => {
|
||||
const items: ItemType[] = [
|
||||
{
|
||||
title: (
|
||||
<a onClick={() => gotoList('/knowledge')}>
|
||||
{t('header.knowledgeBase')}
|
||||
</a>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: datasetActiveKey ? (
|
||||
<Link
|
||||
to={`/knowledge/${KnowledgeRouteKey.Dataset}?id=${knowledgeBaseId}`}
|
||||
>
|
||||
{t(`knowledgeDetails.${activeKey}`)}
|
||||
</Link>
|
||||
) : (
|
||||
t(`knowledgeDetails.${activeKey}`)
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
if (datasetActiveKey) {
|
||||
items.push({
|
||||
title: t(`knowledgeDetails.${datasetActiveKey}`),
|
||||
});
|
||||
}
|
||||
|
||||
return items;
|
||||
}, [activeKey, datasetActiveKey, gotoList, knowledgeBaseId, t]);
|
||||
|
||||
useEffect(() => {
|
||||
const search: string = location.search.slice(1);
|
||||
const map = search.split('&').reduce<Record<string, string>>((obj, cur) => {
|
||||
const [key, value] = cur.split('=');
|
||||
obj[key] = value;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
dispatch({
|
||||
type: 'kAModel/updateState',
|
||||
payload: {
|
||||
doc_id: undefined,
|
||||
...map,
|
||||
},
|
||||
});
|
||||
}, [location, dispatch]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.container}>
|
||||
<Siderbar></Siderbar>
|
||||
<div className={styles.contentWrapper}>
|
||||
<Breadcrumb items={breadcrumbItems} />
|
||||
<div className={styles.content}>
|
||||
<Outlet></Outlet>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default KnowledgeAdding;
|
||||
import { useKnowledgeBaseId } from '@/hooks/knowledge-hooks';
|
||||
import {
|
||||
useNavigateWithFromState,
|
||||
useSecondPathName,
|
||||
useThirdPathName,
|
||||
} from '@/hooks/route-hook';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { ItemType } from 'antd/es/breadcrumb/Breadcrumb';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, Outlet, useDispatch, useLocation } from 'umi';
|
||||
import Siderbar from './components/knowledge-sidebar';
|
||||
import { KnowledgeDatasetRouteKey, KnowledgeRouteKey } from './constant';
|
||||
import styles from './index.less';
|
||||
|
||||
const KnowledgeAdding = () => {
|
||||
const dispatch = useDispatch();
|
||||
const knowledgeBaseId = useKnowledgeBaseId();
|
||||
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const activeKey: KnowledgeRouteKey =
|
||||
(useSecondPathName() as KnowledgeRouteKey) || KnowledgeRouteKey.Dataset;
|
||||
|
||||
const datasetActiveKey: KnowledgeDatasetRouteKey =
|
||||
useThirdPathName() as KnowledgeDatasetRouteKey;
|
||||
|
||||
const gotoList = useNavigateWithFromState();
|
||||
|
||||
const breadcrumbItems: ItemType[] = useMemo(() => {
|
||||
const items: ItemType[] = [
|
||||
{
|
||||
title: (
|
||||
<a onClick={() => gotoList('/knowledge')}>
|
||||
{t('header.knowledgeBase')}
|
||||
</a>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: datasetActiveKey ? (
|
||||
<Link
|
||||
to={`/knowledge/${KnowledgeRouteKey.Dataset}?id=${knowledgeBaseId}`}
|
||||
>
|
||||
{t(`knowledgeDetails.${activeKey}`)}
|
||||
</Link>
|
||||
) : (
|
||||
t(`knowledgeDetails.${activeKey}`)
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
if (datasetActiveKey) {
|
||||
items.push({
|
||||
title: t(`knowledgeDetails.${datasetActiveKey}`),
|
||||
});
|
||||
}
|
||||
|
||||
return items;
|
||||
}, [activeKey, datasetActiveKey, gotoList, knowledgeBaseId, t]);
|
||||
|
||||
useEffect(() => {
|
||||
const search: string = location.search.slice(1);
|
||||
const map = search.split('&').reduce<Record<string, string>>((obj, cur) => {
|
||||
const [key, value] = cur.split('=');
|
||||
obj[key] = value;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
dispatch({
|
||||
type: 'kAModel/updateState',
|
||||
payload: {
|
||||
doc_id: undefined,
|
||||
...map,
|
||||
},
|
||||
});
|
||||
}, [location, dispatch]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.container}>
|
||||
<Siderbar></Siderbar>
|
||||
<div className={styles.contentWrapper}>
|
||||
<Breadcrumb items={breadcrumbItems} />
|
||||
<div className={styles.content}>
|
||||
<Outlet></Outlet>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default KnowledgeAdding;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import CopyToClipboard from '@/components/copy-to-clipboard';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { IToken } from '@/interfaces/database/chat';
|
||||
import { formatDate } from '@/utils/date';
|
||||
|
@ -4,7 +4,7 @@ import classNames from 'classnames';
|
||||
import { ISegmentedContentProps } from '../interface';
|
||||
|
||||
import KnowledgeBaseItem from '@/components/knowledge-base-item';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const AssistantSetting = ({ show }: ISegmentedContentProps) => {
|
||||
|
@ -14,7 +14,7 @@ import AssistantSetting from './assistant-setting';
|
||||
import ModelSetting from './model-setting';
|
||||
import PromptEngine from './prompt-engine';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useFetchLlmModelOnVisible,
|
||||
useFetchModelId,
|
||||
|
@ -30,7 +30,7 @@ import { EditableCell, EditableRow } from './editable-cell';
|
||||
|
||||
import Rerank from '@/components/rerank';
|
||||
import TopNItem from '@/components/top-n-item';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSelectPromptConfigParameters } from '../hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import MessageItem from '@/components/message-item';
|
||||
import DocumentPreviewer from '@/components/pdf-previewer';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Button, Drawer, Flex, Input, Spin } from 'antd';
|
||||
import {
|
||||
useClickDrawer,
|
||||
@ -14,7 +14,7 @@ import {
|
||||
} from '../hooks';
|
||||
import { buildMessageItemReference } from '../utils';
|
||||
|
||||
import { useSelectUserInfo } from '@/hooks/userSettingHook';
|
||||
import { useSelectUserInfo } from '@/hooks/user-setting-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const ChatContainer = () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import LineChart from '@/components/line-chart';
|
||||
import { useSetModalState, useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { IDialog, IStats } from '@/interfaces/database/chat';
|
||||
import { formatDate } from '@/utils/date';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import CopyToClipboard from '@/components/copy-to-clipboard';
|
||||
import HightLightMarkdown from '@/components/highlight-markdown';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { Card, Modal, Tabs, TabsProps } from 'antd';
|
||||
import styles from './index.less';
|
||||
|
@ -17,14 +17,14 @@ import {
|
||||
useSelectTokenList,
|
||||
useSetDialog,
|
||||
useUpdateConversation,
|
||||
} from '@/hooks/chatHooks';
|
||||
} from '@/hooks/chat-hooks';
|
||||
import {
|
||||
useSetModalState,
|
||||
useShowDeleteConfirm,
|
||||
useTranslate,
|
||||
} from '@/hooks/commonHooks';
|
||||
} from '@/hooks/common-hooks';
|
||||
import { useSendMessageWithSse } from '@/hooks/logic-hooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import {
|
||||
IAnswer,
|
||||
IConversation,
|
||||
|
@ -41,7 +41,7 @@ import {
|
||||
useSelectFirstDialogOnMount,
|
||||
} from './hooks';
|
||||
|
||||
import { useSetModalState, useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSetSelectedRecord } from '@/hooks/logic-hooks';
|
||||
import { IDialog } from '@/interfaces/database/chat';
|
||||
import ChatOverviewModal from './chat-overview-modal';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Image from '@/components/image';
|
||||
import SvgIcon from '@/components/svg-icon';
|
||||
import { useSelectFileThumbnails } from '@/hooks/knowledgeHook';
|
||||
import { useSelectFileThumbnails } from '@/hooks/knowledge-hooks';
|
||||
import { IReference } from '@/interfaces/database/chat';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { getExtension } from '@/utils/documentUtils';
|
||||
|
@ -1,262 +1,262 @@
|
||||
import {
|
||||
IConversation,
|
||||
IDialog,
|
||||
IStats,
|
||||
IToken,
|
||||
Message,
|
||||
} from '@/interfaces/database/chat';
|
||||
import i18n from '@/locales/config';
|
||||
import chatService from '@/services/chatService';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import { DvaModel } from 'umi';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { IClientConversation, IMessage } from './interface';
|
||||
import { getDocumentIdsFromConversionReference } from './utils';
|
||||
|
||||
export interface ChatModelState {
|
||||
name: string;
|
||||
dialogList: IDialog[];
|
||||
currentDialog: IDialog;
|
||||
conversationList: IConversation[];
|
||||
currentConversation: IClientConversation;
|
||||
tokenList: IToken[];
|
||||
stats: IStats;
|
||||
}
|
||||
|
||||
const model: DvaModel<ChatModelState> = {
|
||||
namespace: 'chatModel',
|
||||
state: {
|
||||
name: 'kate',
|
||||
dialogList: [],
|
||||
currentDialog: <IDialog>{},
|
||||
conversationList: [],
|
||||
currentConversation: {} as IClientConversation,
|
||||
tokenList: [],
|
||||
stats: {} as IStats,
|
||||
},
|
||||
reducers: {
|
||||
save(state, action) {
|
||||
return {
|
||||
...state,
|
||||
...action.payload,
|
||||
};
|
||||
},
|
||||
setDialogList(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
dialogList: payload,
|
||||
};
|
||||
},
|
||||
setCurrentDialog(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
currentDialog: payload,
|
||||
};
|
||||
},
|
||||
setConversationList(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
conversationList: payload,
|
||||
};
|
||||
},
|
||||
setCurrentConversation(state, { payload }) {
|
||||
const messageList =
|
||||
payload?.message?.map((x: Message | IMessage) => ({
|
||||
...x,
|
||||
id: 'id' in x ? x.id : uuid(),
|
||||
})) ?? [];
|
||||
return {
|
||||
...state,
|
||||
currentConversation: { ...payload, message: messageList },
|
||||
};
|
||||
},
|
||||
setTokenList(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
tokenList: payload,
|
||||
};
|
||||
},
|
||||
setStats(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
stats: payload,
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
effects: {
|
||||
*getDialog({ payload }, { call, put }) {
|
||||
const needToBeSaved =
|
||||
payload.needToBeSaved === undefined ? true : payload.needToBeSaved;
|
||||
const { data } = yield call(chatService.getDialog, {
|
||||
dialog_id: payload.dialog_id,
|
||||
});
|
||||
if (data.retcode === 0 && needToBeSaved) {
|
||||
yield put({ type: 'setCurrentDialog', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*setDialog({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.setDialog, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'listDialog' });
|
||||
message.success(
|
||||
i18n.t(`message.${payload.dialog_id ? 'modified' : 'created'}`),
|
||||
);
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*removeDialog({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.removeDialog, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'listDialog' });
|
||||
message.success(i18n.t('message.deleted'));
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*listDialog({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.listDialog, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setDialogList', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*listConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.listConversation, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setConversationList', payload: data.data });
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*getConversation({ payload }, { call, put }) {
|
||||
const needToBeSaved =
|
||||
payload.needToBeSaved === undefined ? true : payload.needToBeSaved;
|
||||
const { data } = yield call(chatService.getConversation, {
|
||||
conversation_id: payload.conversation_id,
|
||||
});
|
||||
if (data.retcode === 0 && needToBeSaved) {
|
||||
yield put({
|
||||
type: 'kFModel/fetch_document_thumbnails',
|
||||
payload: {
|
||||
doc_ids: getDocumentIdsFromConversionReference(data.data),
|
||||
},
|
||||
});
|
||||
yield put({ type: 'setCurrentConversation', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*setConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.setConversation, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'listConversation',
|
||||
payload: {
|
||||
dialog_id: data.data.dialog_id,
|
||||
},
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*completeConversation({ payload }, { call }) {
|
||||
const { data } = yield call(chatService.completeConversation, payload);
|
||||
// if (data.retcode === 0) {
|
||||
// yield put({
|
||||
// type: 'getConversation',
|
||||
// payload: {
|
||||
// conversation_id: payload.conversation_id,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
return data.retcode;
|
||||
},
|
||||
*removeConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.removeConversation, {
|
||||
conversation_ids: payload.conversation_ids,
|
||||
});
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'listConversation',
|
||||
payload: { dialog_id: payload.dialog_id },
|
||||
});
|
||||
message.success(i18n.t('message.deleted'));
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*createToken({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.createToken, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'listToken',
|
||||
payload: payload,
|
||||
});
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*listToken({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.listToken, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'setTokenList',
|
||||
payload: data.data,
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*removeToken({ payload }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
chatService.removeToken,
|
||||
omit(payload, ['dialogId']),
|
||||
);
|
||||
if (data.retcode === 0) {
|
||||
message.success(i18n.t('message.deleted'));
|
||||
yield put({
|
||||
type: 'listToken',
|
||||
payload: { dialog_id: payload.dialogId },
|
||||
});
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*getStats({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.getStats, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'setStats',
|
||||
payload: data.data,
|
||||
});
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*createExternalConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
chatService.createExternalConversation,
|
||||
payload,
|
||||
);
|
||||
// if (data.retcode === 0) {
|
||||
// yield put({
|
||||
// type: 'getExternalConversation',
|
||||
// payload: data.data.id,
|
||||
// });
|
||||
// }
|
||||
return data;
|
||||
},
|
||||
*getExternalConversation({ payload }, { call }) {
|
||||
const { data } = yield call(
|
||||
chatService.getExternalConversation,
|
||||
null,
|
||||
payload,
|
||||
);
|
||||
return data;
|
||||
},
|
||||
*completeExternalConversation({ payload }, { call }) {
|
||||
const { data } = yield call(
|
||||
chatService.completeExternalConversation,
|
||||
payload,
|
||||
);
|
||||
return data.retcode;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default model;
|
||||
import {
|
||||
IConversation,
|
||||
IDialog,
|
||||
IStats,
|
||||
IToken,
|
||||
Message,
|
||||
} from '@/interfaces/database/chat';
|
||||
import i18n from '@/locales/config';
|
||||
import chatService from '@/services/chat-service';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import { DvaModel } from 'umi';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { IClientConversation, IMessage } from './interface';
|
||||
import { getDocumentIdsFromConversionReference } from './utils';
|
||||
|
||||
export interface ChatModelState {
|
||||
name: string;
|
||||
dialogList: IDialog[];
|
||||
currentDialog: IDialog;
|
||||
conversationList: IConversation[];
|
||||
currentConversation: IClientConversation;
|
||||
tokenList: IToken[];
|
||||
stats: IStats;
|
||||
}
|
||||
|
||||
const model: DvaModel<ChatModelState> = {
|
||||
namespace: 'chatModel',
|
||||
state: {
|
||||
name: 'kate',
|
||||
dialogList: [],
|
||||
currentDialog: <IDialog>{},
|
||||
conversationList: [],
|
||||
currentConversation: {} as IClientConversation,
|
||||
tokenList: [],
|
||||
stats: {} as IStats,
|
||||
},
|
||||
reducers: {
|
||||
save(state, action) {
|
||||
return {
|
||||
...state,
|
||||
...action.payload,
|
||||
};
|
||||
},
|
||||
setDialogList(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
dialogList: payload,
|
||||
};
|
||||
},
|
||||
setCurrentDialog(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
currentDialog: payload,
|
||||
};
|
||||
},
|
||||
setConversationList(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
conversationList: payload,
|
||||
};
|
||||
},
|
||||
setCurrentConversation(state, { payload }) {
|
||||
const messageList =
|
||||
payload?.message?.map((x: Message | IMessage) => ({
|
||||
...x,
|
||||
id: 'id' in x ? x.id : uuid(),
|
||||
})) ?? [];
|
||||
return {
|
||||
...state,
|
||||
currentConversation: { ...payload, message: messageList },
|
||||
};
|
||||
},
|
||||
setTokenList(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
tokenList: payload,
|
||||
};
|
||||
},
|
||||
setStats(state, { payload }) {
|
||||
return {
|
||||
...state,
|
||||
stats: payload,
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
effects: {
|
||||
*getDialog({ payload }, { call, put }) {
|
||||
const needToBeSaved =
|
||||
payload.needToBeSaved === undefined ? true : payload.needToBeSaved;
|
||||
const { data } = yield call(chatService.getDialog, {
|
||||
dialog_id: payload.dialog_id,
|
||||
});
|
||||
if (data.retcode === 0 && needToBeSaved) {
|
||||
yield put({ type: 'setCurrentDialog', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*setDialog({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.setDialog, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'listDialog' });
|
||||
message.success(
|
||||
i18n.t(`message.${payload.dialog_id ? 'modified' : 'created'}`),
|
||||
);
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*removeDialog({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.removeDialog, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'listDialog' });
|
||||
message.success(i18n.t('message.deleted'));
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*listDialog({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.listDialog, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setDialogList', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*listConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.listConversation, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({ type: 'setConversationList', payload: data.data });
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*getConversation({ payload }, { call, put }) {
|
||||
const needToBeSaved =
|
||||
payload.needToBeSaved === undefined ? true : payload.needToBeSaved;
|
||||
const { data } = yield call(chatService.getConversation, {
|
||||
conversation_id: payload.conversation_id,
|
||||
});
|
||||
if (data.retcode === 0 && needToBeSaved) {
|
||||
yield put({
|
||||
type: 'kFModel/fetch_document_thumbnails',
|
||||
payload: {
|
||||
doc_ids: getDocumentIdsFromConversionReference(data.data),
|
||||
},
|
||||
});
|
||||
yield put({ type: 'setCurrentConversation', payload: data.data });
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*setConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.setConversation, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'listConversation',
|
||||
payload: {
|
||||
dialog_id: data.data.dialog_id,
|
||||
},
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*completeConversation({ payload }, { call }) {
|
||||
const { data } = yield call(chatService.completeConversation, payload);
|
||||
// if (data.retcode === 0) {
|
||||
// yield put({
|
||||
// type: 'getConversation',
|
||||
// payload: {
|
||||
// conversation_id: payload.conversation_id,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
return data.retcode;
|
||||
},
|
||||
*removeConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.removeConversation, {
|
||||
conversation_ids: payload.conversation_ids,
|
||||
});
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'listConversation',
|
||||
payload: { dialog_id: payload.dialog_id },
|
||||
});
|
||||
message.success(i18n.t('message.deleted'));
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*createToken({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.createToken, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'listToken',
|
||||
payload: payload,
|
||||
});
|
||||
message.success(i18n.t('message.created'));
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*listToken({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.listToken, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'setTokenList',
|
||||
payload: data.data,
|
||||
});
|
||||
}
|
||||
return data;
|
||||
},
|
||||
*removeToken({ payload }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
chatService.removeToken,
|
||||
omit(payload, ['dialogId']),
|
||||
);
|
||||
if (data.retcode === 0) {
|
||||
message.success(i18n.t('message.deleted'));
|
||||
yield put({
|
||||
type: 'listToken',
|
||||
payload: { dialog_id: payload.dialogId },
|
||||
});
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*getStats({ payload }, { call, put }) {
|
||||
const { data } = yield call(chatService.getStats, payload);
|
||||
if (data.retcode === 0) {
|
||||
yield put({
|
||||
type: 'setStats',
|
||||
payload: data.data,
|
||||
});
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*createExternalConversation({ payload }, { call, put }) {
|
||||
const { data } = yield call(
|
||||
chatService.createExternalConversation,
|
||||
payload,
|
||||
);
|
||||
// if (data.retcode === 0) {
|
||||
// yield put({
|
||||
// type: 'getExternalConversation',
|
||||
// payload: data.data.id,
|
||||
// });
|
||||
// }
|
||||
return data;
|
||||
},
|
||||
*getExternalConversation({ payload }, { call }) {
|
||||
const { data } = yield call(
|
||||
chatService.getExternalConversation,
|
||||
null,
|
||||
payload,
|
||||
);
|
||||
return data;
|
||||
},
|
||||
*completeExternalConversation({ payload }, { call }) {
|
||||
const { data } = yield call(
|
||||
chatService.completeExternalConversation,
|
||||
payload,
|
||||
);
|
||||
return data.retcode;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default model;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import MessageItem from '@/components/message-item';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSendButtonDisabled } from '@/pages/chat/hooks';
|
||||
import { Button, Flex, Input, Spin } from 'antd';
|
||||
import { forwardRef } from 'react';
|
||||
|
@ -2,9 +2,9 @@ import { MessageType } from '@/constants/chat';
|
||||
import {
|
||||
useCreateSharedConversation,
|
||||
useFetchSharedConversation,
|
||||
} from '@/hooks/chatHooks';
|
||||
} from '@/hooks/chat-hooks';
|
||||
import { useSendMessageWithSse } from '@/hooks/logic-hooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import { IAnswer } from '@/interfaces/database/chat';
|
||||
import api from '@/utils/api';
|
||||
import omit from 'lodash/omit';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Alert, Flex } from 'antd';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import React from 'react';
|
||||
import styles from './index.less';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { api_host } from '@/utils/api';
|
||||
import { downloadFile } from '@/utils/fileUtil';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { filterOptionsByInput } from '@/utils/commonUtil';
|
||||
import { Form, Modal, Select } from 'antd';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ReactComponent as DeleteIcon } from '@/assets/svg/delete.svg';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import {
|
||||
DownOutlined,
|
||||
FileTextOutlined,
|
||||
@ -26,7 +26,7 @@ import {
|
||||
useSelectBreadcrumbItems,
|
||||
} from './hooks';
|
||||
|
||||
import { useSelectParentFolderList } from '@/hooks/fileManagerHooks';
|
||||
import { useSelectParentFolderList } from '@/hooks/file-manager-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
interface IProps {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Input, Modal } from 'antd';
|
||||
|
||||
interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useSetModalState, useShowDeleteConfirm } from '@/hooks/commonHooks';
|
||||
import { useSetModalState, useShowDeleteConfirm } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useConnectToKnowledge,
|
||||
useCreateFolder,
|
||||
@ -9,9 +9,9 @@ import {
|
||||
useSelectFileList,
|
||||
useSelectParentFolderList,
|
||||
useUploadFile,
|
||||
} from '@/hooks/fileManagerHooks';
|
||||
} from '@/hooks/file-manager-hooks';
|
||||
import { useGetPagination, useSetPagination } from '@/hooks/logic-hooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { PaginationProps } from 'antd';
|
||||
import { TableRowSelection } from 'antd/es/table/interface';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useSelectFileList } from '@/hooks/fileManagerHooks';
|
||||
import { useSelectFileList } from '@/hooks/file-manager-hooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { Button, Flex, Space, Table, Tag, Typography } from 'antd';
|
||||
@ -19,7 +19,7 @@ import {
|
||||
import FileUploadModal from '@/components/file-upload-modal';
|
||||
import RenameModal from '@/components/rename-modal';
|
||||
import SvgIcon from '@/components/svg-icon';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { formatNumberWithThousandsSeparator } from '@/utils/commonUtil';
|
||||
import { getExtension } from '@/utils/documentUtils';
|
||||
import ConnectToKnowledgeModal from './connect-to-knowledge-modal';
|
||||
|
@ -4,7 +4,7 @@ import { IFile, IFolder } from '@/interfaces/database/file-manager';
|
||||
import i18n from '@/locales/config';
|
||||
import fileManagerService, {
|
||||
getDocumentFile,
|
||||
} from '@/services/fileManagerService';
|
||||
} from '@/services/file-manager-service';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import { DvaModel } from 'umi';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Input } from 'antd';
|
||||
import { IOperatorForm } from '../interface';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Flex } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import lowerFirst from 'lodash/lowerFirst';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Flex } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import { pick } from 'lodash';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Flex } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import lowerFirst from 'lodash/lowerFirst';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Flex } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import lowerFirst from 'lodash/lowerFirst';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { CloseOutlined } from '@ant-design/icons';
|
||||
import { Button, Card, Form, FormListFieldData, Input, Select } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import LLMSelect from '@/components/llm-select';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form } from 'antd';
|
||||
import { useSetLlmSetting } from '../hooks';
|
||||
import { IOperatorForm } from '../interface';
|
||||
|
@ -1,14 +1,14 @@
|
||||
import MessageItem from '@/components/message-item';
|
||||
import DocumentPreviewer from '@/components/pdf-previewer';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useClickDrawer, useGetFileIcon } from '@/pages/chat/hooks';
|
||||
import { buildMessageItemReference } from '@/pages/chat/utils';
|
||||
import { Button, Drawer, Flex, Input, Spin } from 'antd';
|
||||
|
||||
import { useSelectCurrentMessages, useSendMessage } from './hooks';
|
||||
|
||||
import { useSelectUserInfo } from '@/hooks/userSettingHook';
|
||||
import { useSelectUserInfo } from '@/hooks/user-setting-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const FlowChatBox = () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import TopNItem from '@/components/top-n-item';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Select } from 'antd';
|
||||
import { useMemo } from 'react';
|
||||
import { Channel } from '../constant';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { Drawer, Flex, Form, Input } from 'antd';
|
||||
import { useEffect } from 'react';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Card, Divider, Flex, Layout, Tooltip } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import lowerFirst from 'lodash/lowerFirst';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { EditableCell, EditableRow } from '@/components/editable-cell';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { DeleteOutlined } from '@ant-design/icons';
|
||||
import { Button, Flex, Select, Table, TableProps } from 'antd';
|
||||
import { IGenerateParameter } from '../interface';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import LLMSelect from '@/components/llm-select';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Input, InputNumber, Switch } from 'antd';
|
||||
import { useSetLlmSetting } from '../hooks';
|
||||
import { IOperatorForm } from '../interface';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useFetchFlow } from '@/hooks/flow-hooks';
|
||||
import { ArrowLeftOutlined } from '@ant-design/icons';
|
||||
import { Button, Flex, Space } from 'antd';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useSetModalState } from '@/hooks/commonHooks';
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import { useFetchFlow, useResetFlow, useSetFlow } from '@/hooks/flow-hooks';
|
||||
import { useFetchLlmList } from '@/hooks/llmHooks';
|
||||
import { useFetchLlmList } from '@/hooks/llm-hooks';
|
||||
import { IGraph } from '@/interfaces/database/flow';
|
||||
import { useIsFetching } from '@tanstack/react-query';
|
||||
import React, {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useSetModalState } from '@/hooks/commonHooks';
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import { Layout } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import { ReactFlowProvider } from 'reactflow';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import LLMSelect from '@/components/llm-select';
|
||||
import TopNItem from '@/components/top-n-item';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form } from 'antd';
|
||||
import { useSetLlmSetting } from '../hooks';
|
||||
import { IOperatorForm } from '../interface';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useFetchFlowTemplates } from '@/hooks/flow-hooks';
|
||||
import { useSelectItem } from '@/hooks/logic-hooks';
|
||||
import { Card, Flex, Form, Input, Modal, Space, Typography } from 'antd';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useSetModalState } from '@/hooks/commonHooks';
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useFetchFlowList,
|
||||
useFetchFlowTemplates,
|
||||
|
@ -4,7 +4,7 @@ import CreateFlowModal from './create-flow-modal';
|
||||
import FlowCard from './flow-card';
|
||||
import { useFetchDataOnMount, useSaveFlow } from './hooks';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const FlowList = () => {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user