diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx index f1b20dd8d8..167520ca7b 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx @@ -1,8 +1,6 @@ import React from 'react' -type Props = {} - -const page = (props: Props) => { +const page = () => { return (
dataset detail api
) diff --git a/web/app/(commonLayout)/datasets/DatasetCard.tsx b/web/app/(commonLayout)/datasets/DatasetCard.tsx index 9cafa341f2..e0012b4956 100644 --- a/web/app/(commonLayout)/datasets/DatasetCard.tsx +++ b/web/app/(commonLayout)/datasets/DatasetCard.tsx @@ -61,7 +61,7 @@ const DatasetCard = ({ if (onSuccess) onSuccess() } - catch (e: any) { + catch { } setShowConfirmDelete(false) }, [dataset.id, notify, onSuccess, t]) diff --git a/web/app/components/app-sidebar/app-info.tsx b/web/app/components/app-sidebar/app-info.tsx index 93f749a565..18a9ac8bc8 100644 --- a/web/app/components/app-sidebar/app-info.tsx +++ b/web/app/components/app-sidebar/app-info.tsx @@ -85,7 +85,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { setAppDetail(app) mutateApps() } - catch (e) { + catch { notify({ type: 'error', message: t('app.editFailed') }) } }, [appDetail, mutateApps, notify, setAppDetail, t]) @@ -112,7 +112,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { onPlanInfoChanged() getRedirection(true, newApp, replace) } - catch (e) { + catch { notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } } @@ -131,7 +131,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { a.download = `${appDetail.name}.yml` a.click() } - catch (e) { + catch { notify({ type: 'error', message: t('app.exportFailed') }) } } @@ -152,7 +152,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { } setSecretEnvList(list) } - catch (e) { + catch { notify({ type: 'error', message: t('app.exportFailed') }) } } @@ -175,7 +175,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { }) } setShowConfirmDelete(false) - }, [appDetail, mutateApps, notify, onPlanInfoChanged, replace, t]) + }, [appDetail, mutateApps, notify, onPlanInfoChanged, replace, setAppDetail, t]) const { isCurrentWorkspaceEditor } = useAppContext() diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx index fb16df0d85..274a57adf1 100644 --- a/web/app/components/app/annotation/add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx @@ -56,7 +56,7 @@ const AddAnnotationModal: FC = ({ try { await onAdd(payload) } - catch (e) { + catch { } setIsSaving(false) diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index d50ccde54d..f010f5f8b1 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -90,7 +90,7 @@ const Annotation: FC = ({ setList(data as AnnotationItem[]) setTotal(total) } - catch (e) { + catch { } setIsLoading(false) diff --git a/web/app/components/app/annotation/view-annotation-modal/index.tsx b/web/app/components/app/annotation/view-annotation-modal/index.tsx index 3e558bffb9..08904d23d4 100644 --- a/web/app/components/app/annotation/view-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx @@ -55,7 +55,7 @@ const ViewAnnotationModal: FC = ({ setHitHistoryList(data as HitHistoryItem[]) setTotal(total) } - catch (e) { + catch { } } diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx index b63b7c75b8..30125a12d1 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx @@ -88,7 +88,7 @@ const SettingBuiltInTool: FC = ({ setTempSetting(addDefaultValue(setting, formSchemas)) } } - catch (e) { } + catch { } setIsLoading(false) })() }, [collection?.name, collection?.id, collection?.type]) diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx index 05290a32cc..90885dacc8 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx @@ -150,7 +150,7 @@ const SettingsModal: FC = ({ retrieval_model_dict: retrievalConfig, }) } - catch (e) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) } finally { diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx index 8b4b0cdbad..702a07397d 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.tsx @@ -153,7 +153,7 @@ const Apps = ({ localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) } - catch (e) { + catch { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } } diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx index 51a57cba93..a8a7f0db2a 100644 --- a/web/app/components/app/create-app-modal/index.tsx +++ b/web/app/components/app/create-app-modal/index.tsx @@ -90,7 +90,7 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate }: CreateAppProps) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') getRedirection(isCurrentWorkspaceEditor, app, push) } - catch (e) { + catch { notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } isCreatingRef.current = false @@ -287,7 +287,6 @@ type AppTypeCardProps = { onClick: () => void } function AppTypeCard({ icon, title, description, active, onClick }: AppTypeCardProps) { - const { t } = useTranslation() return
= ({ { value: PageType.log, text: t('appLog.title') }, { value: PageType.annotation, text: t('appAnnotation.title') }, ] - }, [appDetail]) + }, [appDetail?.mode, t]) if (!appDetail) { return ( diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index c4e46af107..b78af5cdba 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -547,7 +547,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } @@ -560,7 +560,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } @@ -591,7 +591,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string } notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } @@ -603,7 +603,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string } notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) return true } - catch (err) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) return false } diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx index e2bab94b59..f1654eb65e 100644 --- a/web/app/components/app/switch-app-modal/index.tsx +++ b/web/app/components/app/switch-app-modal/index.tsx @@ -82,7 +82,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo removeOriginal ? replace : push, ) } - catch (e) { + catch { notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } } 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 15be7a3d8c..86eb377a6d 100644 --- a/web/app/components/base/audio-btn/audio.player.manager.ts +++ b/web/app/components/base/audio-btn/audio.player.manager.ts @@ -33,7 +33,7 @@ export class AudioPlayerManager { this.audioPlayers.cacheBuffers = [] this.audioPlayers.sourceBuffer?.abort() } - catch (e) { + catch { } } diff --git a/web/app/components/base/audio-btn/audio.ts b/web/app/components/base/audio-btn/audio.ts index cd40930f43..00797d04e4 100644 --- a/web/app/components/base/audio-btn/audio.ts +++ b/web/app/components/base/audio-btn/audio.ts @@ -125,7 +125,7 @@ export default class AudioPlayer { this.receiveAudioData(value) } } - catch (error) { + catch { this.isLoadData = false this.callback && this.callback('error') } diff --git a/web/app/components/base/audio-gallery/AudioPlayer.tsx b/web/app/components/base/audio-gallery/AudioPlayer.tsx index c757863fa9..67ded638a1 100644 --- a/web/app/components/base/audio-gallery/AudioPlayer.tsx +++ b/web/app/components/base/audio-gallery/AudioPlayer.tsx @@ -124,7 +124,7 @@ const AudioPlayer: React.FC = ({ src }) => { setWaveformData(normalizedWaveform) setIsAudioAvailable(true) } - catch (error) { + catch { const waveform: number[] = [] let prevValue = Math.random() diff --git a/web/app/components/base/chat/chat/thought/index.tsx b/web/app/components/base/chat/chat/thought/index.tsx index 409f83dfaa..36f7e65b75 100644 --- a/web/app/components/base/chat/chat/thought/index.tsx +++ b/web/app/components/base/chat/chat/thought/index.tsx @@ -14,7 +14,7 @@ function getValue(value: string, isValueArray: boolean, index: number) { try { return JSON.parse(value)[index] } - catch (e) { + catch { } } return value @@ -29,7 +29,7 @@ const Thought: FC = ({ if (Array.isArray(JSON.parse(thought.tool))) return [JSON.parse(thought.tool), true] } - catch (e) { + catch { } return [[thought.tool], false] })() diff --git a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx index 12bf53e5e2..afdf608201 100644 --- a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx +++ b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx @@ -138,16 +138,7 @@ const ChatWrapper = () => { isPublicAPI: !isInstalledApp, }, ) - }, [ - chatList, - handleNewConversationCompleted, - handleSend, - currentConversationId, - currentConversationItem, - newConversationInputs, - isInstalledApp, - appId, - ]) + }, [currentConversationId, currentConversationInputs, newConversationInputs, chatList, handleSend, isInstalledApp, appId, handleNewConversationCompleted]) const doRegenerate = useCallback((chatItem: ChatItemInTree) => { const question = chatList.find(item => item.id === chatItem.parentMessageId)! diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx index a26db14416..1a9a84ed92 100644 --- a/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx +++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx @@ -24,7 +24,6 @@ const InputsFormContent = ({ showTip }: Props) => { handleNewConversationInputsChange, } = useEmbeddedChatbotContext() const inputsFormValue = currentConversationId ? currentConversationInputs : newConversationInputs - const readonly = !!currentConversationId const handleFormChange = useCallback((variable: string, value: any) => { setCurrentConversationInputs({ diff --git a/web/app/components/base/markdown.tsx b/web/app/components/base/markdown.tsx index 987a4d0c14..24ae59af73 100644 --- a/web/app/components/base/markdown.tsx +++ b/web/app/components/base/markdown.tsx @@ -128,7 +128,7 @@ const CodeBlock: any = memo(({ inline, className, children, ...props }: any) => try { return JSON.parse(String(children).replace(/\n$/, '')) } - catch (error) { } + catch { } } return JSON.parse('{"title":{"text":"ECharts error - Wrong JSON format."}}') }, [language, children]) diff --git a/web/app/components/base/svg-gallery/index.tsx b/web/app/components/base/svg-gallery/index.tsx index 5fe8d7946a..94fc82c740 100644 --- a/web/app/components/base/svg-gallery/index.tsx +++ b/web/app/components/base/svg-gallery/index.tsx @@ -51,7 +51,7 @@ export const SVGRenderer = ({ content }: { content: string }) => { setImagePreview(svgToDataURL(svgElement as Element)) }) } - catch (error) { + catch { if (svgRef.current) svgRef.current.innerHTML = 'Error rendering SVG. Wait for the image content to complete.' } diff --git a/web/app/components/base/tag-management/index.tsx b/web/app/components/base/tag-management/index.tsx index 9c21fb9369..d3c509bdb1 100644 --- a/web/app/components/base/tag-management/index.tsx +++ b/web/app/components/base/tag-management/index.tsx @@ -48,7 +48,7 @@ const TagManagementModal = ({ show, type }: TagManagementModalProps) => { setName('') setPending(false) } - catch (e: any) { + catch { notify({ type: 'error', message: t('common.tag.failed') }) setPending(false) } diff --git a/web/app/components/base/tag-management/selector.tsx b/web/app/components/base/tag-management/selector.tsx index 038f0daf54..2678be2f17 100644 --- a/web/app/components/base/tag-management/selector.tsx +++ b/web/app/components/base/tag-management/selector.tsx @@ -73,7 +73,7 @@ const Panel = (props: PanelProps) => { setCreating(false) onCreate() } - catch (e: any) { + catch { notify({ type: 'error', message: t('common.tag.failed') }) setCreating(false) } @@ -83,7 +83,7 @@ const Panel = (props: PanelProps) => { await bindTag(tagIDs, targetID, type) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) } - catch (e: any) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) } } @@ -92,7 +92,7 @@ const Panel = (props: PanelProps) => { await unBindTag(tagID, targetID, type) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) } - catch (e: any) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) } } 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 88902b2c88..3264979955 100644 --- a/web/app/components/base/tag-management/tag-item-editor.tsx +++ b/web/app/components/base/tag-management/tag-item-editor.tsx @@ -59,7 +59,7 @@ const TagItemEditor: FC = ({ notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) setName(name) } - catch (e: any) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) setName(tag.name) const recoverList = tagList.map((tag) => { @@ -92,7 +92,7 @@ const TagItemEditor: FC = ({ ]) setPending(false) } - catch (e: any) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) setPending(false) } diff --git a/web/app/components/base/voice-input/index.tsx b/web/app/components/base/voice-input/index.tsx index 6a94cd722a..5a5400ad30 100644 --- a/web/app/components/base/voice-input/index.tsx +++ b/web/app/components/base/voice-input/index.tsx @@ -111,7 +111,7 @@ const VoiceInput = ({ onConverted(audioResponse.text) onCancel() } - catch (e) { + catch { onConverted('') onCancel() } @@ -125,7 +125,7 @@ const VoiceInput = ({ if (canvasRef.current && ctxRef.current) drawRecord() } - catch (e) { + catch { onCancel() } } diff --git a/web/app/components/browser-initor.tsx b/web/app/components/browser-initor.tsx index 5117d3490d..f2f4b02dc0 100644 --- a/web/app/components/browser-initor.tsx +++ b/web/app/components/browser-initor.tsx @@ -30,7 +30,7 @@ try { localStorage = globalThis.localStorage sessionStorage = globalThis.sessionStorage } -catch (e) { +catch { localStorage = new StorageMock() sessionStorage = new StorageMock() } diff --git a/web/app/components/datasets/api/index.tsx b/web/app/components/datasets/api/index.tsx index e5c5f7f182..3ca84c3e11 100644 --- a/web/app/components/datasets/api/index.tsx +++ b/web/app/components/datasets/api/index.tsx @@ -1,8 +1,6 @@ import React from 'react' -type Props = {} - -const index = (props: Props) => { +const index = () => { return (
index
) diff --git a/web/app/components/datasets/create/embedding-process/index.tsx b/web/app/components/datasets/create/embedding-process/index.tsx index 9c8ff09c80..2890670de3 100644 --- a/web/app/components/datasets/create/embedding-process/index.tsx +++ b/web/app/components/datasets/create/embedding-process/index.tsx @@ -184,7 +184,7 @@ const EmbeddingProcess: FC = ({ datasetId, batchId, documents = [], index await sleep(2500) await startQueryStatus() } - catch (e) { + catch { await sleep(2500) await startQueryStatus() } diff --git a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx index 3a6a57440e..f9a3584f7f 100644 --- a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx +++ b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx @@ -40,7 +40,7 @@ const EmptyDatasetCreationModal = ({ onHide() router.push(`/datasets/${dataset.id}/documents`) } - catch (err) { + catch { notify({ type: 'error', message: t('datasetCreation.stepOne.modal.failed') }) } } diff --git a/web/app/components/datasets/create/website/jina-reader/index.tsx b/web/app/components/datasets/create/website/jina-reader/index.tsx index 21203ab1ad..2ab0444586 100644 --- a/web/app/components/datasets/create/website/jina-reader/index.tsx +++ b/web/app/components/datasets/create/website/jina-reader/index.tsx @@ -130,7 +130,7 @@ const JinaReader: FC = ({ }, } } - }, [crawlOptions.limit]) + }, [crawlOptions.limit, onCheckedCrawlResultChange]) const handleRun = useCallback(async (url: string) => { const { isValid, errorMsg } = checkValid(url) @@ -186,7 +186,7 @@ const JinaReader: FC = ({ finally { setStep(Step.finished) } - }, [checkValid, crawlOptions, onJobIdChange, t, waitForCrawlFinished]) + }, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, t, waitForCrawlFinished]) return (
diff --git a/web/app/components/datasets/documents/detail/embedding/index.tsx b/web/app/components/datasets/documents/detail/embedding/index.tsx index ef6e4ce0c3..a7d1d08ed7 100644 --- a/web/app/components/datasets/documents/detail/embedding/index.tsx +++ b/web/app/components/datasets/documents/detail/embedding/index.tsx @@ -193,7 +193,7 @@ const EmbeddingDetail: FC = ({ await sleep(2500) await startQueryStatus() } - catch (e) { + catch { await sleep(2500) await startQueryStatus() } diff --git a/web/app/components/datasets/documents/detail/index.tsx b/web/app/components/datasets/documents/detail/index.tsx index 341233fea6..cba1590fa9 100644 --- a/web/app/components/datasets/documents/detail/index.tsx +++ b/web/app/components/datasets/documents/detail/index.tsx @@ -135,7 +135,7 @@ const DocumentDetail: FC = ({ datasetId, documentId }) => { params: { metadata: 'without' }, }) - const { data: documentMetadata, error: metadataErr, refetch: metadataMutate } = useDocumentMetadata({ + const { data: documentMetadata } = useDocumentMetadata({ datasetId, documentId, params: { metadata: 'only' }, @@ -146,7 +146,6 @@ const DocumentDetail: FC = ({ datasetId, documentId }) => { } const isDetailLoading = !documentDetail && !error - const isMetadataLoading = !documentMetadata && !metadataErr const embedding = ['queuing', 'indexing', 'paused'].includes((documentDetail?.display_status || '').toLowerCase()) diff --git a/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx b/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx index 86277364b1..3ccd638ccc 100644 --- a/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx +++ b/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx @@ -14,7 +14,7 @@ const ChildChunks: FC = ({ payload, isShowAll, }) => { - const { id, score, content, position } = payload + const { score, content, position } = payload return (
{ mutate(unstable_serialize(getKey)) } } - catch (e) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) } finally { diff --git a/web/app/components/explore/app-list/index.tsx b/web/app/components/explore/app-list/index.tsx index 50cc6c00af..e217dda2b2 100644 --- a/web/app/components/explore/app-list/index.tsx +++ b/web/app/components/explore/app-list/index.tsx @@ -148,7 +148,7 @@ const Apps = ({ localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) } - catch (e) { + catch { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) } } diff --git a/web/app/components/header/account-about/index.tsx b/web/app/components/header/account-about/index.tsx index a9d08279b8..16dd63ea7a 100644 --- a/web/app/components/header/account-about/index.tsx +++ b/web/app/components/header/account-about/index.tsx @@ -14,10 +14,7 @@ type IAccountSettingProps = { langeniusVersionInfo: LangGeniusVersionResponse onCancel: () => void } -const buttonClassName = ` -shrink-0 flex items-center h-8 px-3 rounded-lg border border-gray-200 -text-xs text-gray-800 font-medium -` + export default function AccountAbout({ langeniusVersionInfo, onCancel, diff --git a/web/app/components/header/account-dropdown/workplace-selector/index.tsx b/web/app/components/header/account-dropdown/workplace-selector/index.tsx index 643df5b57c..f604fddd8d 100644 --- a/web/app/components/header/account-dropdown/workplace-selector/index.tsx +++ b/web/app/components/header/account-dropdown/workplace-selector/index.tsx @@ -24,7 +24,7 @@ const WorkplaceSelector = () => { notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) location.assign(`${location.origin}`) } - catch (e) { + catch { notify({ type: 'error', message: t('common.provider.saveFailed') }) } } diff --git a/web/app/components/header/account-setting/data-source-page/index.tsx b/web/app/components/header/account-setting/data-source-page/index.tsx index 78eeeeac5b..d99bd25e02 100644 --- a/web/app/components/header/account-setting/data-source-page/index.tsx +++ b/web/app/components/header/account-setting/data-source-page/index.tsx @@ -1,12 +1,10 @@ import useSWR from 'swr' -import { useTranslation } from 'react-i18next' import DataSourceNotion from './data-source-notion' import DataSourceWebsite from './data-source-website' import { fetchDataSource } from '@/service/common' import { DataSourceProvider } from '@/models/common' export default function DataSourcePage() { - const { t } = useTranslation() const { data } = useSWR({ url: 'data-source/integrates' }, fetchDataSource) const notionWorkspaces = data?.data.filter(item => item.provider === 'notion') || [] diff --git a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx index 22a427b63b..6d5b2b1ba0 100644 --- a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx +++ b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx @@ -21,7 +21,7 @@ const EditWorkspaceModal = ({ }: IEditWorkspaceModalProps) => { const { t } = useTranslation() const { notify } = useContext(ToastContext) - const { currentWorkspace, isCurrentWorkspaceOwner, mutateCurrentWorkspace } = useAppContext() + const { currentWorkspace, isCurrentWorkspaceOwner } = useAppContext() const [name, setName] = useState(currentWorkspace.name) const changeWorkspaceInfo = async (name: string) => { @@ -35,7 +35,7 @@ const EditWorkspaceModal = ({ notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) location.assign(`${location.origin}`) } - catch (e) { + catch { notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) } } diff --git a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx index 55f19c4a20..107166bc31 100644 --- a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx +++ b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx @@ -49,7 +49,7 @@ const InviteModal = ({ onSend(invitation_results) } } - catch (e) { } + catch { } } else { notify({ type: 'error', message: t('common.members.emailInvalid') }) diff --git a/web/app/components/header/account-setting/members-page/operation/index.tsx b/web/app/components/header/account-setting/members-page/operation/index.tsx index 1c8d30ba50..46f842dd4b 100644 --- a/web/app/components/header/account-setting/members-page/operation/index.tsx +++ b/web/app/components/header/account-setting/members-page/operation/index.tsx @@ -53,7 +53,7 @@ const Operation = ({ onOperate() notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) } - catch (e) { + catch { } } @@ -66,7 +66,7 @@ const Operation = ({ onOperate() notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) } - catch (e) { + catch { } } diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx index 2c73f035b9..dd441dde48 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx @@ -85,7 +85,6 @@ const ModelParameterModal: FC = ({ renderTrigger, readonly, isInWorkflow, - scope = 'text-generation', }) => { const { t } = useTranslation() const { isAPIKeySet } = useProviderContext() diff --git a/web/app/components/plugins/install-plugin/install-from-github/index.tsx b/web/app/components/plugins/install-plugin/install-from-github/index.tsx index e9f8578112..ceb800decd 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/index.tsx @@ -102,7 +102,7 @@ const InstallFromGitHub: React.FC = ({ updatePayload, on }) } } - catch (error) { + catch { Toast.notify({ type: 'error', message: t('plugin.error.fetchReleasesError'), diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index 072b8ee22f..35fc704953 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -67,7 +67,7 @@ const PluginPage = ({ try { return idStrings ? JSON.parse(idStrings)[0] : '' } - catch (e) { + catch { return '' } }, [searchParams]) @@ -78,7 +78,7 @@ const PluginPage = ({ try { return info ? JSON.parse(info) : undefined } - catch (e) { + catch { return undefined } }, [searchParams]) diff --git a/web/app/components/share/utils.ts b/web/app/components/share/utils.ts index 9c243b3b56..f3ef12e4aa 100644 --- a/web/app/components/share/utils.ts +++ b/web/app/components/share/utils.ts @@ -9,7 +9,7 @@ export const checkOrSetAccessToken = async () => { try { accessTokenJson = JSON.parse(accessToken) } - catch (e) { + catch { } if (!accessTokenJson[sharedToken]) { @@ -26,7 +26,7 @@ export const setAccessToken = async (sharedToken: string, token: string) => { try { accessTokenJson = JSON.parse(accessToken) } - catch (e) { + catch { } @@ -44,7 +44,7 @@ export const removeAccessToken = () => { try { accessTokenJson = JSON.parse(accessToken) } - catch (e) { + catch { } diff --git a/web/app/components/swr-initor.tsx b/web/app/components/swr-initor.tsx index d6a7f23f3a..8f9c5b4e05 100644 --- a/web/app/components/swr-initor.tsx +++ b/web/app/components/swr-initor.tsx @@ -68,7 +68,7 @@ const SwrInitor = ({ setInit(true) } - catch (error) { + catch { router.replace('/signin') } })() diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsx index bb57ac84ef..b9a29ef32d 100644 --- a/web/app/components/tools/edit-custom-collection-modal/index.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx @@ -98,7 +98,7 @@ const EditCustomCollectionModal: FC = ({ setCustomCollection(newCollection) setParamsSchemas(parameters_schema) } - catch (e) { + catch { const customCollection = getCustomCollection() const newCollection = produce(customCollection, (draft) => { draft.schema_type = '' @@ -174,7 +174,7 @@ const EditCustomCollectionModal: FC = ({ const path = decodeURI(new URL(url).pathname) return path || '' } - catch (e) { + catch { return url } } diff --git a/web/app/components/tools/edit-custom-collection-modal/modal.tsx b/web/app/components/tools/edit-custom-collection-modal/modal.tsx index d9ee8b4ce5..190c72790e 100644 --- a/web/app/components/tools/edit-custom-collection-modal/modal.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/modal.tsx @@ -96,7 +96,7 @@ const EditCustomCollectionModal: FC = ({ setCustomCollection(newCollection) setParamsSchemas(parameters_schema) } - catch (e) { + catch { const customCollection = getCustomCollection() const newCollection = produce(customCollection, (draft) => { draft.schema_type = '' @@ -172,7 +172,7 @@ const EditCustomCollectionModal: FC = ({ const path = decodeURI(new URL(url).pathname) return path || '' } - catch (e) { + catch { return url } } diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx index 20c77ce727..52a778b471 100644 --- a/web/app/components/tools/provider/detail.tsx +++ b/web/app/components/tools/provider/detail.tsx @@ -213,7 +213,7 @@ const ProviderDetail = ({ setToolList(list) } } - catch (e) { } + catch { } setIsDetailLoading(false) }, [collection.name, collection.type]) diff --git a/web/app/components/workflow/hooks/use-workflow-interactions.ts b/web/app/components/workflow/hooks/use-workflow-interactions.ts index eeb4d658a4..202867e22f 100644 --- a/web/app/components/workflow/hooks/use-workflow-interactions.ts +++ b/web/app/components/workflow/hooks/use-workflow-interactions.ts @@ -391,7 +391,7 @@ export const useDSL = () => { a.download = `${appDetail.name}.yml` a.click() } - catch (e) { + catch { notify({ type: 'error', message: t('app.exportFailed') }) } finally { @@ -416,7 +416,7 @@ export const useDSL = () => { }, } as any) } - catch (e) { + catch { notify({ type: 'error', message: t('app.exportFailed') }) } }, [appDetail, eventEmitter, handleExportDSL, notify, t]) diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx index ef4ba15c5c..ad8d0b9c61 100644 --- a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx @@ -123,7 +123,7 @@ const BeforeRunForm: FC = ({ const value = formatValue(form.values[input.variable], input.type) submitData[input.variable] = value } - catch (e) { + catch { parseErrorJsonField = input.variable } }) diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx index 5a4a35ff8a..a185f16e2e 100644 --- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx @@ -119,7 +119,7 @@ const CodeEditor: FC = ({ try { return JSON.stringify(value as object, null, 2) } - catch (e) { + catch { return value as string } })() diff --git a/web/app/components/workflow/nodes/code/utils.ts b/web/app/components/workflow/nodes/code/utils.ts index 74b3cec43d..da9c1153c6 100644 --- a/web/app/components/workflow/nodes/code/utils.ts +++ b/web/app/components/workflow/nodes/code/utils.ts @@ -1,5 +1,3 @@ -import type { CodeNodeType } from './types' - -export const checkNodeValid = (payload: CodeNodeType) => { +export const checkNodeValid = () => { return true } diff --git a/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx b/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx index a0161e32fd..ac347a084b 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx @@ -71,7 +71,7 @@ const ConditionValue = ({ : '' } return '' - }, []) + }, [t]) return (
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx index bbc7654b3f..ef94f7c82e 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx @@ -141,7 +141,7 @@ const ConditionItem = ({ value: isArrayValue ? [value] : value, } doUpdateCondition(newCondition) - }, [condition, doUpdateCondition, fileAttr]) + }, [condition, doUpdateCondition, isArrayValue]) const isSelect = condition.comparison_operator && [ComparisonOperator.in, ComparisonOperator.notIn].includes(condition.comparison_operator) const selectOptions = useMemo(() => { diff --git a/web/app/components/workflow/nodes/if-else/use-config.ts b/web/app/components/workflow/nodes/if-else/use-config.ts index 827eb499f9..276d017b40 100644 --- a/web/app/components/workflow/nodes/if-else/use-config.ts +++ b/web/app/components/workflow/nodes/if-else/use-config.ts @@ -133,7 +133,7 @@ const useConfig = (id: string, payload: IfElseNodeType) => { }) setInputs(newInputs) updateNodeInternals(id) - }, [inputs, setInputs]) + }, [id, inputs, setInputs, updateNodeInternals]) const handleAddCondition = useCallback((caseId, valueSelector, varItem) => { const newInputs = produce(inputs, (draft) => { diff --git a/web/app/components/workflow/nodes/question-classifier/utils.ts b/web/app/components/workflow/nodes/question-classifier/utils.ts index 486f67d54b..da9c1153c6 100644 --- a/web/app/components/workflow/nodes/question-classifier/utils.ts +++ b/web/app/components/workflow/nodes/question-classifier/utils.ts @@ -1,5 +1,3 @@ -import type { QuestionClassifierNodeType } from './types' - -export const checkNodeValid = (payload: QuestionClassifierNodeType) => { +export const checkNodeValid = () => { return true } diff --git a/web/app/components/workflow/note-node/note-editor/context.tsx b/web/app/components/workflow/note-node/note-editor/context.tsx index 8c9db2e152..0349746332 100644 --- a/web/app/components/workflow/note-node/note-editor/context.tsx +++ b/web/app/components/workflow/note-node/note-editor/context.tsx @@ -34,7 +34,7 @@ export const NoteEditorContextProvider = memo(({ try { initialValue = JSON.parse(value) } - catch (e) { + catch { } diff --git a/web/app/components/workflow/panel/chat-record/index.tsx b/web/app/components/workflow/panel/chat-record/index.tsx index 69bb107e74..bf8a061180 100644 --- a/web/app/components/workflow/panel/chat-record/index.tsx +++ b/web/app/components/workflow/panel/chat-record/index.tsx @@ -68,7 +68,7 @@ const ChatRecord = () => { setChatItemTree(tree) setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id)) } - catch (e) { + catch { } finally { setFetched(true) diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx index ebd755eae5..947007e93e 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx +++ b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx @@ -178,7 +178,7 @@ const ChatVariableModal = ({ }) setObjectValue(newObjectValue) } - catch (e) { + catch { // ignore JSON.parse errors } } @@ -209,7 +209,7 @@ const ChatVariableModal = ({ const newValue = JSON.parse(content) setValue(newValue) } - catch (e) { + catch { // ignore JSON.parse errors } } diff --git a/web/app/components/workflow/panel/global-variable-panel/index.tsx b/web/app/components/workflow/panel/global-variable-panel/index.tsx index f7ec8812b9..ad7996ab0c 100644 --- a/web/app/components/workflow/panel/global-variable-panel/index.tsx +++ b/web/app/components/workflow/panel/global-variable-panel/index.tsx @@ -3,7 +3,6 @@ import { } from 'react' import { RiCloseLine } from '@remixicon/react' -import { useTranslation } from 'react-i18next' import type { GlobalVariable } from '../../types' import Item from './item' import { useStore } from '@/app/components/workflow/store' @@ -11,7 +10,6 @@ import { useStore } from '@/app/components/workflow/store' import cn from '@/utils/classnames' const Panel = () => { - const { t } = useTranslation() const setShowPanel = useStore(s => s.setShowGlobalVariablePanel) const globalVariableList: GlobalVariable[] = [ diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsx index 0ac34c1a99..50a8568c7d 100644 --- a/web/app/forgot-password/ChangePasswordForm.tsx +++ b/web/app/forgot-password/ChangePasswordForm.tsx @@ -72,7 +72,7 @@ const ChangePasswordForm = () => { catch { await revalidateToken() } - }, [password, revalidateToken, token, valid]) + }, [confirmPassword, password, revalidateToken, searchParams, valid]) return (
{ } useEffect(() => { - fetchSetupStatus().then((res: SetupStatusResponse) => { + fetchSetupStatus().then(() => { fetchInitValidateStatus().then((res: InitValidateStatusResponse) => { if (res.status === 'not_started') window.location.href = '/init' diff --git a/web/i18n/auto-gen-i18n.js b/web/i18n/auto-gen-i18n.js index 027ab81e3a..540d15503c 100644 --- a/web/i18n/auto-gen-i18n.js +++ b/web/i18n/auto-gen-i18n.js @@ -42,7 +42,7 @@ async function translateMissingKeyDeeply(sourceObj, targetObject, toLanguage) { const { translation } = await translate(sourceObj[key], null, languageKeyMap[toLanguage]) targetObject[key] = translation } - catch (e) { + catch { console.error(`Error translating ${sourceObj[key]}(${key}) to ${toLanguage}`) } } diff --git a/web/service/base.ts b/web/service/base.ts index f683011fde..cb69257c31 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -169,7 +169,7 @@ const handleStream = ( try { bufferObj = JSON.parse(message.substring(6)) as Record// remove data: and parse as json } - catch (e) { + catch { // mute handle message cut off onData('', isFirstMessage, { conversationId: bufferObj?.conversation_id, diff --git a/web/service/fetch.ts b/web/service/fetch.ts index 10643173bc..bbc1f4fc1e 100644 --- a/web/service/fetch.ts +++ b/web/service/fetch.ts @@ -88,7 +88,7 @@ export function getAccessToken(isPublicAPI?: boolean) { try { accessTokenJson = JSON.parse(accessToken) } - catch (e) { + catch { } return accessTokenJson[sharedToken] diff --git a/web/service/refresh-token.ts b/web/service/refresh-token.ts index c14835b53e..4f295f3f81 100644 --- a/web/service/refresh-token.ts +++ b/web/service/refresh-token.ts @@ -5,7 +5,7 @@ const LOCAL_STORAGE_KEY = 'is_other_tab_refreshing' let isRefreshing = false function waitUntilTokenRefreshed() { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { function _check() { const isRefreshingSign = globalThis.localStorage.getItem(LOCAL_STORAGE_KEY) if ((isRefreshingSign && isRefreshingSign === '1') || isRefreshing) { diff --git a/web/service/use-plugins.ts b/web/service/use-plugins.ts index c5f60b4a1e..2dc59fd1f1 100644 --- a/web/service/use-plugins.ts +++ b/web/service/use-plugins.ts @@ -491,7 +491,7 @@ export const useModelInList = (currentProvider?: ModelProvider, modelId?: string const modelsData = await fetchModelProviderModelList(`/workspaces/current/model-providers/${currentProvider?.provider}/models`) return !!modelId && !!modelsData.data.find(item => item.model === modelId) } - catch (error) { + catch { return false } }, @@ -511,7 +511,7 @@ export const usePluginInfo = (providerName?: string) => { const response = await fetchPluginInfoFromMarketPlace({ org, name }) return response.data.plugin.category === PluginTypeEnum.model ? response.data.plugin : null } - catch (error) { + catch { return null } },