Skip to content

Commit

Permalink
fix: Set the default value of Self RAG to false infiniflow#1220 (infi…
Browse files Browse the repository at this point in the history
…niflow#1702)

### What problem does this PR solve?

fix: Set the default value of Self RAG  to false infiniflow#1220
fix: Change all tool file names to kebab format

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
cike8899 authored Jul 25, 2024
1 parent e3c5399 commit 36aae92
Show file tree
Hide file tree
Showing 38 changed files with 203 additions and 215 deletions.
2 changes: 1 addition & 1 deletion web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import weekOfYear from 'dayjs/plugin/weekOfYear';
import weekYear from 'dayjs/plugin/weekYear';
import weekday from 'dayjs/plugin/weekday';
import React, { ReactNode, useEffect, useState } from 'react';
import storage from './utils/authorizationUtil';
import storage from './utils/authorization-util';

dayjs.extend(customParseFormat);
dayjs.extend(advancedFormat);
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/message-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import classNames from 'classnames';
import { useMemo } from 'react';

import MarkdownContent from '@/pages/chat/markdown-content';
import { getExtension } from '@/utils/documentUtils';
import { getExtension } from '@/utils/document-util';
import { Avatar, Flex, List } from 'antd';
import NewDocumentLink from '../new-document-link';
import SvgIcon from '../svg-icon';
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/new-document-link.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
getExtension,
isSupportedPreviewDocumentType,
} from '@/utils/documentUtils';
} from '@/utils/document-util';
import React from 'react';

interface IProps extends React.PropsWithChildren {
Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/auth-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import authorizationUtil from '@/utils/authorizationUtil';
import authorizationUtil from '@/utils/authorization-util';
import { message } from 'antd';
import { useEffect, useMemo, useState } from 'react';
import { useNavigate, useSearchParams } from 'umi';
Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/document-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
import { api_host } from '@/utils/api';
import { buildChunkHighlights } from '@/utils/documentUtils';
import { buildChunkHighlights } from '@/utils/document-util';
import { UploadFile } from 'antd';
import { useCallback, useMemo, useState } from 'react';
import { IHighlight } from 'react-pdf-highlighter';
Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/llm-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
IAddLlmRequestBody,
IDeleteLlmRequestBody,
} from '@/interfaces/request/llm';
import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/commonUtil';
import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/common-util';
import { useCallback, useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'umi';

Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/logic-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IAnswer } from '@/interfaces/database/chat';
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
import api from '@/utils/api';
import { getAuthorization } from '@/utils/authorizationUtil';
import { getAuthorization } from '@/utils/authorization-util';
import { PaginationProps } from 'antd';
import axios from 'axios';
import { EventSourceParserStream } from 'eventsource-parser/stream';
Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/login-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Authorization } from '@/constants/authorization';
import userService from '@/services/user-service';
import authorizationUtil from '@/utils/authorizationUtil';
import authorizationUtil from '@/utils/authorization-util';
import { useMutation } from '@tanstack/react-query';
import { message } from 'antd';
import { useTranslation } from 'react-i18next';
Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/store-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getOneNamespaceEffectsLoading } from '@/utils/storeUtil';
import { getOneNamespaceEffectsLoading } from '@/utils/store-util';
import { useSelector } from 'umi';

// Get the loading status of given effects under a certain namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
import { buildChunkHighlights } from '@/utils/documentUtils';
import { buildChunkHighlights } from '@/utils/document-util';
import { useCallback, useMemo, useState } from 'react';
import { IHighlight } from 'react-pdf-highlighter';
import { useSelector } from 'umi';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
import kbService from '@/services/knowledge-service';
import { message } from 'antd';
import { pick } from 'lodash';
// import { delay } from '@/utils/storeUtil';
// import { delay } from '@/utils/store-util';
import i18n from '@/locales/config';
import { DvaModel } from 'umi';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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';
import { getUnSupportedFilesCount } from '@/utils/document-util';
import { PaginationProps, UploadFile } from 'antd';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useDispatch, useNavigate, useSelector } from 'umi';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { useSetSelectedRecord } from '@/hooks/logic-hooks';
import { useSelectParserList } from '@/hooks/user-setting-hooks';
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
import { getExtension } from '@/utils/documentUtils';
import { getExtension } from '@/utils/document-util';
import { Divider, Flex, Switch, Table, Typography } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { useTranslation } from 'react-i18next';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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';
import { downloadFile } from '@/utils/file-util';
import {
DeleteOutlined,
DownloadOutlined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { normFile } from '@/utils/fileUtil';
import { normFile } from '@/utils/file-util';
import { PlusOutlined } from '@ant-design/icons';
import { Button, Form, Input, Radio, Select, Space, Upload } from 'antd';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import {
getBase64FromUploadFileList,
getUploadFileListFromBase64,
} from '@/utils/fileUtil';
} from '@/utils/file-util';
import { useIsFetching } from '@tanstack/react-query';
import { Form, UploadFile } from 'antd';
import { FormInstance } from 'antd/lib';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const AssistantSetting = ({ show }: ISegmentedContentProps) => {
valuePropName="checked"
name={['prompt_config', 'self_rag']}
tooltip={t('selfRagTip')}
initialValue={true}
initialValue={false}
>
<Switch />
</Form.Item>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/chat/chat-configuration-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
useFetchLlmModelOnVisible,
useFetchModelId,
} from '@/hooks/logic-hooks';
import { getBase64FromUploadFileList } from '@/utils/fileUtil';
import { getBase64FromUploadFileList } from '@/utils/file-util';
import { removeUselessFieldsFromValues } from '@/utils/form';
import styles from './index.less';

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/chat/markdown-content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SvgIcon from '@/components/svg-icon';
import { useSelectFileThumbnails } from '@/hooks/knowledge-hooks';
import { IReference } from '@/interfaces/database/chat';
import { IChunk } from '@/interfaces/database/knowledge';
import { getExtension } from '@/utils/documentUtils';
import { getExtension } from '@/utils/document-util';
import { InfoCircleOutlined } from '@ant-design/icons';
import { Button, Flex, Popover, Space } from 'antd';
import DOMPurify from 'dompurify';
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/file-manager/action-cell/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslate } from '@/hooks/common-hooks';
import { IFile } from '@/interfaces/database/file-manager';
import { api_host } from '@/utils/api';
import { downloadFile } from '@/utils/fileUtil';
import { downloadFile } from '@/utils/file-util';
import {
DeleteOutlined,
DownloadOutlined,
Expand All @@ -16,7 +16,7 @@ import NewDocumentLink from '@/components/new-document-link';
import {
getExtension,
isSupportedPreviewDocumentType,
} from '@/utils/documentUtils';
} from '@/utils/document-util';
import styles from './index.less';

interface IProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslate } from '@/hooks/common-hooks';
import { useNextFetchKnowledgeList } from '@/hooks/knowledge-hooks';
import { IModalProps } from '@/interfaces/common';
import { filterOptionsByInput } from '@/utils/commonUtil';
import { filterOptionsByInput } from '@/utils/common-util';
import { Form, Modal, Select } from 'antd';
import { useEffect } from 'react';

Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/file-manager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import FileUploadModal from '@/components/file-upload-modal';
import RenameModal from '@/components/rename-modal';
import SvgIcon from '@/components/svg-icon';
import { useTranslate } from '@/hooks/common-hooks';
import { formatNumberWithThousandsSeparator } from '@/utils/commonUtil';
import { getExtension } from '@/utils/documentUtils';
import { formatNumberWithThousandsSeparator } from '@/utils/common-util';
import { getExtension } from '@/utils/document-util';
import ConnectToKnowledgeModal from './connect-to-knowledge-modal';
import FolderCreateModal from './folder-create-modal';
import styles from './index.less';
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/user-setting/setting-profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getBase64FromUploadFileList,
getUploadFileListFromBase64,
normFile,
} from '@/utils/fileUtil';
} from '@/utils/file-util';
import { PlusOutlined } from '@ant-design/icons';
import {
Button,
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/user-setting/setting-system/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import lowerCase from 'lodash/lowerCase';
import upperFirst from 'lodash/upperFirst';
import { useEffect } from 'react';

import { toFixed } from '@/utils/commonUtil';
import { toFixed } from '@/utils/common-util';
import styles from './index.less';

const { Text } = Typography;
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/chat-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api from '@/utils/api';
import registerServer from '@/utils/registerServer';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';

const {
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/file-manager-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api from '@/utils/api';
import registerServer from '@/utils/registerServer';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';
import pureRequest from 'axios';

Expand Down
2 changes: 1 addition & 1 deletion web/src/services/flow-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api from '@/utils/api';
import registerServer from '@/utils/registerServer';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';

const {
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/knowledge-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api from '@/utils/api';
import registerServer from '@/utils/registerServer';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';
import pureRequest from 'umi-request';

Expand Down
2 changes: 1 addition & 1 deletion web/src/services/user-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api from '@/utils/api';
import registerServer from '@/utils/registerServer';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';

const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Authorization, Token, UserInfo } from '@/constants/authorization';
import { getSearchValue } from './commonUtil';
import { getSearchValue } from './common-util';
const KeySet = [Authorization, Token, UserInfo];

const storage = {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions web/src/utils/hooks.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import omit from 'lodash/omit';
import { RequestMethod } from 'umi-request';

type Service<T extends string> = Record<
T,
(params?: any, urlAppendix?: string) => any
>;

const registerServer = <T extends string>(
opt: Record<T, { url: string; method: string }>,
request: RequestMethod,
) => {
const server: Service<T> = {} as Service<T>;
for (let key in opt) {
server[key] = (params?: any, urlAppendix?: string) => {
let url = opt[key].url;
const requestOptions = opt[key];
if (urlAppendix) {
url = url + '/' + urlAppendix;
}
if (opt[key].method === 'post' || opt[key].method === 'POST') {
return request(url, {
method: opt[key].method,
data: params,
});
}

if (opt[key].method === 'get' || opt[key].method === 'GET') {
return request.get(url, {
...omit(requestOptions, ['method', 'url']),
params,
});
}
};
}
return server;
};

export default registerServer;
import omit from 'lodash/omit';
import { RequestMethod } from 'umi-request';

type Service<T extends string> = Record<
T,
(params?: any, urlAppendix?: string) => any
>;

const registerServer = <T extends string>(
opt: Record<T, { url: string; method: string }>,
request: RequestMethod,
) => {
const server: Service<T> = {} as Service<T>;
for (let key in opt) {
server[key] = (params?: any, urlAppendix?: string) => {
let url = opt[key].url;
const requestOptions = opt[key];
if (urlAppendix) {
url = url + '/' + urlAppendix;
}
if (opt[key].method === 'post' || opt[key].method === 'POST') {
return request(url, {
method: opt[key].method,
data: params,
});
}

if (opt[key].method === 'get' || opt[key].method === 'GET') {
return request.get(url, {
...omit(requestOptions, ['method', 'url']),
params,
});
}
};
}
return server;
};

export default registerServer;
Loading

0 comments on commit 36aae92

Please sign in to comment.