chore: format all frontend files (#430)

This commit is contained in:
tecvan
2025-07-31 23:15:48 +08:00
committed by GitHub
parent 8b078ff013
commit 6995cec404
8787 changed files with 11975 additions and 10924 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
IconCozDicumentOnline,
IconCozDocument,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useEffect, useMemo, useState } from 'react';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useBatchCheckboxDoc, type IBatchCheckboxDocProps } from './hooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useRequest } from 'ahooks';
import { REPORT_EVENTS } from '@coze-arch/report-events';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useBatchFetchModal, type TBatchFetchModalProps } from './hooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useMemo, useState } from 'react';
import { useRequest } from 'ahooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
useBatchFrequencyModal,
type TBatchFrequencyModalProps,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const KNOWLEDGE_UNIT_NAME_MAX_LEN = 100;
export const KNOWLEDGE_MAX_DOC_SIZE = 300;
export const KNOWLEDGE_MAX_SLICE_COUNT = 10000;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Radio, Typography } from '@coze-arch/coze-design';
interface SourceRadioProps {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { ReactNode } from 'react';
import { RadioGroup } from '@coze-arch/coze-design';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @coze-arch/max-line-per-function */
import { useEffect, useState } from 'react';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ImportKnowledgeSourceSelectModuleProps } from '../module';
import { ImageLocal } from '../../import-knowledge-source/image-local';
import { SourceSelect } from '../../../components/source-select';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FormatType } from '@coze-arch/bot-api/knowledge';
import { type ImportKnowledgeSourceSelectModule } from '../module';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ImportKnowledgeSourceSelectModuleProps } from '../module';
import { TableLocal } from '../../import-knowledge-source/table-local';
import { TableCustom } from '../../import-knowledge-source/table-custom';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type ImportKnowledgeSourceSelectModuleProps } from '../module';
import { TextLocal } from '../../import-knowledge-source/text-local';
import { TextCustom } from '../../import-knowledge-source/text-custom';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type UnitType } from '@coze-data/knowledge-resource-processor-core';
import { type FormatType } from '@coze-arch/bot-api/knowledge';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { TableCustom } from './table-custom';
export { TableLocal } from './table-local';
export { TextCustom } from './text-custom';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type RadioGroupProps } from '@coze-arch/coze-design';
export type ImportKnowledgeSourceModule = React.ComponentType<RadioGroupProps>;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';
import { withField } from '@coze-arch/bot-semi';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type React from 'react';
import type { FormatType } from '@coze-arch/bot-api/memory';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
CozeKnowledgeAddTypeContent,
type CozeKnowledgeAddTypeContentFormData,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { useRequest } from 'ahooks';
import { useDataModalWithCoze } from '@coze-data/utils';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useDeleteUnitModal, type IDeleteUnitModalProps } from './hooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useCallback, useRef, useState } from 'react';
import {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useEffect, useState } from 'react';
import { useDataModalWithCoze } from '@coze-data/utils';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useEditUnitNameModal } from './hooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useRequest } from 'ahooks';
import { useDataModalWithCoze } from '@coze-data/utils';
import { DataNamespace, dataReporter } from '@coze-data/reporter';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useFetchSliceModal } from './hooks';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types='@coze-arch/bot-typings' />

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
useEditKnowledgeModal,
type EditModalData,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC, type PropsWithChildren } from 'react';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { FilePopover } from './file-popover';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
KnowledgeCardListVertical,
type DatasetCardListVerticalOperations,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type FC } from 'react';
import { unix } from 'dayjs';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import copy from 'copy-to-clipboard';
import { useDataNavigate } from '@coze-data/knowledge-stores';
import { REPORT_EVENTS as ReportEventNames } from '@coze-arch/report-events';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { IconCozKnowledgeFill } from '@coze-arch/coze-design/icons';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { FC, ReactNode } from 'react';
import classNames from 'classnames';

View File

@@ -353,96 +353,99 @@ const useKnowledgeFilter = ({
};
const renderSearch = useMemo(
() => () => (
<Input
autoFocus
key="query-input"
placeholder={I18n.t('db2_014')}
onChange={debounce(handleQueryChange, 500)}
/>
),
() => () =>
(
<Input
autoFocus
key="query-input"
placeholder={I18n.t('db2_014')}
onChange={debounce(handleQueryChange, 500)}
/>
),
[],
);
const renderCreateBtn = useMemo(
() => () => (
<UIButton
theme="solid"
onClick={handleAdd}
data-testid={BotE2e.BotKnowledgeSelectListModalCreateBtn}
>
{I18n.t('datasets_create_btn')}
</UIButton>
),
() => () =>
(
<UIButton
theme="solid"
onClick={handleAdd}
data-testid={BotE2e.BotKnowledgeSelectListModalCreateBtn}
>
{I18n.t('datasets_create_btn')}
</UIButton>
),
[handleAdd],
);
const renderFilters = useMemo(
() => () => (
<>
<div className={styles['file-type-tab']}>
{uniqKnowledgeTypeConfigList.reduce<ReactNode[]>(
(
accumulator: ReactNode[],
currentValue: FilterKnowledgeType,
currentIndex: number,
) => {
const reactNode = renderKnowledgeTypeConfigNode(currentValue);
if (currentIndex !== 0) {
return accumulator.concat([
<Divider layout="vertical" margin="12px" />,
reactNode,
]);
}
return accumulator.concat([reactNode]);
},
[],
)}
</div>
() => () =>
(
<>
<div className={styles['file-type-tab']}>
{uniqKnowledgeTypeConfigList.reduce<ReactNode[]>(
(
accumulator: ReactNode[],
currentValue: FilterKnowledgeType,
currentIndex: number,
) => {
const reactNode = renderKnowledgeTypeConfigNode(currentValue);
if (currentIndex !== 0) {
return accumulator.concat([
<Divider layout="vertical" margin="12px" />,
reactNode,
]);
}
return accumulator.concat([reactNode]);
},
[],
)}
</div>
<div className={'flex'}>
{uniq(showFilters).map((filterType: DatasetFilterType) => {
if (filterType === 'scope-type') {
return !isPersonal ? (
<UISelect
label={I18n.t('Creator')}
showClear={false}
value={scopeType}
optionList={scopeOptions}
onChange={v => {
setScopeType(v as DatasetScopeType);
}}
/>
) : null;
} else if (filterType === 'search-type') {
return (
<UISelect
data-testid={
BotE2e.BotKnowledgeSelectListModalCreateDateSelect
}
label={I18n.t('Sort')}
showClear={false}
value={searchType}
optionList={[
{
label: I18n.t('Create_time'),
value: OrderField.CreateTime,
},
{
label: I18n.t('Update_time'),
value: OrderField.UpdateTime,
},
]}
onChange={v => {
handleSearchTypeChange(v as OrderField);
}}
/>
);
}
})}
</div>
</>
),
<div className={'flex'}>
{uniq(showFilters).map((filterType: DatasetFilterType) => {
if (filterType === 'scope-type') {
return !isPersonal ? (
<UISelect
label={I18n.t('Creator')}
showClear={false}
value={scopeType}
optionList={scopeOptions}
onChange={v => {
setScopeType(v as DatasetScopeType);
}}
/>
) : null;
} else if (filterType === 'search-type') {
return (
<UISelect
data-testid={
BotE2e.BotKnowledgeSelectListModalCreateDateSelect
}
label={I18n.t('Sort')}
showClear={false}
value={searchType}
optionList={[
{
label: I18n.t('Create_time'),
value: OrderField.CreateTime,
},
{
label: I18n.t('Update_time'),
value: OrderField.UpdateTime,
},
]}
onChange={v => {
handleSearchTypeChange(v as OrderField);
}}
/>
);
}
})}
</div>
</>
),
[
headerClassName,
handleSearchTypeChange,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import copy from 'copy-to-clipboard';
import { BotE2e } from '@coze-data/e2e';
import { I18n, getUnReactiveLanguage } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useRef } from 'react';
import { debounce, isEmpty } from 'lodash-es';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { type CSSProperties, type ReactNode } from 'react';
import classNames from 'classnames';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from 'classnames';
import { type I18nKeysNoOptionsType } from '@coze-arch/i18n';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { InputNumber, Slider } from '@coze-arch/bot-semi';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { IconInfo } from '@coze-arch/bot-icons';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type KnowledgeShowSourceMode,
type KnowledgeNoRecallReplyMode,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type RecallStrategy } from '@coze-arch/bot-api/playground_api';
import { type IDataSetInfo } from './type';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState } from 'react';
import { I18n } from '@coze-arch/i18n';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useRequest } from 'ahooks';
import { DataNamespace, dataReporter } from '@coze-data/reporter';
import { REPORT_EVENTS } from '@coze-arch/report-events';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState } from 'react';
import { SetAppendFrequencyModal } from '../../components/main';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useSetAppendFrequencyModal } from './hooks/use-case/use-set-append-frequency-modal';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DataNamespace, dataReporter } from '@coze-data/reporter';
import { REPORT_EVENTS } from '@coze-arch/report-events';
import { type AuthFrequencyInfo } from '@coze-arch/bot-api/knowledge';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useDataModalWithCoze } from '@coze-data/utils';
import { I18n } from '@coze-arch/i18n';
import { type ButtonColor } from '@coze-arch/coze-design/types';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @coze-arch/max-line-per-function */
import { useEffect, useMemo, useRef, useState } from 'react';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
useTableSegmentModal,
type UseTableSegmentModalParams,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState, type ComponentProps } from 'react';
import { ImageRender } from '@coze-common/table-view';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useDataModalWithCoze } from '@coze-data/utils';
import { I18n } from '@coze-arch/i18n';
import { type ButtonColor } from '@coze-arch/coze-design/types';

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useTextResegmentModal } from './hooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare module '*.less' {
const resource: { [key: string]: string };
export = resource;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useRef, useState } from 'react';
import { useRequest } from 'ahooks';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
useUpdateFrequencyModal,
type UseUpdateFrequencyModalProps,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { I18n } from '@coze-arch/i18n';
import { CustomError } from '@coze-arch/bot-error';
import { Toast } from '@coze-arch/coze-design';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {
getEllipsisCount,
formatBytes,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ImageFail from '../assets/image-fail.png';
export const transSliceContentOutput = (

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DemoComponent } from '../src';
export default {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { defineConfig } from '@coze-arch/vitest-config';
export default defineConfig({