mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 14:45:53 +08:00
Chore/cleanup warnings (#17974)
This commit is contained in:
parent
f84832e0c2
commit
8f9cbe1c49
@ -1,8 +1,6 @@
|
||||
import React from 'react'
|
||||
|
||||
type Props = {}
|
||||
|
||||
const page = (props: Props) => {
|
||||
const page = () => {
|
||||
return (
|
||||
<div>dataset detail api</div>
|
||||
)
|
||||
|
@ -61,7 +61,7 @@ const DatasetCard = ({
|
||||
if (onSuccess)
|
||||
onSuccess()
|
||||
}
|
||||
catch (e: any) {
|
||||
catch {
|
||||
}
|
||||
setShowConfirmDelete(false)
|
||||
}, [dataset.id, notify, onSuccess, t])
|
||||
|
@ -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()
|
||||
|
||||
|
@ -56,7 +56,7 @@ const AddAnnotationModal: FC<Props> = ({
|
||||
try {
|
||||
await onAdd(payload)
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
}
|
||||
setIsSaving(false)
|
||||
|
||||
|
@ -90,7 +90,7 @@ const Annotation: FC<Props> = ({
|
||||
setList(data as AnnotationItem[])
|
||||
setTotal(total)
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
|
||||
}
|
||||
setIsLoading(false)
|
||||
|
@ -55,7 +55,7 @@ const ViewAnnotationModal: FC<Props> = ({
|
||||
setHitHistoryList(data as HitHistoryItem[])
|
||||
setTotal(total)
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ const SettingBuiltInTool: FC<Props> = ({
|
||||
setTempSetting(addDefaultValue(setting, formSchemas))
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
catch { }
|
||||
setIsLoading(false)
|
||||
})()
|
||||
}, [collection?.name, collection?.id, collection?.type])
|
||||
|
@ -150,7 +150,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
|
||||
retrieval_model_dict: retrievalConfig,
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
|
||||
}
|
||||
finally {
|
||||
|
@ -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') })
|
||||
}
|
||||
}
|
||||
|
@ -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 <div
|
||||
className={
|
||||
cn(`relative box-content h-[84px] w-[191px] cursor-pointer rounded-xl
|
||||
|
@ -30,7 +30,7 @@ const LogAnnotation: FC<Props> = ({
|
||||
{ value: PageType.log, text: t('appLog.title') },
|
||||
{ value: PageType.annotation, text: t('appAnnotation.title') },
|
||||
]
|
||||
}, [appDetail])
|
||||
}, [appDetail?.mode, t])
|
||||
|
||||
if (!appDetail) {
|
||||
return (
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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') })
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export class AudioPlayerManager {
|
||||
this.audioPlayers.cacheBuffers = []
|
||||
this.audioPlayers.sourceBuffer?.abort()
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ export default class AudioPlayer {
|
||||
this.receiveAudioData(value)
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
this.isLoadData = false
|
||||
this.callback && this.callback('error')
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ const AudioPlayer: React.FC<AudioPlayerProps> = ({ src }) => {
|
||||
setWaveformData(normalizedWaveform)
|
||||
setIsAudioAvailable(true)
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
const waveform: number[] = []
|
||||
let prevValue = Math.random()
|
||||
|
||||
|
@ -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<IThoughtProps> = ({
|
||||
if (Array.isArray(JSON.parse(thought.tool)))
|
||||
return [JSON.parse(thought.tool), true]
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
}
|
||||
return [[thought.tool], false]
|
||||
})()
|
||||
|
@ -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)!
|
||||
|
@ -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({
|
||||
|
@ -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])
|
||||
|
@ -51,7 +51,7 @@ export const SVGRenderer = ({ content }: { content: string }) => {
|
||||
setImagePreview(svgToDataURL(svgElement as Element))
|
||||
})
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
if (svgRef.current)
|
||||
svgRef.current.innerHTML = '<span style="padding: 1rem;">Error rendering SVG. Wait for the image content to complete.</span>'
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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') })
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ const TagItemEditor: FC<TagItemEditorProps> = ({
|
||||
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<TagItemEditorProps> = ({
|
||||
])
|
||||
setPending(false)
|
||||
}
|
||||
catch (e: any) {
|
||||
catch {
|
||||
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
|
||||
setPending(false)
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ try {
|
||||
localStorage = globalThis.localStorage
|
||||
sessionStorage = globalThis.sessionStorage
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
localStorage = new StorageMock()
|
||||
sessionStorage = new StorageMock()
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import React from 'react'
|
||||
|
||||
type Props = {}
|
||||
|
||||
const index = (props: Props) => {
|
||||
const index = () => {
|
||||
return (
|
||||
<div>index</div>
|
||||
)
|
||||
|
@ -184,7 +184,7 @@ const EmbeddingProcess: FC<Props> = ({ datasetId, batchId, documents = [], index
|
||||
await sleep(2500)
|
||||
await startQueryStatus()
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
await sleep(2500)
|
||||
await startQueryStatus()
|
||||
}
|
||||
|
@ -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') })
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ const JinaReader: FC<Props> = ({
|
||||
},
|
||||
}
|
||||
}
|
||||
}, [crawlOptions.limit])
|
||||
}, [crawlOptions.limit, onCheckedCrawlResultChange])
|
||||
|
||||
const handleRun = useCallback(async (url: string) => {
|
||||
const { isValid, errorMsg } = checkValid(url)
|
||||
@ -186,7 +186,7 @@ const JinaReader: FC<Props> = ({
|
||||
finally {
|
||||
setStep(Step.finished)
|
||||
}
|
||||
}, [checkValid, crawlOptions, onJobIdChange, t, waitForCrawlFinished])
|
||||
}, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, t, waitForCrawlFinished])
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -193,7 +193,7 @@ const EmbeddingDetail: FC<IEmbeddingDetailProps> = ({
|
||||
await sleep(2500)
|
||||
await startQueryStatus()
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
await sleep(2500)
|
||||
await startQueryStatus()
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ const DocumentDetail: FC<Props> = ({ 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<Props> = ({ datasetId, documentId }) => {
|
||||
}
|
||||
|
||||
const isDetailLoading = !documentDetail && !error
|
||||
const isMetadataLoading = !documentMetadata && !metadataErr
|
||||
|
||||
const embedding = ['queuing', 'indexing', 'paused'].includes((documentDetail?.display_status || '').toLowerCase())
|
||||
|
||||
|
@ -14,7 +14,7 @@ const ChildChunks: FC<Props> = ({
|
||||
payload,
|
||||
isShowAll,
|
||||
}) => {
|
||||
const { id, score, content, position } = payload
|
||||
const { score, content, position } = payload
|
||||
return (
|
||||
<div
|
||||
className={!isShowAll ? 'line-clamp-2 break-all' : ''}
|
||||
|
@ -55,7 +55,7 @@ const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDataset
|
||||
onSuccess()
|
||||
onClose()
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
|
||||
}
|
||||
finally {
|
||||
|
@ -160,7 +160,7 @@ const Form = () => {
|
||||
mutate(unstable_serialize(getKey))
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
|
||||
}
|
||||
finally {
|
||||
|
@ -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') })
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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') })
|
||||
}
|
||||
}
|
||||
|
@ -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') || []
|
||||
|
||||
|
@ -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<string>(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') })
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ const InviteModal = ({
|
||||
onSend(invitation_results)
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
catch { }
|
||||
}
|
||||
else {
|
||||
notify({ type: 'error', message: t('common.members.emailInvalid') })
|
||||
|
@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
|
||||
renderTrigger,
|
||||
readonly,
|
||||
isInWorkflow,
|
||||
scope = 'text-generation',
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { isAPIKeySet } = useProviderContext()
|
||||
|
@ -102,7 +102,7 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({ updatePayload, on
|
||||
})
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t('plugin.error.fetchReleasesError'),
|
||||
|
@ -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])
|
||||
|
@ -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 {
|
||||
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ const SwrInitor = ({
|
||||
|
||||
setInit(true)
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
router.replace('/signin')
|
||||
}
|
||||
})()
|
||||
|
@ -98,7 +98,7 @@ const EditCustomCollectionModal: FC<Props> = ({
|
||||
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<Props> = ({
|
||||
const path = decodeURI(new URL(url).pathname)
|
||||
return path || ''
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ const EditCustomCollectionModal: FC<Props> = ({
|
||||
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<Props> = ({
|
||||
const path = decodeURI(new URL(url).pathname)
|
||||
return path || ''
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ const ProviderDetail = ({
|
||||
setToolList(list)
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
catch { }
|
||||
setIsDetailLoading(false)
|
||||
}, [collection.name, collection.type])
|
||||
|
||||
|
@ -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])
|
||||
|
@ -123,7 +123,7 @@ const BeforeRunForm: FC<BeforeRunFormProps> = ({
|
||||
const value = formatValue(form.values[input.variable], input.type)
|
||||
submitData[input.variable] = value
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
parseErrorJsonField = input.variable
|
||||
}
|
||||
})
|
||||
|
@ -119,7 +119,7 @@ const CodeEditor: FC<Props> = ({
|
||||
try {
|
||||
return JSON.stringify(value as object, null, 2)
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return value as string
|
||||
}
|
||||
})()
|
||||
|
@ -1,5 +1,3 @@
|
||||
import type { CodeNodeType } from './types'
|
||||
|
||||
export const checkNodeValid = (payload: CodeNodeType) => {
|
||||
export const checkNodeValid = () => {
|
||||
return true
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ const ConditionValue = ({
|
||||
: ''
|
||||
}
|
||||
return ''
|
||||
}, [])
|
||||
}, [t])
|
||||
|
||||
return (
|
||||
<div className='rounded-md bg-workflow-block-parma-bg'>
|
||||
|
@ -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(() => {
|
||||
|
@ -133,7 +133,7 @@ const useConfig = (id: string, payload: IfElseNodeType) => {
|
||||
})
|
||||
setInputs(newInputs)
|
||||
updateNodeInternals(id)
|
||||
}, [inputs, setInputs])
|
||||
}, [id, inputs, setInputs, updateNodeInternals])
|
||||
|
||||
const handleAddCondition = useCallback<HandleAddCondition>((caseId, valueSelector, varItem) => {
|
||||
const newInputs = produce(inputs, (draft) => {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import type { QuestionClassifierNodeType } from './types'
|
||||
|
||||
export const checkNodeValid = (payload: QuestionClassifierNodeType) => {
|
||||
export const checkNodeValid = () => {
|
||||
return true
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export const NoteEditorContextProvider = memo(({
|
||||
try {
|
||||
initialValue = JSON.parse(value)
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ const ChatRecord = () => {
|
||||
setChatItemTree(tree)
|
||||
setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id))
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
}
|
||||
finally {
|
||||
setFetched(true)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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[] = [
|
||||
|
@ -72,7 +72,7 @@ const ChangePasswordForm = () => {
|
||||
catch {
|
||||
await revalidateToken()
|
||||
}
|
||||
}, [password, revalidateToken, token, valid])
|
||||
}, [confirmPassword, password, revalidateToken, searchParams, valid])
|
||||
|
||||
return (
|
||||
<div className={
|
||||
|
@ -16,7 +16,7 @@ import {
|
||||
fetchSetupStatus,
|
||||
sendForgotPasswordEmail,
|
||||
} from '@/service/common'
|
||||
import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common'
|
||||
import type { InitValidateStatusResponse } from '@/models/common'
|
||||
|
||||
const accountFormSchema = z.object({
|
||||
email: z
|
||||
@ -67,7 +67,7 @@ const ForgotPasswordForm = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
fetchSetupStatus().then((res: SetupStatusResponse) => {
|
||||
fetchSetupStatus().then(() => {
|
||||
fetchInitValidateStatus().then((res: InitValidateStatusResponse) => {
|
||||
if (res.status === 'not_started')
|
||||
window.location.href = '/init'
|
||||
|
@ -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}`)
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ const handleStream = (
|
||||
try {
|
||||
bufferObj = JSON.parse(message.substring(6)) as Record<string, any>// remove data: and parse as json
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
// mute handle message cut off
|
||||
onData('', isFirstMessage, {
|
||||
conversationId: bufferObj?.conversation_id,
|
||||
|
@ -88,7 +88,7 @@ export function getAccessToken(isPublicAPI?: boolean) {
|
||||
try {
|
||||
accessTokenJson = JSON.parse(accessToken)
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
|
||||
}
|
||||
return accessTokenJson[sharedToken]
|
||||
|
@ -5,7 +5,7 @@ const LOCAL_STORAGE_KEY = 'is_other_tab_refreshing'
|
||||
|
||||
let isRefreshing = false
|
||||
function waitUntilTokenRefreshed() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
function _check() {
|
||||
const isRefreshingSign = globalThis.localStorage.getItem(LOCAL_STORAGE_KEY)
|
||||
if ((isRefreshingSign && isRefreshingSign === '1') || isRefreshing) {
|
||||
|
@ -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
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user