diff --git a/web/.storybook/preview.tsx b/web/.storybook/preview.tsx index 49cd24e974..7a254bc79c 100644 --- a/web/.storybook/preview.tsx +++ b/web/.storybook/preview.tsx @@ -1,6 +1,6 @@ import React from 'react' import type { Preview } from '@storybook/react' -import { withThemeByDataAttribute } from '@storybook/addon-themes'; +import { withThemeByDataAttribute } from '@storybook/addon-themes' import I18nServer from '../app/components/i18n-server' import '../app/styles/globals.css' @@ -16,12 +16,12 @@ export const decorators = [ defaultTheme: 'light', attributeName: 'data-theme', }), - Story => { + (Story) => { return } - ]; + ] const preview: Preview = { parameters: { diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/develop/page.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/develop/page.tsx index 4101120703..a4ee3922d9 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/develop/page.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/develop/page.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { type Locale } from '@/i18n' +import type { Locale } from '@/i18n' import DevelopMain from '@/app/components/develop' export type IDevelopProps = { diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx index a58027bcd1..fe2f7dfa03 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx @@ -8,12 +8,11 @@ import { useBoolean } from 'ahooks' import { Cog8ToothIcon, // CommandLineIcon, - Squares2X2Icon, - // eslint-disable-next-line sort-imports - PuzzlePieceIcon, DocumentTextIcon, PaperClipIcon, + PuzzlePieceIcon, QuestionMarkCircleIcon, + Squares2X2Icon, } from '@heroicons/react/24/outline' import { Cog8ToothIcon as Cog8ToothSolidIcon, diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index d7bfe8534e..e282f6f98e 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -9,7 +9,7 @@ import ConfirmAddVar from './confirm-add-var' import s from './style.module.css' import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap' import cn from '@/utils/classnames' -import { type PromptVariable } from '@/models/debug' +import type { PromptVariable } from '@/models/debug' import Tooltip from '@/app/components/base/tooltip' import type { CompletionParams } from '@/types/app' import { AppType } from '@/types/app' diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index 12551f508e..0ae3f0af04 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -19,7 +19,7 @@ import AgentTools from './agent/agent-tools' import ConfigContext from '@/context/debug-configuration' import ConfigPrompt from '@/app/components/app/configuration/config-prompt' import ConfigVar from '@/app/components/app/configuration/config-var' -import { type CitationConfig, type ModelConfig, type ModerationConfig, type MoreLikeThisConfig, type PromptVariable, type SpeechToTextConfig, type SuggestedQuestionsAfterAnswerConfig, type TextToSpeechConfig } from '@/models/debug' +import type { CitationConfig, ModelConfig, ModerationConfig, MoreLikeThisConfig, PromptVariable, SpeechToTextConfig, SuggestedQuestionsAfterAnswerConfig, TextToSpeechConfig } from '@/models/debug' import type { AppType } from '@/types/app' import { ModelModeType } from '@/types/app' import { useModalContext } from '@/context/modal-context' @@ -134,11 +134,11 @@ const Config: FC = () => { annotation: annotationConfig.enabled, setAnnotation: async (value) => { if (value) { - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define setIsShowAnnotationConfigInit(true) } else { - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define await handleDisableAnnotation(annotationConfig.embedding_model) } }, diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 357dc84b7a..0557a3b082 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -55,7 +55,7 @@ import ModelParameterModal from '@/app/components/header/account-setting/model-p import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' import { fetchCollectionList } from '@/service/tools' -import { type Collection } from '@/app/components/tools/types' +import type { Collection } from '@/app/components/tools/types' import { useStore as useAppStore } from '@/app/components/app/store' import { getMultipleRetrievalConfig, @@ -142,7 +142,7 @@ const Configuration: FC = () => { const setCompletionParams = (value: FormValue) => { const params = { ...value } - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define if ((!params.stop || params.stop.length === 0) && (modeModeTypeRef.current === ModelModeType.completion)) { params.stop = getTempStop() setTempStop([]) @@ -331,7 +331,7 @@ const Configuration: FC = () => { const [canReturnToSimpleMode, setCanReturnToSimpleMode] = useState(true) const setPromptMode = async (mode: PromptMode) => { if (mode === PromptMode.advanced) { - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define await migrateToDefaultPrompt() setCanReturnToSimpleMode(true) } @@ -523,7 +523,6 @@ const Configuration: FC = () => { sensitive_word_avoidance: modelConfig.sensitive_word_avoidance, external_data_tools: modelConfig.external_data_tools, dataSets: datasets || [], - // eslint-disable-next-line multiline-ternary agentConfig: res.mode === 'agent-chat' ? { max_iteration: DEFAULT_AGENT_SETTING.max_iteration, ...modelConfig.agent_mode, diff --git a/web/app/components/app/overview/apikey-info-panel/progress/index.tsx b/web/app/components/app/overview/apikey-info-panel/progress/index.tsx index 3a4accbb43..cc8356e754 100644 --- a/web/app/components/app/overview/apikey-info-panel/progress/index.tsx +++ b/web/app/components/app/overview/apikey-info-panel/progress/index.tsx @@ -20,7 +20,7 @@ const Progress: FC = ({ className={cn(s.bar, exhausted && s['bar-error'], 'absolute top-0 left-0 right-0 bottom-0')} style={{ width: `${value}%` }} /> - {Array(10).fill(0).map((i, k) => ( + {Array.from({ length: 10 }).fill(0).map((i, k) => (
))}
diff --git a/web/app/components/base/audio-btn/audio.player.manager.ts b/web/app/components/base/audio-btn/audio.player.manager.ts index 17d92f8dc2..9b3349754f 100644 --- a/web/app/components/base/audio-btn/audio.player.manager.ts +++ b/web/app/components/base/audio-btn/audio.player.manager.ts @@ -1,6 +1,6 @@ import AudioPlayer from '@/app/components/base/audio-btn/audio' declare global { - // eslint-disable-next-line @typescript-eslint/consistent-type-definitions + // eslint-disable-next-line ts/consistent-type-definitions interface AudioPlayerManager { instance: AudioPlayerManager } @@ -12,6 +12,7 @@ export class AudioPlayerManager { private audioPlayers: AudioPlayer | null = null private msgId: string | undefined + // eslint-disable-next-line private constructor() { } diff --git a/web/app/components/base/audio-btn/audio.ts b/web/app/components/base/audio-btn/audio.ts index baf675d0be..d7fae02f82 100644 --- a/web/app/components/base/audio-btn/audio.ts +++ b/web/app/components/base/audio-btn/audio.ts @@ -2,7 +2,7 @@ import Toast from '@/app/components/base/toast' import { textToAudioStream } from '@/service/share' declare global { - // eslint-disable-next-line @typescript-eslint/consistent-type-definitions + // eslint-disable-next-line ts/consistent-type-definitions interface Window { ManagedMediaSource: any } diff --git a/web/app/components/base/audio-gallery/AudioPlayer.tsx b/web/app/components/base/audio-gallery/AudioPlayer.tsx index c482981e8a..95d4c69c83 100644 --- a/web/app/components/base/audio-gallery/AudioPlayer.tsx +++ b/web/app/components/base/audio-gallery/AudioPlayer.tsx @@ -55,7 +55,7 @@ const AudioPlayer: React.FC = ({ src }) => { audio.load() // Delayed generation of waveform data - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define const timer = setTimeout(() => generateWaveformData(src), 1000) return () => { diff --git a/web/app/components/base/auto-height-textarea/common.tsx b/web/app/components/base/auto-height-textarea/common.tsx index c71df04395..98ff0b7272 100644 --- a/web/app/components/base/auto-height-textarea/common.tsx +++ b/web/app/components/base/auto-height-textarea/common.tsx @@ -49,4 +49,6 @@ const AutoHeightTextarea = forwardRef, HTMLElement > } diff --git a/web/app/components/base/icons/IconBase.tsx b/web/app/components/base/icons/IconBase.tsx index 994cd98bcd..4de39e293c 100644 --- a/web/app/components/base/icons/IconBase.tsx +++ b/web/app/components/base/icons/IconBase.tsx @@ -28,4 +28,6 @@ const IconBase = forwardRef, IconBasePr }) }) +IconBase.displayName = 'IconBase' + export default IconBase diff --git a/web/app/components/base/markdown.tsx b/web/app/components/base/markdown.tsx index dbe4087882..9e758e8238 100644 --- a/web/app/components/base/markdown.tsx +++ b/web/app/components/base/markdown.tsx @@ -75,7 +75,6 @@ export function PreCode(props: { children: any }) { ) } -// eslint-disable-next-line unused-imports/no-unused-vars const useLazyLoad = (ref: RefObject): boolean => { const [isIntersecting, setIntersecting] = useState(false) @@ -297,11 +296,11 @@ export default class ErrorBoundary extends Component { } render() { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // eslint-disable-next-line ts/ban-ts-comment // @ts-expect-error if (this.state.hasError) return
Oops! An error occurred. This could be due to an ECharts runtime error or invalid SVG content.
(see the browser console for more information)
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // eslint-disable-next-line ts/ban-ts-comment // @ts-expect-error return this.props.children } diff --git a/web/app/components/base/mermaid/index.tsx b/web/app/components/base/mermaid/index.tsx index dc01338a8c..6642316488 100644 --- a/web/app/components/base/mermaid/index.tsx +++ b/web/app/components/base/mermaid/index.tsx @@ -44,7 +44,7 @@ const Flowchart = React.forwardRef((props: { const chartId = useRef(`flowchart_${CryptoJS.MD5(props.PrimitiveCode).toString()}`) const prevPrimitiveCode = usePrevious(props.PrimitiveCode) const [isLoading, setIsLoading] = useState(true) - const timeRef = useRef() + const timeRef = useRef() const [errMsg, setErrMsg] = useState('') const renderFlowchart = async (PrimitiveCode: string) => { @@ -74,15 +74,15 @@ const Flowchart = React.forwardRef((props: { return } if (timeRef.current) - clearTimeout(timeRef.current) + window.clearTimeout(timeRef.current) - timeRef.current = setTimeout(() => { + timeRef.current = window.setTimeout(() => { renderFlowchart(props.PrimitiveCode) }, 300) }, [props.PrimitiveCode]) return ( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // eslint-disable-next-line ts/ban-ts-comment // @ts-expect-error
{ @@ -108,4 +108,6 @@ const Flowchart = React.forwardRef((props: { ) }) +Flowchart.displayName = 'Flowchart' + export default Flowchart diff --git a/web/app/components/base/popover/index.tsx b/web/app/components/base/popover/index.tsx index 1e7ba76269..8dd20efd7c 100644 --- a/web/app/components/base/popover/index.tsx +++ b/web/app/components/base/popover/index.tsx @@ -34,15 +34,15 @@ export default function CustomPopover({ disabled = false, }: IPopover) { const buttonRef = useRef(null) - const timeOutRef = useRef(null) + const timeOutRef = useRef(null) const onMouseEnter = (isOpen: boolean) => { - timeOutRef.current && clearTimeout(timeOutRef.current) + timeOutRef.current && window.clearTimeout(timeOutRef.current) !isOpen && buttonRef.current?.click() } const onMouseLeave = (isOpen: boolean) => { - timeOutRef.current = setTimeout(() => { + timeOutRef.current = window.setTimeout(() => { isOpen && buttonRef.current?.click() }, timeoutDuration) } diff --git a/web/app/components/base/prompt-editor/plugins/custom-text/node.tsx b/web/app/components/base/prompt-editor/plugins/custom-text/node.tsx index 5df4894c6b..49f4a056db 100644 --- a/web/app/components/base/prompt-editor/plugins/custom-text/node.tsx +++ b/web/app/components/base/prompt-editor/plugins/custom-text/node.tsx @@ -1,4 +1,4 @@ -import type { EditorConfig, NodeKey, SerializedTextNode } from 'lexical' +import type { EditorConfig, SerializedTextNode } from 'lexical' import { $createTextNode, TextNode } from 'lexical' export class CustomTextNode extends TextNode { @@ -10,9 +10,9 @@ export class CustomTextNode extends TextNode { return new CustomTextNode(node.__text, node.__key) } - constructor(text: string, key?: NodeKey) { - super(text, key) - } + // constructor(text: string, key?: NodeKey) { + // super(text, key) + // } createDOM(config: EditorConfig) { const dom = super.createDOM(config) diff --git a/web/app/components/base/prompt-editor/plugins/variable-value-block/node.tsx b/web/app/components/base/prompt-editor/plugins/variable-value-block/node.tsx index 163d4bfac4..34487b257c 100644 --- a/web/app/components/base/prompt-editor/plugins/variable-value-block/node.tsx +++ b/web/app/components/base/prompt-editor/plugins/variable-value-block/node.tsx @@ -1,7 +1,6 @@ import type { EditorConfig, LexicalNode, - NodeKey, SerializedTextNode, } from 'lexical' import { @@ -18,9 +17,9 @@ export class VariableValueBlockNode extends TextNode { return new VariableValueBlockNode(node.__text, node.__key) } - constructor(text: string, key?: NodeKey) { - super(text, key) - } + // constructor(text: string, key?: NodeKey) { + // super(text, key) + // } createDOM(config: EditorConfig): HTMLElement { const element = super.createDOM(config) diff --git a/web/app/components/base/tag-management/index.tsx b/web/app/components/base/tag-management/index.tsx index 9a747910d2..5921d3da31 100644 --- a/web/app/components/base/tag-management/index.tsx +++ b/web/app/components/base/tag-management/index.tsx @@ -30,7 +30,7 @@ const TagManagementModal = ({ show, type }: TagManagementModalProps) => { setTagList(res) } - const [pending, setPending] = useState(false) + const [pending, setPending] = useState(false) const [name, setName] = useState('') const createNewTag = async () => { if (!name) diff --git a/web/app/components/base/tag-management/selector.tsx b/web/app/components/base/tag-management/selector.tsx index fd271a82e8..fca8ba1859 100644 --- a/web/app/components/base/tag-management/selector.tsx +++ b/web/app/components/base/tag-management/selector.tsx @@ -54,7 +54,7 @@ const Panel = (props: PanelProps) => { return tagList.filter(tag => tag.type === type && !value.includes(tag.id) && tag.name.includes(keywords)) }, [type, tagList, value, keywords]) - const [creating, setCreating] = useState(false) + const [creating, setCreating] = useState(false) const createNewTag = async () => { if (!keywords) return diff --git a/web/app/components/base/tag-management/tag-item-editor.tsx b/web/app/components/base/tag-management/tag-item-editor.tsx index 3735695302..0605f28cf6 100644 --- a/web/app/components/base/tag-management/tag-item-editor.tsx +++ b/web/app/components/base/tag-management/tag-item-editor.tsx @@ -78,7 +78,7 @@ const TagItemEditor: FC = ({ } } const [showRemoveModal, setShowRemoveModal] = useState(false) - const [pending, setPending] = useState(false) + const [pending, setPending] = useState(false) const removeTag = async (tagID: string) => { if (pending) return diff --git a/web/app/components/datasets/create/step-one/index.tsx b/web/app/components/datasets/create/step-one/index.tsx index 643932e9ae..7450e7f618 100644 --- a/web/app/components/datasets/create/step-one/index.tsx +++ b/web/app/components/datasets/create/step-one/index.tsx @@ -21,7 +21,7 @@ import VectorSpaceFull from '@/app/components/billing/vector-space-full' type IStepOneProps = { datasetId?: string dataSourceType?: DataSourceType - dataSourceTypeDisable: Boolean + dataSourceTypeDisable: boolean hasConnection: boolean onSetting: () => void files: FileItem[] diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 5d92e30deb..047caec78d 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -28,7 +28,7 @@ import Loading from '@/app/components/base/loading' import FloatRightContainer from '@/app/components/base/float-right-container' import RetrievalMethodConfig from '@/app/components/datasets/common/retrieval-method-config' import EconomicalRetrievalMethodConfig from '@/app/components/datasets/common/economical-retrieval-method-config' -import { type RetrievalConfig } from '@/types/app' +import type { RetrievalConfig } from '@/types/app' import { ensureRerankModelSelected, isReRankModelSelected } from '@/app/components/datasets/common/check-rerank-model' import Toast from '@/app/components/base/toast' import { formatNumber } from '@/utils/format' @@ -202,7 +202,7 @@ const StepTwo = ({ } const fetchFileIndexingEstimate = async (docForm = DocForm.TEXT, language?: string) => { - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define const res = await didFetchFileIndexingEstimate(getFileIndexingEstimateParams(docForm, language)!) if (segmentationType === SegmentType.CUSTOM) setCustomFileIndexingEstimate(res) @@ -344,7 +344,7 @@ const StepTwo = ({ doc_form: docForm, doc_language: docLanguage, process_rule: getProcessRule(), - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define retrieval_model: retrievalConfig, // Readonly. If want to changed, just go to settings page. embedding_model: embeddingModel.model, // Readonly embedding_model_provider: embeddingModel.provider, // Readonly @@ -357,7 +357,7 @@ const StepTwo = ({ rerankDefaultModel, isRerankDefaultModelValid: !!isRerankDefaultModelValid, rerankModelList, - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define retrievalConfig, indexMethod: indexMethod as string, }) @@ -367,7 +367,7 @@ const StepTwo = ({ } const postRetrievalConfig = ensureRerankModelSelected({ rerankDefaultModel: rerankDefaultModel!, - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define retrievalConfig, indexMethod: indexMethod as string, }) diff --git a/web/app/components/datasets/external-api/external-api-modal/Form.tsx b/web/app/components/datasets/external-api/external-api-modal/Form.tsx index ada01493fe..824b5e6c9e 100644 --- a/web/app/components/datasets/external-api/external-api-modal/Form.tsx +++ b/web/app/components/datasets/external-api/external-api-modal/Form.tsx @@ -87,4 +87,6 @@ const Form: FC = React.memo(({ ) }) +Form.displayName = 'Form' + export default Form diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx index fa8c8de62e..4039873080 100644 --- a/web/app/components/datasets/settings/form/index.tsx +++ b/web/app/components/datasets/settings/form/index.tsx @@ -18,7 +18,7 @@ import { ApiConnectionMod } from '@/app/components/base/icons/src/vender/solid/d import { updateDatasetSetting } from '@/service/datasets' import type { DataSetListResponse } from '@/models/datasets' import DatasetDetailContext from '@/context/dataset-detail' -import { type RetrievalConfig } from '@/types/app' +import type { RetrievalConfig } from '@/types/app' import { useAppContext } from '@/context/app-context' import { ensureRerankModelSelected, isReRankModelSelected } from '@/app/components/datasets/common/check-rerank-model' import ModelSelector from '@/app/components/header/account-setting/model-provider-page/model-selector' diff --git a/web/app/components/header/app-nav/index.tsx b/web/app/components/header/app-nav/index.tsx index d4dd9e3ffd..3ac57926e9 100644 --- a/web/app/components/header/app-nav/index.tsx +++ b/web/app/components/header/app-nav/index.tsx @@ -11,7 +11,7 @@ import { RiRobot2Line, } from '@remixicon/react' import Nav from '../nav' -import { type NavItem } from '../nav/nav-selector' +import type { NavItem } from '../nav/nav-selector' import { fetchAppList } from '@/service/apps' import CreateAppTemplateDialog from '@/app/components/app/create-app-dialog' import CreateAppModal from '@/app/components/app/create-app-modal' diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx index a2f6864242..61927e3ff3 100644 --- a/web/app/components/share/text-generation/index.tsx +++ b/web/app/components/share/text-generation/index.tsx @@ -132,9 +132,9 @@ const TextGeneration: FC = ({ const handleSend = () => { setIsCallBatchAPI(false) setControlSend(Date.now()) - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define setAllTaskList([]) // clear batch task running status - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define showResSidebar() } @@ -314,7 +314,7 @@ const TextGeneration: FC = ({ setControlSend(Date.now()) // clear run once task status setControlStopResponding(Date.now()) - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define showResSidebar() } const handleCompleted = (completionRes: string, taskId?: number, isSuccess?: boolean) => { diff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsx index 54751a384a..efd01255cf 100644 --- a/web/app/components/tools/workflow-tool/index.tsx +++ b/web/app/components/tools/workflow-tool/index.tsx @@ -37,7 +37,7 @@ const WorkflowToolAsModal: FC = ({ }) => { const { t } = useTranslation() - const [showEmojiPicker, setShowEmojiPicker] = useState(false) + const [showEmojiPicker, setShowEmojiPicker] = useState(false) const [emoji, setEmoji] = useState(payload.icon) const [label, setLabel] = useState(payload.label) const [name, setName] = useState(payload.name) diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index 89ba4e5cf9..dacd16f735 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -582,7 +582,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => { break } case BlockEnum.LLM: { - const payload = (data as LLMNodeType) + const payload = data as LLMNodeType const isChatModel = payload.model?.mode === 'chat' let prompts: string[] = [] if (isChatModel) { @@ -620,19 +620,19 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => { break } case BlockEnum.QuestionClassifier: { - const payload = (data as QuestionClassifierNodeType) + const payload = data as QuestionClassifierNodeType res = [payload.query_variable_selector] const varInInstructions = matchNotSystemVars([payload.instruction || '']) res.push(...varInInstructions) break } case BlockEnum.HttpRequest: { - const payload = (data as HttpNodeType) + const payload = data as HttpNodeType res = matchNotSystemVars([payload.url, payload.headers, payload.params, payload.body.data]) break } case BlockEnum.Tool: { - const payload = (data as ToolNodeType) + const payload = data as ToolNodeType const mixVars = matchNotSystemVars(Object.keys(payload.tool_parameters)?.filter(key => payload.tool_parameters[key].type === ToolVarType.mixed).map(key => payload.tool_parameters[key].value) as string[]) const vars = Object.keys(payload.tool_parameters).filter(key => payload.tool_parameters[key].type === ToolVarType.variable).map(key => payload.tool_parameters[key].value as string) || [] res = [...(mixVars as ValueSelector[]), ...(vars as any)] @@ -650,7 +650,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => { } case BlockEnum.ParameterExtractor: { - const payload = (data as ParameterExtractorNodeType) + const payload = data as ParameterExtractorNodeType res = [payload.query] const varInInstructions = matchNotSystemVars([payload.instruction || '']) res.push(...varInInstructions) @@ -672,7 +672,7 @@ export const getNodeUsedVarPassToServerKey = (node: Node, valueSelector: ValueSe let res: string | string[] = '' switch (type) { case BlockEnum.LLM: { - const payload = (data as LLMNodeType) + const payload = data as LLMNodeType res = [`#${valueSelector.join('.')}#`] if (payload.context?.variable_selector.join('.') === valueSelector.join('.')) res.push('#context#') diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx index fdd37d0518..43424aa936 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx @@ -127,7 +127,7 @@ const Item: FC = ({ zIndex: 100, }}> {isObj && ( - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define = { [BlockEnum.LLM]: checkLLMValid, [BlockEnum.KnowledgeRetrieval]: checkKnowledgeRetrievalValid, diff --git a/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts b/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts index c7bce2ef07..f0cb80bbc4 100644 --- a/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts +++ b/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts @@ -1,7 +1,7 @@ import { useCallback, useState } from 'react' import produce from 'immer' import { useBoolean } from 'ahooks' -import { type OutputVar } from '../../code/types' +import type { OutputVar } from '../../code/types' import type { ValueSelector } from '@/app/components/workflow/types' import { VarType } from '@/app/components/workflow/types' import { diff --git a/web/app/components/workflow/nodes/assigner/node.tsx b/web/app/components/workflow/nodes/assigner/node.tsx index 72745a488a..e95c1dcc27 100644 --- a/web/app/components/workflow/nodes/assigner/node.tsx +++ b/web/app/components/workflow/nodes/assigner/node.tsx @@ -3,7 +3,7 @@ import React from 'react' import { useNodes } from 'reactflow' import { useTranslation } from 'react-i18next' import NodeVariableItem from '../variable-assigner/components/node-variable-item' -import { type AssignerNodeType } from './types' +import type { AssignerNodeType } from './types' import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' import { BlockEnum, type Node, type NodeProps } from '@/app/components/workflow/types' diff --git a/web/app/components/workflow/nodes/assigner/panel.tsx b/web/app/components/workflow/nodes/assigner/panel.tsx index ff5a6420f3..213f9a05e7 100644 --- a/web/app/components/workflow/nodes/assigner/panel.tsx +++ b/web/app/components/workflow/nodes/assigner/panel.tsx @@ -8,7 +8,7 @@ import useConfig from './use-config' import { WriteMode } from './types' import type { AssignerNodeType } from './types' import Field from '@/app/components/workflow/nodes/_base/components/field' -import { type NodePanelProps } from '@/app/components/workflow/types' +import type { NodePanelProps } from '@/app/components/workflow/types' import cn from '@/utils/classnames' const i18nPrefix = 'workflow.nodes.assigner' diff --git a/web/app/components/workflow/nodes/end/default.ts b/web/app/components/workflow/nodes/end/default.ts index ceeda5b43b..d144a079cf 100644 --- a/web/app/components/workflow/nodes/end/default.ts +++ b/web/app/components/workflow/nodes/end/default.ts @@ -1,6 +1,6 @@ import { BlockEnum } from '../../types' import type { NodeDefault } from '../../types' -import { type EndNodeType } from './types' +import type { EndNodeType } from './types' import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/constants' const nodeDefault: NodeDefault = { diff --git a/web/app/components/workflow/nodes/end/panel.tsx b/web/app/components/workflow/nodes/end/panel.tsx index a74ba51b6d..fc5e498d13 100644 --- a/web/app/components/workflow/nodes/end/panel.tsx +++ b/web/app/components/workflow/nodes/end/panel.tsx @@ -1,4 +1,4 @@ -import { type FC } from 'react' +import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import useConfig from './use-config' @@ -6,7 +6,7 @@ import type { EndNodeType } from './types' import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list' import Field from '@/app/components/workflow/nodes/_base/components/field' import AddButton from '@/app/components/base/button/add-button' -import { type NodePanelProps } from '@/app/components/workflow/types' +import type { NodePanelProps } from '@/app/components/workflow/types' const i18nPrefix = 'workflow.nodes.end' diff --git a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx index 6e8f4eac3b..3b8306199a 100644 --- a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx +++ b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx @@ -54,7 +54,7 @@ const EditBody: FC = ({ type: newType, data: '', }) - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define setBody([]) // eslint-disable-next-line react-hooks/exhaustive-deps }, [onChange]) diff --git a/web/app/components/workflow/nodes/tool/use-config.ts b/web/app/components/workflow/nodes/tool/use-config.ts index df8ad47985..2d603c99e5 100644 --- a/web/app/components/workflow/nodes/tool/use-config.ts +++ b/web/app/components/workflow/nodes/tool/use-config.ts @@ -162,7 +162,7 @@ const useConfig = (id: string, payload: ToolNodeType) => { const [inputVarValues, doSetInputVarValues] = useState>({}) const setInputVarValues = (value: Record) => { doSetInputVarValues(value) - // eslint-disable-next-line @typescript-eslint/no-use-before-define + // eslint-disable-next-line ts/no-use-before-define setRunInputData(value) } // fill single run form variable with constant value first time diff --git a/web/app/components/workflow/nodes/variable-assigner/panel.tsx b/web/app/components/workflow/nodes/variable-assigner/panel.tsx index 6152e0f5b8..b25e2656ed 100644 --- a/web/app/components/workflow/nodes/variable-assigner/panel.tsx +++ b/web/app/components/workflow/nodes/variable-assigner/panel.tsx @@ -7,7 +7,7 @@ import useConfig from './use-config' import type { VariableAssignerNodeType } from './types' import VarGroupItem from './components/var-group-item' import cn from '@/utils/classnames' -import { type NodePanelProps } from '@/app/components/workflow/types' +import type { NodePanelProps } from '@/app/components/workflow/types' import Split from '@/app/components/workflow/nodes/_base/components/split' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import Switch from '@/app/components/base/switch' diff --git a/web/app/signin/_header.tsx b/web/app/signin/_header.tsx index a9479a3fe4..9d03f18ac4 100644 --- a/web/app/signin/_header.tsx +++ b/web/app/signin/_header.tsx @@ -3,7 +3,7 @@ import React from 'react' import { useContext } from 'use-context-selector' import Select from '@/app/components/base/select/locale' import { languages } from '@/i18n/language' -import { type Locale } from '@/i18n' +import type { Locale } from '@/i18n' import I18n from '@/context/i18n' import LogoSite from '@/app/components/base/logo/logo-site' diff --git a/web/context/modal-context.tsx b/web/context/modal-context.tsx index 727268a29a..813f811a28 100644 --- a/web/context/modal-context.tsx +++ b/web/context/modal-context.tsx @@ -78,7 +78,6 @@ export const useModalContext = () => useContext(ModalContext) // Adding a dangling comma to avoid the generic parsing issue in tsx, see: // https://github.com/microsoft/TypeScript/issues/15713 -// eslint-disable-next-line @typescript-eslint/comma-dangle export const useModalContextSelector = (selector: (state: ModalContextState) => T): T => useContextSelector(ModalContext, selector) diff --git a/web/context/provider-context.tsx b/web/context/provider-context.tsx index 75747ba79c..814792ef0e 100644 --- a/web/context/provider-context.tsx +++ b/web/context/provider-context.tsx @@ -70,7 +70,6 @@ export const useProviderContext = () => useContext(ProviderContext) // Adding a dangling comma to avoid the generic parsing issue in tsx, see: // https://github.com/microsoft/TypeScript/issues/15713 -// eslint-disable-next-line @typescript-eslint/comma-dangle export const useProviderContextSelector = (selector: (state: ProviderContextState) => T): T => useContextSelector(ProviderContext, selector) diff --git a/web/i18n/hi-IN/share-app.ts b/web/i18n/hi-IN/share-app.ts index a5c7816fe2..74c23f8fda 100644 --- a/web/i18n/hi-IN/share-app.ts +++ b/web/i18n/hi-IN/share-app.ts @@ -3,6 +3,8 @@ const translation = { welcome: 'आपका स्वागत है', appUnavailable: 'ऐप उपलब्ध नहीं है', appUnknownError: 'अज्ञात त्रुटि, कृपया पुनः प्रयास करें', + // @ts-expect-error TODO: fix this + // eslint-disable-next-line no-dupe-keys appUnknownError: 'ऐप अनुपलब्ध है', }, chat: { diff --git a/web/service/base.ts b/web/service/base.ts index fbdd5c1fd3..f43a23df52 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -559,7 +559,8 @@ export const ssePost = ( } onData?.(str, isFirstMessage, moreInfo) }, onCompleted, onThought, onMessageEnd, onMessageReplace, onFile, onWorkflowStarted, onWorkflowFinished, onNodeStarted, onNodeFinished, onIterationStart, onIterationNext, onIterationFinish, onParallelBranchStarted, onParallelBranchFinished, onTextChunk, onTTSChunk, onTTSEnd, onTextReplace) - }).catch((e) => { + }) + .catch((e) => { if (e.toString() !== 'AbortError: The user aborted a request.' && !e.toString().errorMessage.includes('TypeError: Cannot assign to read only property')) Toast.notify({ type: 'error', message: e }) onError?.(e)