mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +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:
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user