Feat: Run eslint when the project is running to standardize everyone's code #9377 (#9379)

### What problem does this PR solve?

Feat: Run eslint when the project is running to standardize everyone's
code #9377

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-08-11 15:31:38 +08:00
committed by GitHub
parent f022504ef9
commit a060672b31
62 changed files with 330 additions and 179 deletions

View File

@ -80,7 +80,6 @@ export function ChunkMethodDialog({
hideModal,
onOk,
parserId,
documentId,
documentExtension,
visible,
parserConfig,

View File

@ -1,4 +1,5 @@
import { Form, FormInstance, Input, InputRef, Typography } from 'antd';
import { omit } from 'lodash';
import React, { useContext, useEffect, useRef, useState } from 'react';
const EditableContext = React.createContext<FormInstance<any> | null>(null);
@ -15,15 +16,12 @@ interface Item {
address: string;
}
export const EditableRow: React.FC<EditableRowProps> = ({
index,
...props
}) => {
export const EditableRow: React.FC<EditableRowProps> = ({ ...props }) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
<tr {...omit(props, 'index')} />
</EditableContext.Provider>
</Form>
);

View File

@ -31,7 +31,7 @@ const HightLightMarkdown = ({
components={
{
code(props: any) {
const { children, className, node, ...rest } = props;
const { children, className, ...rest } = props;
const match = /language-(\w+)/.exec(className || '');
return match ? (
<SyntaxHighlighter

View File

@ -1,4 +1,4 @@
import { PromptIcon } from '@/assets/icon/Icon';
import { PromptIcon } from '@/assets/icon/next-icon';
import CopyToClipboard from '@/components/copy-to-clipboard';
import { useSetModalState } from '@/hooks/common-hooks';
import { IRemoveMessageById } from '@/hooks/logic-hooks';

View File

@ -27,6 +27,7 @@ import {
import { cn } from '@/lib/utils';
import { currentReg, replaceTextByOldReg } from '@/pages/chat/utils';
import classNames from 'classnames';
import { omit } from 'lodash';
import { pipe } from 'lodash/fp';
import { CircleAlert } from 'lucide-react';
import { Button } from '../ui/button';
@ -256,11 +257,12 @@ function MarkdownContent({
'custom-typography': ({ children }: { children: string }) =>
renderReference(children),
code(props: any) {
const { children, className, node, ...rest } = props;
const { children, className, ...rest } = props;
const restProps = omit(rest, 'node');
const match = /language-(\w+)/.exec(className || '');
return match ? (
<SyntaxHighlighter
{...rest}
{...restProps}
PreTag="div"
language={match[1]}
wrapLongLines
@ -268,7 +270,10 @@ function MarkdownContent({
{String(children).replace(/\n$/, '')}
</SyntaxHighlighter>
) : (
<code {...rest} className={classNames(className, 'text-wrap')}>
<code
{...restProps}
className={classNames(className, 'text-wrap')}
>
{children}
</code>
);

View File

@ -1,4 +1,4 @@
import { PromptIcon } from '@/assets/icon/Icon';
import { PromptIcon } from '@/assets/icon/next-icon';
import CopyToClipboard from '@/components/copy-to-clipboard';
import { useSetModalState } from '@/hooks/common-hooks';
import { IRemoveMessageById } from '@/hooks/logic-hooks';

View File

@ -17,7 +17,7 @@ import { IRegenerateMessage, IRemoveMessageById } from '@/hooks/logic-hooks';
import { INodeEvent, MessageEventType } from '@/hooks/use-send-message';
import { cn } from '@/lib/utils';
import { AgentChatContext } from '@/pages/agent/context';
import { WorkFlowTimeline } from '@/pages/agent/log-sheet/workFlowTimeline';
import { WorkFlowTimeline } from '@/pages/agent/log-sheet/workflow-timeline';
import { IMessage } from '@/pages/chat/interface';
import { isEmpty } from 'lodash';
import { Atom, ChevronDown, ChevronUp } from 'lucide-react';

View File

@ -124,7 +124,7 @@ interface TimelineIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
}
function TimelineIndicator({
asChild = false,
// asChild = false,
className,
children,
...props

View File

@ -1,7 +1,6 @@
import { Input } from '@/components/originui/input';
import { useTranslate } from '@/hooks/common-hooks';
import { EyeIcon, EyeOffIcon } from 'lucide-react';
import { ChangeEvent, LegacyRef, forwardRef, useId, useState } from 'react';
import { ChangeEvent, forwardRef, useId, useState } from 'react';
type PropType = {
name: string;
@ -10,17 +9,12 @@ type PropType = {
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
};
function PasswordInput(
props: PropType,
ref: LegacyRef<HTMLInputElement> | undefined,
) {
function PasswordInput(props: PropType) {
const id = useId();
const [isVisible, setIsVisible] = useState<boolean>(false);
const toggleVisibility = () => setIsVisible((prevState) => !prevState);
const { t } = useTranslate('setting');
return (
<div className="*:not-first:mt-2 w-full">
{/* <Label htmlFor={id}>Show/hide password input</Label> */}

View File

@ -39,7 +39,7 @@ const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
<div className="flex items-center border-b px-3" data-cmdk-input-wrapper="">
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={ref}

View File

@ -196,7 +196,7 @@ export const MultiSelect = React.forwardRef<
animation = 0,
maxCount = 3,
modalPopover = false,
asChild = false,
// asChild = false,
className,
showSelectAll = true,
...props

View File

@ -26,7 +26,7 @@ const SIDEBAR_WIDTH_MOBILE = '18rem';
const SIDEBAR_WIDTH_ICON = '3rem';
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
type SidebarContext = {
type SidebarContextType = {
state: 'expanded' | 'collapsed';
open: boolean;
setOpen: (open: boolean) => void;
@ -36,7 +36,7 @@ type SidebarContext = {
toggleSidebar: () => void;
};
const SidebarContext = React.createContext<SidebarContext | null>(null);
const SidebarContext = React.createContext<SidebarContextType | null>(null);
function useSidebar() {
const context = React.useContext(SidebarContext);
@ -116,7 +116,7 @@ const SidebarProvider = React.forwardRef<
// This makes it easier to style the sidebar with Tailwind classes.
const state = open ? 'expanded' : 'collapsed';
const contextValue = React.useMemo<SidebarContext>(
const contextValue = React.useMemo<SidebarContextType>(
() => ({
state,
open,
@ -580,11 +580,8 @@ const SidebarMenuButton = React.forwardRef<
return button;
}
if (typeof tooltip === 'string') {
tooltip = {
children: tooltip,
};
}
const tooltipContent =
typeof tooltip === 'string' ? { children: tooltip } : tooltip;
return (
<Tooltip>
@ -593,7 +590,7 @@ const SidebarMenuButton = React.forwardRef<
side="right"
align="center"
hidden={state !== 'collapsed' || isMobile}
{...tooltip}
{...tooltipContent}
/>
</Tooltip>
);

View File

@ -27,7 +27,7 @@ import { useTranslate } from './common-hooks';
import { useSetPaginationParams } from './route-hook';
import { useFetchTenantInfo, useSaveSetting } from './user-setting-hooks';
function usePrevious<T>(value: T) {
export function usePrevious<T>(value: T) {
const ref = useRef<T>();
useEffect(() => {
ref.current = value;

View File

@ -368,16 +368,7 @@ export const useUploadCanvasFileWithProgress = (
{
url: api.uploadAgentFile(identifier || id),
data: formData,
onUploadProgress: ({
loaded,
total,
progress,
bytes,
estimated,
rate,
upload,
lengthComputable,
}) => {
onUploadProgress: ({ progress }) => {
files.forEach((file) => {
onProgress(file, (progress || 0) * 100);
});

View File

@ -5,7 +5,7 @@ import { IAskRequestBody } from '@/interfaces/request/chat';
import { IClientConversation } from '@/pages/next-chats/chat/interface';
import { useGetSharedChatSearchParams } from '@/pages/next-chats/hooks/use-send-shared-message';
import { isConversationIdExist } from '@/pages/next-chats/utils';
import chatService from '@/services/next-chat-service ';
import chatService from '@/services/next-chat-service';
import { buildMessageListWithUuid, getConversationId } from '@/utils/chat';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useDebounce } from 'ahooks';

View File

@ -13,8 +13,7 @@ import { LanguageList, LanguageMap, ThemeEnum } from '@/constants/common';
import { useChangeLanguage } from '@/hooks/logic-hooks';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { useNavigateWithFromState } from '@/hooks/route-hook';
import { useFetchUserInfo, useListTenant } from '@/hooks/user-setting-hooks';
import { TenantRole } from '@/pages/user-setting/constants';
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
import { Routes } from '@/routes';
import { camelCase } from 'lodash';
import {
@ -55,11 +54,11 @@ export function Header() {
changeLanguage(key);
};
const { data } = useListTenant();
// const { data } = useListTenant();
const showBell = useMemo(() => {
return data.some((x) => x.role === TenantRole.Invite);
}, [data]);
// const showBell = useMemo(() => {
// return data.some((x) => x.role === TenantRole.Invite);
// }, [data]);
const items = LanguageList.map((x) => ({
key: x,
@ -70,9 +69,9 @@ export function Header() {
setTheme(theme === ThemeEnum.Dark ? ThemeEnum.Light : ThemeEnum.Dark);
}, [setTheme, theme]);
const handleBellClick = useCallback(() => {
navigate('/user-setting/team');
}, [navigate]);
// const handleBellClick = useCallback(() => {
// navigate('/user-setting/team');
// }, [navigate]);
const tagsData = useMemo(
() => [

View File

@ -147,7 +147,7 @@ export const useHandleUploadDocument = () => {
const [fileList, setFileList] = useState<UploadFile[]>([]);
const [uploadProgress, setUploadProgress] = useState<number>(0);
const { uploadDocument, loading } = useUploadNextDocument();
const { runDocumentByIds, loading: _ } = useRunNextDocument();
const { runDocumentByIds } = useRunNextDocument();
const onDocumentUploadOk = useCallback(
async ({

View File

@ -168,7 +168,7 @@ const KnowledgeFile = () => {
),
dataIndex: 'run',
key: 'run',
filters: Object.entries(RunningStatus).map(([key, value]) => ({
filters: Object.values(RunningStatus).map((value) => ({
text: t(`runningStatus${value}`),
value: value,
})),

View File

@ -27,7 +27,6 @@ const KnowledgeSidebar = () => {
const { knowledgeId } = useGetKnowledgeSearchParams();
const [windowWidth, setWindowWidth] = useState(getWidth());
const [collapsed, setCollapsed] = useState(false);
const { t } = useTranslation();
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
@ -92,14 +91,6 @@ const KnowledgeSidebar = () => {
return list;
}, [data, getItem]);
useEffect(() => {
if (windowWidth.width > 957) {
setCollapsed(false);
} else {
setCollapsed(true);
}
}, [windowWidth.width]);
useEffect(() => {
const widthSize = () => {
const width = getWidth();

View File

@ -4,7 +4,7 @@ import { IRetrievalNode } from '@/interfaces/database/flow';
import { NodeProps, Position } from '@xyflow/react';
import classNames from 'classnames';
import { get } from 'lodash';
import { memo, useMemo } from 'react';
import { memo } from 'react';
import { NodeHandleId } from '../../constant';
import { useGetVariableLabelByValue } from '../../hooks/use-get-begin-query';
import { CommonHandle } from './handle';
@ -21,18 +21,7 @@ function InnerRetrievalNode({
selected,
}: NodeProps<IRetrievalNode>) {
const knowledgeBaseIds: string[] = get(data, 'form.kb_ids', []);
console.log('🚀 ~ InnerRetrievalNode ~ knowledgeBaseIds:', knowledgeBaseIds);
const { list: knowledgeList } = useFetchKnowledgeList(true);
const knowledgeBases = useMemo(() => {
return knowledgeBaseIds.map((x) => {
const item = knowledgeList.find((y) => x === y.id);
return {
name: item?.name,
avatar: item?.avatar,
id: x,
};
});
}, [knowledgeList, knowledgeBaseIds]);
const getLabel = useGetVariableLabelByValue(id);

View File

@ -1,8 +1,7 @@
import { ModelVariableType } from '@/constants/knowledge';
import { RAGFlowNodeType } from '@/interfaces/database/flow';
import { get, isEmpty, isPlainObject } from 'lodash';
import { isEmpty, isPlainObject } from 'lodash';
import { useMemo } from 'react';
import { buildCategorizeListFromObject } from '../../utils';
const defaultValues = {
parameter: ModelVariableType.Precise,
@ -21,9 +20,6 @@ export function useValues(node?: RAGFlowNodeType) {
if (isEmpty(formData)) {
return defaultValues;
}
const items = buildCategorizeListFromObject(
get(node, 'data.form.category_description', {}),
);
if (isPlainObject(formData)) {
// const nextValues = {
// ...omit(formData, 'category_description'),

View File

@ -1,6 +1,6 @@
'use client';
import { SideDown } from '@/assets/icon/Icon';
import { SideDown } from '@/assets/icon/next-icon';
import { Button } from '@/components/ui/button';
import {
Collapsible,

View File

@ -1,4 +1,3 @@
import { Edge } from '@xyflow/react';
import pick from 'lodash/pick';
import { useCallback, useEffect } from 'react';
import { IOperatorForm } from '../../interface';
@ -21,16 +20,12 @@ export const useBuildRelevantOptions = () => {
return buildRelevantOptions;
};
const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
edges.find((x) => x.sourceHandle === sourceHandle)?.target;
/**
* monitor changes in the connection and synchronize the target to the yes and no fields of the form
* similar to the categorize-form's useHandleFormValuesChange method
* @param param0
*/
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
const edges = useGraphStore((state) => state.edges);
const getNode = useGraphStore((state) => state.getNode);
const node = getNode(nodeId);
@ -40,13 +35,6 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
}
}, [node, form]);
const watchConnectionChanges = useCallback(() => {
const edgeList = edges.filter((x) => x.source === nodeId);
const yes = getTargetOfEdge(edgeList, 'yes');
const no = getTargetOfEdge(edgeList, 'no');
form?.setFieldsValue({ yes, no });
}, [edges, nodeId, form]);
useEffect(() => {
watchFormChanges();
}, [watchFormChanges]);

View File

@ -8,7 +8,7 @@ import { IModalProps } from '@/interfaces/common';
import { NotebookText } from 'lucide-react';
import 'react18-json-view/src/style.css';
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
import { WorkFlowTimeline } from './workFlowTimeline';
import { WorkFlowTimeline } from './workflow-timeline';
type LogSheetProps = IModalProps<any> &
Pick<

View File

@ -19,7 +19,7 @@ import {
JsonViewer,
toLowerCaseStringAndDeleteChar,
typeMap,
} from './workFlowTimeline';
} from './workflow-timeline';
type IToolIcon =
| Operator.ArXiv
| Operator.GitHub

View File

@ -28,7 +28,7 @@ import JsonView from 'react18-json-view';
import { Operator } from '../constant';
import { useCacheChatLog } from '../hooks/use-cache-chat-log';
import OperatorIcon from '../operator-icon';
import ToolTimelineItem from './toolTimelineItem';
import ToolTimelineItem from './tool-timeline-item';
type LogFlowTimelineProps = Pick<
ReturnType<typeof useCacheChatLog>,
'currentEventListWithoutMessage' | 'currentMessageId'

View File

@ -1,4 +1,5 @@
import { Form, FormInstance, Input, InputRef } from 'antd';
import { omit } from 'lodash';
import React, { useContext, useEffect, useRef, useState } from 'react';
const EditableContext = React.createContext<FormInstance<any> | null>(null);
@ -14,15 +15,12 @@ interface Item {
address: string;
}
export const EditableRow: React.FC<EditableRowProps> = ({
index,
...props
}) => {
export const EditableRow: React.FC<EditableRowProps> = ({ ...props }) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
<tr {...omit(props, 'index')} />
</EditableContext.Provider>
</Form>
);

View File

@ -28,6 +28,7 @@ import {
import { currentReg, replaceTextByOldReg } from '../utils';
import classNames from 'classnames';
import { omit } from 'lodash';
import { pipe } from 'lodash/fp';
import styles from './index.less';
@ -247,11 +248,12 @@ const MarkdownContent = ({
'custom-typography': ({ children }: { children: string }) =>
renderReference(children),
code(props: any) {
const { children, className, node, ...rest } = props;
const { children, className, ...rest } = props;
const restProps = omit(rest, 'node');
const match = /language-(\w+)/.exec(className || '');
return match ? (
<SyntaxHighlighter
{...rest}
{...restProps}
PreTag="div"
language={match[1]}
wrapLongLines
@ -259,7 +261,10 @@ const MarkdownContent = ({
{String(children).replace(/\n$/, '')}
</SyntaxHighlighter>
) : (
<code {...rest} className={classNames(className, 'text-wrap')}>
<code
{...restProps}
className={classNames(className, 'text-wrap')}
>
{children}
</code>
);

View File

@ -26,7 +26,7 @@ export const useGetSharedChatSearchParams = () => {
const data = Object.fromEntries(
searchParams
.entries()
.filter(([key, value]) => key.startsWith(data_prefix))
.filter(([key]) => key.startsWith(data_prefix))
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
);
return {

View File

@ -19,7 +19,6 @@ import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
import { useFetchChunk } from '@/hooks/chunk-hooks';
import { IModalProps } from '@/interfaces/common';
import { IChunk } from '@/interfaces/database/knowledge';
import { Trash2 } from 'lucide-react';
import React, { useCallback, useEffect, useState } from 'react';
import { FieldValues, FormProvider, useForm } from 'react-hook-form';
@ -31,11 +30,6 @@ import {
} from '../../utils';
import { TagFeatureItem } from './tag-feature-item';
type FieldType = Pick<
IChunk,
'content_with_weight' | 'tag_kwd' | 'question_kwd' | 'important_kwd'
>;
interface kFProps {
doc_id: string;
chunkId: string | undefined;

View File

@ -36,7 +36,7 @@ const CSVFileViewer: React.FC<FileViewerProps> = () => {
const res = await request(url, {
method: 'GET',
responseType: 'blob',
onError: (err) => {
onError: () => {
message.error('file load failed');
setIsLoading(false);
},

View File

@ -1,13 +1,9 @@
import { useTestRetrieval } from '@/hooks/use-knowledge-request';
import { useCallback, useState } from 'react';
import { useState } from 'react';
import { TopTitle } from '../dataset-title';
import TestingForm from './testing-form';
import { TestingResult } from './testing-result';
function Vertical() {
return <div>xxx</div>;
}
export default function RetrievalTesting() {
const {
loading,
@ -21,15 +17,7 @@ export default function RetrievalTesting() {
filterValue,
} = useTestRetrieval();
const [count, setCount] = useState(1);
const addCount = useCallback(() => {
setCount(2);
}, []);
const removeCount = useCallback(() => {
setCount(1);
}, []);
const [count] = useState(1);
return (
<div className="p-5">

View File

@ -3,7 +3,7 @@ import {
KeywordIcon,
QWeatherIcon,
WikipediaIcon,
} from '@/assets/icon/Icon';
} from '@/assets/icon/next-icon';
import { ReactComponent as AkShareIcon } from '@/assets/svg/akshare.svg';
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';

View File

@ -1,4 +1,4 @@
import { CommaIcon, SemicolonIcon } from '@/assets/icon/Icon';
import { CommaIcon, SemicolonIcon } from '@/assets/icon/next-icon';
import { Form, Select } from 'antd';
import {
CornerDownLeft,

View File

@ -1,4 +1,3 @@
import { Edge } from '@xyflow/react';
import pick from 'lodash/pick';
import { useCallback, useEffect } from 'react';
import { IOperatorForm } from '../../interface';
@ -21,8 +20,8 @@ export const useBuildRelevantOptions = () => {
return buildRelevantOptions;
};
const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
edges.find((x) => x.sourceHandle === sourceHandle)?.target;
// const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
// edges.find((x) => x.sourceHandle === sourceHandle)?.target;
/**
* monitor changes in the connection and synchronize the target to the yes and no fields of the form
@ -30,7 +29,7 @@ const getTargetOfEdge = (edges: Edge[], sourceHandle: string) =>
* @param param0
*/
export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
const edges = useGraphStore((state) => state.edges);
// const edges = useGraphStore((state) => state.edges);
const getNode = useGraphStore((state) => state.getNode);
const node = getNode(nodeId);
@ -40,12 +39,12 @@ export const useWatchConnectionChanges = ({ nodeId, form }: IOperatorForm) => {
}
}, [node, form]);
const watchConnectionChanges = useCallback(() => {
const edgeList = edges.filter((x) => x.source === nodeId);
const yes = getTargetOfEdge(edgeList, 'yes');
const no = getTargetOfEdge(edgeList, 'no');
form?.setFieldsValue({ yes, no });
}, [edges, nodeId, form]);
// const watchConnectionChanges = useCallback(() => {
// const edgeList = edges.filter((x) => x.source === nodeId);
// const yes = getTargetOfEdge(edgeList, 'yes');
// const no = getTargetOfEdge(edgeList, 'no');
// form?.setFieldsValue({ yes, no });
// }, [edges, nodeId, form]);
useEffect(() => {
watchFormChanges();

View File

@ -50,10 +50,14 @@ export const useSaveGraphBeforeOpeningDebugDrawer = (show: () => void) => {
};
export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
console.log(
'🚀 ~ useWatchAgentChange ~ chatDrawerVisible:',
chatDrawerVisible,
);
const [time, setTime] = useState<string>();
const nodes = useGraphStore((state) => state.nodes);
const edges = useGraphStore((state) => state.edges);
const { saveGraph } = useSaveGraph();
// const { saveGraph } = useSaveGraph();
const { data: flowDetail } = useFetchFlow();
const setSaveTime = useCallback((updateTime: number) => {
@ -64,12 +68,12 @@ export const useWatchAgentChange = (chatDrawerVisible: boolean) => {
setSaveTime(flowDetail?.update_time);
}, [flowDetail, setSaveTime]);
const saveAgent = useCallback(async () => {
if (!chatDrawerVisible) {
const ret = await saveGraph();
setSaveTime(ret.data.update_time);
}
}, [chatDrawerVisible, saveGraph, setSaveTime]);
// const saveAgent = useCallback(async () => {
// if (!chatDrawerVisible) {
// const ret = await saveGraph();
// setSaveTime(ret.data.update_time);
// }
// }, [chatDrawerVisible, saveGraph, setSaveTime]);
useDebounceEffect(
() => {

View File

@ -11,6 +11,7 @@ export enum Step {
export const useSwitchStep = (step: Step) => {
const [_, setSearchParams] = useSearchParams();
console.log('🚀 ~ useSwitchStep ~ _:', _);
const switchStep = useCallback(() => {
setSearchParams(new URLSearchParams({ step: step.toString() }));
}, [setSearchParams, step]);

View File

@ -16,7 +16,7 @@ export const useGetSharedChatSearchParams = () => {
const data = Object.fromEntries(
searchParams
.entries()
.filter(([key, value]) => key.startsWith(data_prefix))
.filter(([key]) => key.startsWith(data_prefix))
.map(([key, value]) => [key.replace(data_prefix, ''), value]),
);
return {

View File

@ -116,8 +116,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
})();
}
}, [avatarFile]);
const { list: datasetListOrigin, loading: datasetLoading } =
useFetchKnowledgeList();
const { list: datasetListOrigin } = useFetchKnowledgeList();
useEffect(() => {
const datasetListMap = datasetListOrigin.map((item: IKnowledge) => {

View File

@ -30,7 +30,7 @@ type SearchFormValues = z.infer<typeof searchFormSchema>;
export default function SearchList() {
// const { data } = useFetchFlowList();
const { t } = useTranslate('search');
const { isLoading, isError, createSearch } = useCreateSearch();
const { isLoading, createSearch } = useCreateSearch();
const {
data: list,
searchParams,

View File

@ -24,7 +24,7 @@ export const useSendQuestion = (kbIds: string[]) => {
api.ask,
);
const { testChunk, loading } = useTestChunkRetrieval();
const { testChunkAll, loading: loadingAll } = useTestChunkAllRetrieval();
const { testChunkAll } = useTestChunkAllRetrieval();
const [sendingLoading, setSendingLoading] = useState(false);
const [currentAnswer, setCurrentAnswer] = useState({} as IAnswer);
const { fetchRelatedQuestions, data: relatedQuestions } =
@ -102,7 +102,14 @@ export const useSendQuestion = (kbIds: string[]) => {
size,
});
},
[sendingLoading, searchStr, kbIds, testChunk, selectedDocumentIds],
[
searchStr,
sendingLoading,
testChunk,
kbIds,
selectedDocumentIds,
testChunkAll,
],
);
useEffect(() => {

View File

@ -5,7 +5,7 @@ import {
PasswordIcon,
ProfileIcon,
TeamIcon,
} from '@/assets/icon/Icon';
} from '@/assets/icon/next-icon';
import { IconFont } from '@/components/icon-font';
import { LLMFactory } from '@/constants/llm';
import { UserSettingRouteKey } from '@/constants/setting';

View File

@ -1,5 +1,5 @@
import { translationTable } from '@/locales/config';
import TranslationTable from './TranslationTable';
import TranslationTable from './translation-table';
function UserSettingLocale() {
return (

View File

@ -46,7 +46,7 @@ const AzureOpenAIModal = ({
{ value: 'image2text', label: 'image2text' },
],
};
const getOptions = (factory: string) => {
const getOptions = () => {
return optionsMap.Default;
};
const handleKeyDown = async (e: React.KeyboardEvent) => {
@ -132,7 +132,7 @@ const AzureOpenAIModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -121,7 +121,7 @@ const BedrockModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -103,7 +103,7 @@ const FishAudioModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -110,7 +110,7 @@ const GoogleModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -114,7 +114,6 @@ export const useSubmitOllama = () => {
const [initialValues, setInitialValues] = useState<
Partial<IAddLlmRequestBody> | undefined
>();
const [originalModelName, setOriginalModelName] = useState<string>('');
const { addLlm, loading } = useAddLlm();
const {
visible: llmAddingVisible,

View File

@ -1,7 +1,7 @@
import { useTranslate } from '@/hooks/common-hooks';
import { IModalProps } from '@/interfaces/common';
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
import { Form, Input, Modal, Select } from 'antd';
import { Form, Input, Modal } from 'antd';
import omit from 'lodash/omit';
type FieldType = IAddLlmRequestBody & {
@ -10,8 +10,6 @@ type FieldType = IAddLlmRequestBody & {
hunyuan_sk: string;
};
const { Option } = Select;
const HunyuanModal = ({
visible,
hideModal,

View File

@ -34,7 +34,6 @@ import { CircleHelp } from 'lucide-react';
import { useCallback, useMemo } from 'react';
import SettingTitle from '../components/setting-title';
import { isLocalLlmFactory } from '../utils';
import TencentCloudModal from './Tencent-modal';
import ApiKeyModal from './api-key-modal';
import AzureOpenAIModal from './azure-openai-modal';
import BedrockModal from './bedrock-modal';
@ -58,6 +57,7 @@ import {
} from './hooks';
import HunyuanModal from './hunyuan-modal';
import styles from './index.less';
import TencentCloudModal from './next-tencent-modal';
import OllamaModal from './ollama-modal';
import SparkModal from './spark-modal';
import SystemModelSettingModal from './system-model-setting-modal';

View File

@ -140,7 +140,7 @@ const SparkModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -113,7 +113,7 @@ const VolcEngineModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -108,7 +108,7 @@ const YiyanModal = ({
type: 'number',
message: t('maxTokensInvalidMessage'),
},
({ getFieldValue }) => ({
({}) => ({
validator(_, value) {
if (value < 0) {
return Promise.reject(new Error(t('maxTokensMinMessage')));

View File

@ -4,7 +4,7 @@ import { registerNextServer } from '@/utils/register-server';
const {
getDialog,
setDialog,
listDialog,
// listDialog,
removeDialog,
getConversation,
getConversationSSE,

View File

@ -1,3 +1,4 @@
/* eslint-disable guard-for-in */
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import { isObject } from 'lodash';
import omit from 'lodash/omit';