refactor: type improvements that doesn't modify functionality (#17970)

This commit is contained in:
yusheng chen
2025-04-14 16:06:10 +08:00
committed by GitHub
parent 53efb2bad5
commit 4c99e9dc73
39 changed files with 69 additions and 63 deletions

View File

@@ -36,7 +36,7 @@ const AgentLogDetail: FC<AgentLogDetailProps> = ({
const [list, setList] = useState<AgentIteration[]>([])
const tools = useMemo(() => {
const res = uniq(flatten(runDetail?.iterations.map((iteration: any) => {
const res = uniq(flatten(runDetail?.iterations.map((iteration) => {
return iteration.tool_calls.map((tool: any) => tool.tool_name).filter(Boolean)
})).filter(Boolean))
return res

View File

@@ -29,7 +29,7 @@ const AudioBtn = ({
const params = useParams()
const pathname = usePathname()
const audio_finished_call = (event: string): any => {
const audio_finished_call = (event: string): void => {
switch (event) {
case 'ended':
setAudioState('ended')

View File

@@ -512,7 +512,7 @@ export const useChat = (
responseItem.workflowProcess!.tracing!.push({
...iterationStartedData,
status: WorkflowRunningStatus.Running,
} as any)
})
updateCurrentQAOnTree({
placeholderQuestionId,
questionItem,
@@ -528,7 +528,7 @@ export const useChat = (
...tracing[iterationIndex],
...iterationFinishedData,
status: WorkflowRunningStatus.Succeeded,
} as any
}
updateCurrentQAOnTree({
placeholderQuestionId,
@@ -547,7 +547,7 @@ export const useChat = (
responseItem.workflowProcess!.tracing!.push({
...nodeStartedData,
status: WorkflowRunningStatus.Running,
} as any)
})
updateCurrentQAOnTree({
placeholderQuestionId,
questionItem,
@@ -590,7 +590,7 @@ export const useChat = (
responseItem.workflowProcess!.tracing!.push({
...loopStartedData,
status: WorkflowRunningStatus.Running,
} as any)
})
updateCurrentQAOnTree({
placeholderQuestionId,
questionItem,
@@ -606,7 +606,7 @@ export const useChat = (
...tracing[loopIndex],
...loopFinishedData,
status: WorkflowRunningStatus.Succeeded,
} as any
}
updateCurrentQAOnTree({
placeholderQuestionId,

View File

@@ -12,6 +12,7 @@ import useAnnotationConfig from '@/app/components/base/features/new-feature-pane
import ConfigParamModal from '@/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal'
import AnnotationFullModal from '@/app/components/billing/annotation-full/modal'
import { ANNOTATION_DEFAULT } from '@/config'
import type { AnnotationReplyConfig } from '@/models/debug'
type Props = {
disabled?: boolean
@@ -30,7 +31,7 @@ const AnnotationReply = ({
const featuresStore = useFeaturesStore()
const annotationReply = useFeatures(s => s.features.annotationReply)
const updateAnnotationReply = useCallback((newConfig: any) => {
const updateAnnotationReply = useCallback((newConfig: AnnotationReplyConfig) => {
const {
features,
setFeatures,

View File

@@ -47,7 +47,7 @@ const WorkflowVariableBlockReplacementBlock = ({
}
}, [])
const transformListener = useCallback((textNode: any) => {
const transformListener = useCallback((textNode: CustomTextNode) => {
resetReg()
return decoratorTransform(textNode, getMatch, createWorkflowVariableBlockNode)
}, [createWorkflowVariableBlockNode, getMatch])

View File

@@ -1,3 +1,4 @@
import type { ReactNode } from 'react'
import React from 'react'
import { act, render, screen, waitFor } from '@testing-library/react'
import Toast, { ToastProvider, useToastContext } from '.'
@@ -80,7 +81,7 @@ describe('Toast', () => {
const CustomToastContext = React.createContext({ notify: noop, close: undefined })
// Create a wrapper component using the custom context
const Wrapper = ({ children }: any) => (
const Wrapper = ({ children }: { children: ReactNode }) => (
<CustomToastContext.Provider value={{ notify: noop, close: undefined }}>
{children}
</CustomToastContext.Provider>