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
69 changed files with 89 additions and 117 deletions

View File

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

View File

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

View File

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

View File

@@ -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]
})()

View File

@@ -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)!

View File

@@ -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({

View File

@@ -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])

View File

@@ -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>'
}

View File

@@ -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)
}

View File

@@ -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') })
}
}

View File

@@ -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)
}

View File

@@ -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()
}
}