Chore/cleanup warnings (#17974)

This commit is contained in:
crazywoola 2025-04-14 11:27:14 +08:00 committed by GitHub
parent f84832e0c2
commit 8f9cbe1c49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
69 changed files with 89 additions and 117 deletions

View File

@ -1,8 +1,6 @@
import React from 'react' import React from 'react'
type Props = {} const page = () => {
const page = (props: Props) => {
return ( return (
<div>dataset detail api</div> <div>dataset detail api</div>
) )

View File

@ -61,7 +61,7 @@ const DatasetCard = ({
if (onSuccess) if (onSuccess)
onSuccess() onSuccess()
} }
catch (e: any) { catch {
} }
setShowConfirmDelete(false) setShowConfirmDelete(false)
}, [dataset.id, notify, onSuccess, t]) }, [dataset.id, notify, onSuccess, t])

View File

@ -85,7 +85,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
setAppDetail(app) setAppDetail(app)
mutateApps() mutateApps()
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.editFailed') }) notify({ type: 'error', message: t('app.editFailed') })
} }
}, [appDetail, mutateApps, notify, setAppDetail, t]) }, [appDetail, mutateApps, notify, setAppDetail, t])
@ -112,7 +112,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
onPlanInfoChanged() onPlanInfoChanged()
getRedirection(true, newApp, replace) getRedirection(true, newApp, replace)
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
} }
} }
@ -131,7 +131,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
a.download = `${appDetail.name}.yml` a.download = `${appDetail.name}.yml`
a.click() a.click()
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.exportFailed') }) notify({ type: 'error', message: t('app.exportFailed') })
} }
} }
@ -152,7 +152,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
} }
setSecretEnvList(list) setSecretEnvList(list)
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.exportFailed') }) notify({ type: 'error', message: t('app.exportFailed') })
} }
} }
@ -175,7 +175,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
}) })
} }
setShowConfirmDelete(false) setShowConfirmDelete(false)
}, [appDetail, mutateApps, notify, onPlanInfoChanged, replace, t]) }, [appDetail, mutateApps, notify, onPlanInfoChanged, replace, setAppDetail, t])
const { isCurrentWorkspaceEditor } = useAppContext() const { isCurrentWorkspaceEditor } = useAppContext()

View File

@ -56,7 +56,7 @@ const AddAnnotationModal: FC<Props> = ({
try { try {
await onAdd(payload) await onAdd(payload)
} }
catch (e) { catch {
} }
setIsSaving(false) setIsSaving(false)

View File

@ -90,7 +90,7 @@ const Annotation: FC<Props> = ({
setList(data as AnnotationItem[]) setList(data as AnnotationItem[])
setTotal(total) setTotal(total)
} }
catch (e) { catch {
} }
setIsLoading(false) setIsLoading(false)

View File

@ -55,7 +55,7 @@ const ViewAnnotationModal: FC<Props> = ({
setHitHistoryList(data as HitHistoryItem[]) setHitHistoryList(data as HitHistoryItem[])
setTotal(total) setTotal(total)
} }
catch (e) { catch {
} }
} }

View File

@ -88,7 +88,7 @@ const SettingBuiltInTool: FC<Props> = ({
setTempSetting(addDefaultValue(setting, formSchemas)) setTempSetting(addDefaultValue(setting, formSchemas))
} }
} }
catch (e) { } catch { }
setIsLoading(false) setIsLoading(false)
})() })()
}, [collection?.name, collection?.id, collection?.type]) }, [collection?.name, collection?.id, collection?.type])

View File

@ -150,7 +150,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
retrieval_model_dict: retrievalConfig, retrieval_model_dict: retrievalConfig,
}) })
} }
catch (e) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
} }
finally { finally {

View File

@ -153,7 +153,7 @@ const Apps = ({
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push)
} }
catch (e) { catch {
Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
} }
} }

View File

@ -90,7 +90,7 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate }: CreateAppProps)
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
getRedirection(isCurrentWorkspaceEditor, app, push) getRedirection(isCurrentWorkspaceEditor, app, push)
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
} }
isCreatingRef.current = false isCreatingRef.current = false
@ -287,7 +287,6 @@ type AppTypeCardProps = {
onClick: () => void onClick: () => void
} }
function AppTypeCard({ icon, title, description, active, onClick }: AppTypeCardProps) { function AppTypeCard({ icon, title, description, active, onClick }: AppTypeCardProps) {
const { t } = useTranslation()
return <div return <div
className={ className={
cn(`relative box-content h-[84px] w-[191px] cursor-pointer rounded-xl cn(`relative box-content h-[84px] w-[191px] cursor-pointer rounded-xl

View File

@ -30,7 +30,7 @@ const LogAnnotation: FC<Props> = ({
{ value: PageType.log, text: t('appLog.title') }, { value: PageType.log, text: t('appLog.title') },
{ value: PageType.annotation, text: t('appAnnotation.title') }, { value: PageType.annotation, text: t('appAnnotation.title') },
] ]
}, [appDetail]) }, [appDetail?.mode, t])
if (!appDetail) { if (!appDetail) {
return ( return (

View File

@ -547,7 +547,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
return true return true
} }
catch (err) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
return false return false
} }
@ -560,7 +560,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
return true return true
} }
catch (err) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
return false return false
} }
@ -591,7 +591,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string }
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
return true return true
} }
catch (err) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
return false return false
} }
@ -603,7 +603,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string }
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
return true return true
} }
catch (err) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
return false return false
} }

View File

@ -82,7 +82,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo
removeOriginal ? replace : push, removeOriginal ? replace : push,
) )
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
} }
} }

View File

@ -33,7 +33,7 @@ export class AudioPlayerManager {
this.audioPlayers.cacheBuffers = [] this.audioPlayers.cacheBuffers = []
this.audioPlayers.sourceBuffer?.abort() this.audioPlayers.sourceBuffer?.abort()
} }
catch (e) { catch {
} }
} }

View File

@ -125,7 +125,7 @@ export default class AudioPlayer {
this.receiveAudioData(value) this.receiveAudioData(value)
} }
} }
catch (error) { catch {
this.isLoadData = false this.isLoadData = false
this.callback && this.callback('error') this.callback && this.callback('error')
} }

View File

@ -124,7 +124,7 @@ const AudioPlayer: React.FC<AudioPlayerProps> = ({ src }) => {
setWaveformData(normalizedWaveform) setWaveformData(normalizedWaveform)
setIsAudioAvailable(true) setIsAudioAvailable(true)
} }
catch (error) { catch {
const waveform: number[] = [] const waveform: number[] = []
let prevValue = Math.random() let prevValue = Math.random()

View File

@ -14,7 +14,7 @@ function getValue(value: string, isValueArray: boolean, index: number) {
try { try {
return JSON.parse(value)[index] return JSON.parse(value)[index]
} }
catch (e) { catch {
} }
} }
return value return value
@ -29,7 +29,7 @@ const Thought: FC<IThoughtProps> = ({
if (Array.isArray(JSON.parse(thought.tool))) if (Array.isArray(JSON.parse(thought.tool)))
return [JSON.parse(thought.tool), true] return [JSON.parse(thought.tool), true]
} }
catch (e) { catch {
} }
return [[thought.tool], false] return [[thought.tool], false]
})() })()

View File

@ -138,16 +138,7 @@ const ChatWrapper = () => {
isPublicAPI: !isInstalledApp, isPublicAPI: !isInstalledApp,
}, },
) )
}, [ }, [currentConversationId, currentConversationInputs, newConversationInputs, chatList, handleSend, isInstalledApp, appId, handleNewConversationCompleted])
chatList,
handleNewConversationCompleted,
handleSend,
currentConversationId,
currentConversationItem,
newConversationInputs,
isInstalledApp,
appId,
])
const doRegenerate = useCallback((chatItem: ChatItemInTree) => { const doRegenerate = useCallback((chatItem: ChatItemInTree) => {
const question = chatList.find(item => item.id === chatItem.parentMessageId)! const question = chatList.find(item => item.id === chatItem.parentMessageId)!

View File

@ -24,7 +24,6 @@ const InputsFormContent = ({ showTip }: Props) => {
handleNewConversationInputsChange, handleNewConversationInputsChange,
} = useEmbeddedChatbotContext() } = useEmbeddedChatbotContext()
const inputsFormValue = currentConversationId ? currentConversationInputs : newConversationInputs const inputsFormValue = currentConversationId ? currentConversationInputs : newConversationInputs
const readonly = !!currentConversationId
const handleFormChange = useCallback((variable: string, value: any) => { const handleFormChange = useCallback((variable: string, value: any) => {
setCurrentConversationInputs({ setCurrentConversationInputs({

View File

@ -128,7 +128,7 @@ const CodeBlock: any = memo(({ inline, className, children, ...props }: any) =>
try { try {
return JSON.parse(String(children).replace(/\n$/, '')) return JSON.parse(String(children).replace(/\n$/, ''))
} }
catch (error) { } catch { }
} }
return JSON.parse('{"title":{"text":"ECharts error - Wrong JSON format."}}') return JSON.parse('{"title":{"text":"ECharts error - Wrong JSON format."}}')
}, [language, children]) }, [language, children])

View File

@ -51,7 +51,7 @@ export const SVGRenderer = ({ content }: { content: string }) => {
setImagePreview(svgToDataURL(svgElement as Element)) setImagePreview(svgToDataURL(svgElement as Element))
}) })
} }
catch (error) { catch {
if (svgRef.current) if (svgRef.current)
svgRef.current.innerHTML = '<span style="padding: 1rem;">Error rendering SVG. Wait for the image content to complete.</span>' svgRef.current.innerHTML = '<span style="padding: 1rem;">Error rendering SVG. Wait for the image content to complete.</span>'
} }

View File

@ -48,7 +48,7 @@ const TagManagementModal = ({ show, type }: TagManagementModalProps) => {
setName('') setName('')
setPending(false) setPending(false)
} }
catch (e: any) { catch {
notify({ type: 'error', message: t('common.tag.failed') }) notify({ type: 'error', message: t('common.tag.failed') })
setPending(false) setPending(false)
} }

View File

@ -73,7 +73,7 @@ const Panel = (props: PanelProps) => {
setCreating(false) setCreating(false)
onCreate() onCreate()
} }
catch (e: any) { catch {
notify({ type: 'error', message: t('common.tag.failed') }) notify({ type: 'error', message: t('common.tag.failed') })
setCreating(false) setCreating(false)
} }
@ -83,7 +83,7 @@ const Panel = (props: PanelProps) => {
await bindTag(tagIDs, targetID, type) await bindTag(tagIDs, targetID, type)
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
} }
catch (e: any) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
} }
} }
@ -92,7 +92,7 @@ const Panel = (props: PanelProps) => {
await unBindTag(tagID, targetID, type) await unBindTag(tagID, targetID, type)
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
} }
catch (e: any) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
} }
} }

View File

@ -59,7 +59,7 @@ const TagItemEditor: FC<TagItemEditorProps> = ({
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
setName(name) setName(name)
} }
catch (e: any) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
setName(tag.name) setName(tag.name)
const recoverList = tagList.map((tag) => { const recoverList = tagList.map((tag) => {
@ -92,7 +92,7 @@ const TagItemEditor: FC<TagItemEditorProps> = ({
]) ])
setPending(false) setPending(false)
} }
catch (e: any) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
setPending(false) setPending(false)
} }

View File

@ -111,7 +111,7 @@ const VoiceInput = ({
onConverted(audioResponse.text) onConverted(audioResponse.text)
onCancel() onCancel()
} }
catch (e) { catch {
onConverted('') onConverted('')
onCancel() onCancel()
} }
@ -125,7 +125,7 @@ const VoiceInput = ({
if (canvasRef.current && ctxRef.current) if (canvasRef.current && ctxRef.current)
drawRecord() drawRecord()
} }
catch (e) { catch {
onCancel() onCancel()
} }
} }

View File

@ -30,7 +30,7 @@ try {
localStorage = globalThis.localStorage localStorage = globalThis.localStorage
sessionStorage = globalThis.sessionStorage sessionStorage = globalThis.sessionStorage
} }
catch (e) { catch {
localStorage = new StorageMock() localStorage = new StorageMock()
sessionStorage = new StorageMock() sessionStorage = new StorageMock()
} }

View File

@ -1,8 +1,6 @@
import React from 'react' import React from 'react'
type Props = {} const index = () => {
const index = (props: Props) => {
return ( return (
<div>index</div> <div>index</div>
) )

View File

@ -184,7 +184,7 @@ const EmbeddingProcess: FC<Props> = ({ datasetId, batchId, documents = [], index
await sleep(2500) await sleep(2500)
await startQueryStatus() await startQueryStatus()
} }
catch (e) { catch {
await sleep(2500) await sleep(2500)
await startQueryStatus() await startQueryStatus()
} }

View File

@ -40,7 +40,7 @@ const EmptyDatasetCreationModal = ({
onHide() onHide()
router.push(`/datasets/${dataset.id}/documents`) router.push(`/datasets/${dataset.id}/documents`)
} }
catch (err) { catch {
notify({ type: 'error', message: t('datasetCreation.stepOne.modal.failed') }) notify({ type: 'error', message: t('datasetCreation.stepOne.modal.failed') })
} }
} }

View File

@ -130,7 +130,7 @@ const JinaReader: FC<Props> = ({
}, },
} }
} }
}, [crawlOptions.limit]) }, [crawlOptions.limit, onCheckedCrawlResultChange])
const handleRun = useCallback(async (url: string) => { const handleRun = useCallback(async (url: string) => {
const { isValid, errorMsg } = checkValid(url) const { isValid, errorMsg } = checkValid(url)
@ -186,7 +186,7 @@ const JinaReader: FC<Props> = ({
finally { finally {
setStep(Step.finished) setStep(Step.finished)
} }
}, [checkValid, crawlOptions, onJobIdChange, t, waitForCrawlFinished]) }, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, t, waitForCrawlFinished])
return ( return (
<div> <div>

View File

@ -193,7 +193,7 @@ const EmbeddingDetail: FC<IEmbeddingDetailProps> = ({
await sleep(2500) await sleep(2500)
await startQueryStatus() await startQueryStatus()
} }
catch (e) { catch {
await sleep(2500) await sleep(2500)
await startQueryStatus() await startQueryStatus()
} }

View File

@ -135,7 +135,7 @@ const DocumentDetail: FC<Props> = ({ datasetId, documentId }) => {
params: { metadata: 'without' }, params: { metadata: 'without' },
}) })
const { data: documentMetadata, error: metadataErr, refetch: metadataMutate } = useDocumentMetadata({ const { data: documentMetadata } = useDocumentMetadata({
datasetId, datasetId,
documentId, documentId,
params: { metadata: 'only' }, params: { metadata: 'only' },
@ -146,7 +146,6 @@ const DocumentDetail: FC<Props> = ({ datasetId, documentId }) => {
} }
const isDetailLoading = !documentDetail && !error const isDetailLoading = !documentDetail && !error
const isMetadataLoading = !documentMetadata && !metadataErr
const embedding = ['queuing', 'indexing', 'paused'].includes((documentDetail?.display_status || '').toLowerCase()) const embedding = ['queuing', 'indexing', 'paused'].includes((documentDetail?.display_status || '').toLowerCase())

View File

@ -14,7 +14,7 @@ const ChildChunks: FC<Props> = ({
payload, payload,
isShowAll, isShowAll,
}) => { }) => {
const { id, score, content, position } = payload const { score, content, position } = payload
return ( return (
<div <div
className={!isShowAll ? 'line-clamp-2 break-all' : ''} className={!isShowAll ? 'line-clamp-2 break-all' : ''}

View File

@ -55,7 +55,7 @@ const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDataset
onSuccess() onSuccess()
onClose() onClose()
} }
catch (e) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
} }
finally { finally {

View File

@ -160,7 +160,7 @@ const Form = () => {
mutate(unstable_serialize(getKey)) mutate(unstable_serialize(getKey))
} }
} }
catch (e) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
} }
finally { finally {

View File

@ -148,7 +148,7 @@ const Apps = ({
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push)
} }
catch (e) { catch {
Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
} }
} }

View File

@ -14,10 +14,7 @@ type IAccountSettingProps = {
langeniusVersionInfo: LangGeniusVersionResponse langeniusVersionInfo: LangGeniusVersionResponse
onCancel: () => void 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({ export default function AccountAbout({
langeniusVersionInfo, langeniusVersionInfo,
onCancel, onCancel,

View File

@ -24,7 +24,7 @@ const WorkplaceSelector = () => {
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
location.assign(`${location.origin}`) location.assign(`${location.origin}`)
} }
catch (e) { catch {
notify({ type: 'error', message: t('common.provider.saveFailed') }) notify({ type: 'error', message: t('common.provider.saveFailed') })
} }
} }

View File

@ -1,12 +1,10 @@
import useSWR from 'swr' import useSWR from 'swr'
import { useTranslation } from 'react-i18next'
import DataSourceNotion from './data-source-notion' import DataSourceNotion from './data-source-notion'
import DataSourceWebsite from './data-source-website' import DataSourceWebsite from './data-source-website'
import { fetchDataSource } from '@/service/common' import { fetchDataSource } from '@/service/common'
import { DataSourceProvider } from '@/models/common' import { DataSourceProvider } from '@/models/common'
export default function DataSourcePage() { export default function DataSourcePage() {
const { t } = useTranslation()
const { data } = useSWR({ url: 'data-source/integrates' }, fetchDataSource) const { data } = useSWR({ url: 'data-source/integrates' }, fetchDataSource)
const notionWorkspaces = data?.data.filter(item => item.provider === 'notion') || [] const notionWorkspaces = data?.data.filter(item => item.provider === 'notion') || []

View File

@ -21,7 +21,7 @@ const EditWorkspaceModal = ({
}: IEditWorkspaceModalProps) => { }: IEditWorkspaceModalProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const { notify } = useContext(ToastContext) const { notify } = useContext(ToastContext)
const { currentWorkspace, isCurrentWorkspaceOwner, mutateCurrentWorkspace } = useAppContext() const { currentWorkspace, isCurrentWorkspaceOwner } = useAppContext()
const [name, setName] = useState<string>(currentWorkspace.name) const [name, setName] = useState<string>(currentWorkspace.name)
const changeWorkspaceInfo = async (name: string) => { const changeWorkspaceInfo = async (name: string) => {
@ -35,7 +35,7 @@ const EditWorkspaceModal = ({
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
location.assign(`${location.origin}`) location.assign(`${location.origin}`)
} }
catch (e) { catch {
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') }) notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
} }
} }

View File

@ -49,7 +49,7 @@ const InviteModal = ({
onSend(invitation_results) onSend(invitation_results)
} }
} }
catch (e) { } catch { }
} }
else { else {
notify({ type: 'error', message: t('common.members.emailInvalid') }) notify({ type: 'error', message: t('common.members.emailInvalid') })

View File

@ -53,7 +53,7 @@ const Operation = ({
onOperate() onOperate()
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
} }
catch (e) { catch {
} }
} }
@ -66,7 +66,7 @@ const Operation = ({
onOperate() onOperate()
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
} }
catch (e) { catch {
} }
} }

View File

@ -85,7 +85,6 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
renderTrigger, renderTrigger,
readonly, readonly,
isInWorkflow, isInWorkflow,
scope = 'text-generation',
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { isAPIKeySet } = useProviderContext() const { isAPIKeySet } = useProviderContext()

View File

@ -102,7 +102,7 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({ updatePayload, on
}) })
} }
} }
catch (error) { catch {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t('plugin.error.fetchReleasesError'), message: t('plugin.error.fetchReleasesError'),

View File

@ -67,7 +67,7 @@ const PluginPage = ({
try { try {
return idStrings ? JSON.parse(idStrings)[0] : '' return idStrings ? JSON.parse(idStrings)[0] : ''
} }
catch (e) { catch {
return '' return ''
} }
}, [searchParams]) }, [searchParams])
@ -78,7 +78,7 @@ const PluginPage = ({
try { try {
return info ? JSON.parse(info) : undefined return info ? JSON.parse(info) : undefined
} }
catch (e) { catch {
return undefined return undefined
} }
}, [searchParams]) }, [searchParams])

View File

@ -9,7 +9,7 @@ export const checkOrSetAccessToken = async () => {
try { try {
accessTokenJson = JSON.parse(accessToken) accessTokenJson = JSON.parse(accessToken)
} }
catch (e) { catch {
} }
if (!accessTokenJson[sharedToken]) { if (!accessTokenJson[sharedToken]) {
@ -26,7 +26,7 @@ export const setAccessToken = async (sharedToken: string, token: string) => {
try { try {
accessTokenJson = JSON.parse(accessToken) accessTokenJson = JSON.parse(accessToken)
} }
catch (e) { catch {
} }
@ -44,7 +44,7 @@ export const removeAccessToken = () => {
try { try {
accessTokenJson = JSON.parse(accessToken) accessTokenJson = JSON.parse(accessToken)
} }
catch (e) { catch {
} }

View File

@ -68,7 +68,7 @@ const SwrInitor = ({
setInit(true) setInit(true)
} }
catch (error) { catch {
router.replace('/signin') router.replace('/signin')
} }
})() })()

View File

@ -98,7 +98,7 @@ const EditCustomCollectionModal: FC<Props> = ({
setCustomCollection(newCollection) setCustomCollection(newCollection)
setParamsSchemas(parameters_schema) setParamsSchemas(parameters_schema)
} }
catch (e) { catch {
const customCollection = getCustomCollection() const customCollection = getCustomCollection()
const newCollection = produce(customCollection, (draft) => { const newCollection = produce(customCollection, (draft) => {
draft.schema_type = '' draft.schema_type = ''
@ -174,7 +174,7 @@ const EditCustomCollectionModal: FC<Props> = ({
const path = decodeURI(new URL(url).pathname) const path = decodeURI(new URL(url).pathname)
return path || '' return path || ''
} }
catch (e) { catch {
return url return url
} }
} }

View File

@ -96,7 +96,7 @@ const EditCustomCollectionModal: FC<Props> = ({
setCustomCollection(newCollection) setCustomCollection(newCollection)
setParamsSchemas(parameters_schema) setParamsSchemas(parameters_schema)
} }
catch (e) { catch {
const customCollection = getCustomCollection() const customCollection = getCustomCollection()
const newCollection = produce(customCollection, (draft) => { const newCollection = produce(customCollection, (draft) => {
draft.schema_type = '' draft.schema_type = ''
@ -172,7 +172,7 @@ const EditCustomCollectionModal: FC<Props> = ({
const path = decodeURI(new URL(url).pathname) const path = decodeURI(new URL(url).pathname)
return path || '' return path || ''
} }
catch (e) { catch {
return url return url
} }
} }

View File

@ -213,7 +213,7 @@ const ProviderDetail = ({
setToolList(list) setToolList(list)
} }
} }
catch (e) { } catch { }
setIsDetailLoading(false) setIsDetailLoading(false)
}, [collection.name, collection.type]) }, [collection.name, collection.type])

View File

@ -391,7 +391,7 @@ export const useDSL = () => {
a.download = `${appDetail.name}.yml` a.download = `${appDetail.name}.yml`
a.click() a.click()
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.exportFailed') }) notify({ type: 'error', message: t('app.exportFailed') })
} }
finally { finally {
@ -416,7 +416,7 @@ export const useDSL = () => {
}, },
} as any) } as any)
} }
catch (e) { catch {
notify({ type: 'error', message: t('app.exportFailed') }) notify({ type: 'error', message: t('app.exportFailed') })
} }
}, [appDetail, eventEmitter, handleExportDSL, notify, t]) }, [appDetail, eventEmitter, handleExportDSL, notify, t])

View File

@ -123,7 +123,7 @@ const BeforeRunForm: FC<BeforeRunFormProps> = ({
const value = formatValue(form.values[input.variable], input.type) const value = formatValue(form.values[input.variable], input.type)
submitData[input.variable] = value submitData[input.variable] = value
} }
catch (e) { catch {
parseErrorJsonField = input.variable parseErrorJsonField = input.variable
} }
}) })

View File

@ -119,7 +119,7 @@ const CodeEditor: FC<Props> = ({
try { try {
return JSON.stringify(value as object, null, 2) return JSON.stringify(value as object, null, 2)
} }
catch (e) { catch {
return value as string return value as string
} }
})() })()

View File

@ -1,5 +1,3 @@
import type { CodeNodeType } from './types' export const checkNodeValid = () => {
export const checkNodeValid = (payload: CodeNodeType) => {
return true return true
} }

View File

@ -71,7 +71,7 @@ const ConditionValue = ({
: '' : ''
} }
return '' return ''
}, []) }, [t])
return ( return (
<div className='rounded-md bg-workflow-block-parma-bg'> <div className='rounded-md bg-workflow-block-parma-bg'>

View File

@ -141,7 +141,7 @@ const ConditionItem = ({
value: isArrayValue ? [value] : value, value: isArrayValue ? [value] : value,
} }
doUpdateCondition(newCondition) doUpdateCondition(newCondition)
}, [condition, doUpdateCondition, fileAttr]) }, [condition, doUpdateCondition, isArrayValue])
const isSelect = condition.comparison_operator && [ComparisonOperator.in, ComparisonOperator.notIn].includes(condition.comparison_operator) const isSelect = condition.comparison_operator && [ComparisonOperator.in, ComparisonOperator.notIn].includes(condition.comparison_operator)
const selectOptions = useMemo(() => { const selectOptions = useMemo(() => {

View File

@ -133,7 +133,7 @@ const useConfig = (id: string, payload: IfElseNodeType) => {
}) })
setInputs(newInputs) setInputs(newInputs)
updateNodeInternals(id) updateNodeInternals(id)
}, [inputs, setInputs]) }, [id, inputs, setInputs, updateNodeInternals])
const handleAddCondition = useCallback<HandleAddCondition>((caseId, valueSelector, varItem) => { const handleAddCondition = useCallback<HandleAddCondition>((caseId, valueSelector, varItem) => {
const newInputs = produce(inputs, (draft) => { const newInputs = produce(inputs, (draft) => {

View File

@ -1,5 +1,3 @@
import type { QuestionClassifierNodeType } from './types' export const checkNodeValid = () => {
export const checkNodeValid = (payload: QuestionClassifierNodeType) => {
return true return true
} }

View File

@ -34,7 +34,7 @@ export const NoteEditorContextProvider = memo(({
try { try {
initialValue = JSON.parse(value) initialValue = JSON.parse(value)
} }
catch (e) { catch {
} }

View File

@ -68,7 +68,7 @@ const ChatRecord = () => {
setChatItemTree(tree) setChatItemTree(tree)
setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id)) setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id))
} }
catch (e) { catch {
} }
finally { finally {
setFetched(true) setFetched(true)

View File

@ -178,7 +178,7 @@ const ChatVariableModal = ({
}) })
setObjectValue(newObjectValue) setObjectValue(newObjectValue)
} }
catch (e) { catch {
// ignore JSON.parse errors // ignore JSON.parse errors
} }
} }
@ -209,7 +209,7 @@ const ChatVariableModal = ({
const newValue = JSON.parse(content) const newValue = JSON.parse(content)
setValue(newValue) setValue(newValue)
} }
catch (e) { catch {
// ignore JSON.parse errors // ignore JSON.parse errors
} }
} }

View File

@ -3,7 +3,6 @@ import {
} from 'react' } from 'react'
import { RiCloseLine } from '@remixicon/react' import { RiCloseLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import type { GlobalVariable } from '../../types' import type { GlobalVariable } from '../../types'
import Item from './item' import Item from './item'
import { useStore } from '@/app/components/workflow/store' import { useStore } from '@/app/components/workflow/store'
@ -11,7 +10,6 @@ import { useStore } from '@/app/components/workflow/store'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
const Panel = () => { const Panel = () => {
const { t } = useTranslation()
const setShowPanel = useStore(s => s.setShowGlobalVariablePanel) const setShowPanel = useStore(s => s.setShowGlobalVariablePanel)
const globalVariableList: GlobalVariable[] = [ const globalVariableList: GlobalVariable[] = [

View File

@ -72,7 +72,7 @@ const ChangePasswordForm = () => {
catch { catch {
await revalidateToken() await revalidateToken()
} }
}, [password, revalidateToken, token, valid]) }, [confirmPassword, password, revalidateToken, searchParams, valid])
return ( return (
<div className={ <div className={

View File

@ -16,7 +16,7 @@ import {
fetchSetupStatus, fetchSetupStatus,
sendForgotPasswordEmail, sendForgotPasswordEmail,
} from '@/service/common' } from '@/service/common'
import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common' import type { InitValidateStatusResponse } from '@/models/common'
const accountFormSchema = z.object({ const accountFormSchema = z.object({
email: z email: z
@ -67,7 +67,7 @@ const ForgotPasswordForm = () => {
} }
useEffect(() => { useEffect(() => {
fetchSetupStatus().then((res: SetupStatusResponse) => { fetchSetupStatus().then(() => {
fetchInitValidateStatus().then((res: InitValidateStatusResponse) => { fetchInitValidateStatus().then((res: InitValidateStatusResponse) => {
if (res.status === 'not_started') if (res.status === 'not_started')
window.location.href = '/init' window.location.href = '/init'

View File

@ -42,7 +42,7 @@ async function translateMissingKeyDeeply(sourceObj, targetObject, toLanguage) {
const { translation } = await translate(sourceObj[key], null, languageKeyMap[toLanguage]) const { translation } = await translate(sourceObj[key], null, languageKeyMap[toLanguage])
targetObject[key] = translation targetObject[key] = translation
} }
catch (e) { catch {
console.error(`Error translating ${sourceObj[key]}(${key}) to ${toLanguage}`) console.error(`Error translating ${sourceObj[key]}(${key}) to ${toLanguage}`)
} }
} }

View File

@ -169,7 +169,7 @@ const handleStream = (
try { try {
bufferObj = JSON.parse(message.substring(6)) as Record<string, any>// remove data: and parse as json bufferObj = JSON.parse(message.substring(6)) as Record<string, any>// remove data: and parse as json
} }
catch (e) { catch {
// mute handle message cut off // mute handle message cut off
onData('', isFirstMessage, { onData('', isFirstMessage, {
conversationId: bufferObj?.conversation_id, conversationId: bufferObj?.conversation_id,

View File

@ -88,7 +88,7 @@ export function getAccessToken(isPublicAPI?: boolean) {
try { try {
accessTokenJson = JSON.parse(accessToken) accessTokenJson = JSON.parse(accessToken)
} }
catch (e) { catch {
} }
return accessTokenJson[sharedToken] return accessTokenJson[sharedToken]

View File

@ -5,7 +5,7 @@ const LOCAL_STORAGE_KEY = 'is_other_tab_refreshing'
let isRefreshing = false let isRefreshing = false
function waitUntilTokenRefreshed() { function waitUntilTokenRefreshed() {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve) => {
function _check() { function _check() {
const isRefreshingSign = globalThis.localStorage.getItem(LOCAL_STORAGE_KEY) const isRefreshingSign = globalThis.localStorage.getItem(LOCAL_STORAGE_KEY)
if ((isRefreshingSign && isRefreshingSign === '1') || isRefreshing) { if ((isRefreshingSign && isRefreshingSign === '1') || isRefreshing) {

View File

@ -491,7 +491,7 @@ export const useModelInList = (currentProvider?: ModelProvider, modelId?: string
const modelsData = await fetchModelProviderModelList(`/workspaces/current/model-providers/${currentProvider?.provider}/models`) const modelsData = await fetchModelProviderModelList(`/workspaces/current/model-providers/${currentProvider?.provider}/models`)
return !!modelId && !!modelsData.data.find(item => item.model === modelId) return !!modelId && !!modelsData.data.find(item => item.model === modelId)
} }
catch (error) { catch {
return false return false
} }
}, },
@ -511,7 +511,7 @@ export const usePluginInfo = (providerName?: string) => {
const response = await fetchPluginInfoFromMarketPlace({ org, name }) const response = await fetchPluginInfoFromMarketPlace({ org, name })
return response.data.plugin.category === PluginTypeEnum.model ? response.data.plugin : null return response.data.plugin.category === PluginTypeEnum.model ? response.data.plugin : null
} }
catch (error) { catch {
return null return null
} }
}, },