Fix type error (#27274)

This commit is contained in:
GuanMu 2025-10-22 17:08:27 +08:00 committed by GitHub
parent 40d3332690
commit c61c2b0abd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 55 additions and 54 deletions

View File

@ -53,7 +53,6 @@ const Annotation: FC<Props> = (props) => {
const [isShowViewModal, setIsShowViewModal] = useState(false)
const [selectedIds, setSelectedIds] = useState<string[]>([])
const debouncedQueryParams = useDebounce(queryParams, { wait: 500 })
const [isBatchDeleting, setIsBatchDeleting] = useState(false)
const fetchAnnotationConfig = async () => {
const res = await doFetchAnnotationConfig(appDetail.id)
@ -108,9 +107,6 @@ const Annotation: FC<Props> = (props) => {
}
const handleBatchDelete = async () => {
if (isBatchDeleting)
return
setIsBatchDeleting(true)
try {
await delAnnotations(appDetail.id, selectedIds)
Toast.notify({ message: t('common.api.actionSuccess'), type: 'success' })
@ -121,9 +117,6 @@ const Annotation: FC<Props> = (props) => {
catch (e: any) {
Toast.notify({ type: 'error', message: e.message || t('common.api.actionFailed') })
}
finally {
setIsBatchDeleting(false)
}
}
const handleView = (item: AnnotationItem) => {
@ -213,7 +206,6 @@ const Annotation: FC<Props> = (props) => {
onSelectedIdsChange={setSelectedIds}
onBatchDelete={handleBatchDelete}
onCancel={() => setSelectedIds([])}
isBatchDeleting={isBatchDeleting}
/>
: <div className='flex h-full grow items-center justify-center'><EmptyElement /></div>
}

View File

@ -19,7 +19,6 @@ type Props = {
onSelectedIdsChange: (selectedIds: string[]) => void
onBatchDelete: () => Promise<void>
onCancel: () => void
isBatchDeleting?: boolean
}
const List: FC<Props> = ({
@ -30,7 +29,6 @@ const List: FC<Props> = ({
onSelectedIdsChange,
onBatchDelete,
onCancel,
isBatchDeleting,
}) => {
const { t } = useTranslation()
const { formatTime } = useTimestamp()
@ -142,7 +140,6 @@ const List: FC<Props> = ({
selectedIds={selectedIds}
onBatchDelete={onBatchDelete}
onCancel={onCancel}
isBatchDeleting={isBatchDeleting}
/>
)}
</div>

View File

@ -78,7 +78,9 @@ const AdvancedPromptInput: FC<Props> = ({
const handleOpenExternalDataToolModal = () => {
setShowExternalDataToolModal({
payload: {},
onSaveCallback: (newExternalDataTool: ExternalDataTool) => {
onSaveCallback: (newExternalDataTool?: ExternalDataTool) => {
if (!newExternalDataTool)
return
eventEmitter?.emit({
type: ADD_EXTERNAL_DATA_TOOL,
payload: newExternalDataTool,

View File

@ -76,7 +76,9 @@ const Prompt: FC<ISimplePromptInput> = ({
const handleOpenExternalDataToolModal = () => {
setShowExternalDataToolModal({
payload: {},
onSaveCallback: (newExternalDataTool: ExternalDataTool) => {
onSaveCallback: (newExternalDataTool?: ExternalDataTool) => {
if (!newExternalDataTool)
return
eventEmitter?.emit({
type: ADD_EXTERNAL_DATA_TOOL,
payload: newExternalDataTool,

View File

@ -320,7 +320,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
{type === InputVarType.paragraph && (
<Field title={t('appDebug.variableConfig.defaultValue')}>
<Textarea
value={tempPayload.default || ''}
value={String(tempPayload.default ?? '')}
onChange={e => handlePayloadChange('default')(e.target.value || undefined)}
placeholder={t('appDebug.variableConfig.inputPlaceholder')!}
/>

View File

@ -121,7 +121,9 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
icon,
icon_background,
},
onSaveCallback: (newExternalDataTool: ExternalDataTool) => {
onSaveCallback: (newExternalDataTool?: ExternalDataTool) => {
if (!newExternalDataTool)
return
const newPromptVariables = oldPromptVariables.map((item, i) => {
if (i === index) {
return {

View File

@ -51,7 +51,9 @@ const Editor: FC<Props> = ({
const handleOpenExternalDataToolModal = () => {
setShowExternalDataToolModal({
payload: {},
onSaveCallback: (newExternalDataTool: ExternalDataTool) => {
onSaveCallback: (newExternalDataTool?: ExternalDataTool) => {
if (!newExternalDataTool)
return
setExternalDataToolsConfig([...externalDataToolsConfig, newExternalDataTool])
},
onValidateBeforeSaveCallback: (newExternalDataTool: ExternalDataTool) => {

View File

@ -109,7 +109,7 @@ const Debug: FC<IDebug> = ({
setIsShowFormattingChangeConfirm(true)
}, [formattingChanged])
const debugWithSingleModelRef = React.useRef<DebugWithSingleModelRefType | null>(null)
const debugWithSingleModelRef = React.useRef<DebugWithSingleModelRefType>(null!)
const handleClearConversation = () => {
debugWithSingleModelRef.current?.handleRestart()
}

View File

@ -76,7 +76,11 @@ const Tools = () => {
const handleOpenExternalDataToolModal = (payload: ExternalDataTool, index: number) => {
setShowExternalDataToolModal({
payload,
onSaveCallback: (externalDataTool: ExternalDataTool) => handleSaveExternalDataToolModal(externalDataTool, index),
onSaveCallback: (externalDataTool?: ExternalDataTool) => {
if (!externalDataTool)
return
handleSaveExternalDataToolModal(externalDataTool, index)
},
onValidateBeforeSaveCallback: (newExternalDataTool: ExternalDataTool) => handleValidateBeforeSaveExternalDataToolModal(newExternalDataTool, index),
})
}

View File

@ -84,7 +84,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
handleFile(droppedFile)
}, [droppedFile])
const onCreate: MouseEventHandler = async () => {
const onCreate = async (_e?: React.MouseEvent) => {
if (currentTab === CreateFromDSLModalTab.FROM_FILE && !currentFile)
return
if (currentTab === CreateFromDSLModalTab.FROM_URL && !dslUrlValue)
@ -154,7 +154,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
useKeyPress(['meta.enter', 'ctrl.enter'], () => {
if (show && !isAppsFull && ((currentTab === CreateFromDSLModalTab.FROM_FILE && currentFile) || (currentTab === CreateFromDSLModalTab.FROM_URL && dslUrlValue)))
handleCreateApp()
handleCreateApp(undefined)
})
useKeyPress('esc', () => {

View File

@ -6,7 +6,7 @@ import Button from '../button'
export type IConfirm = {
className?: string
isShow: boolean
type?: 'info' | 'warning'
type?: 'info' | 'warning' | 'danger'
title: string
content?: React.ReactNode
confirmText?: string | null

View File

@ -2,6 +2,6 @@ import type { TypeWithI18N } from '@/app/components/header/account-setting/model
export type Label = {
name: string
label: TypeWithI18N
icon: string
label: TypeWithI18N | string
icon?: string
}

View File

@ -7,6 +7,7 @@ export enum LOC {
export enum AuthType {
none = 'none',
apiKey = 'api_key', // backward compatibility
apiKeyHeader = 'api_key_header',
apiKeyQuery = 'api_key_query',
}

View File

@ -1,4 +1,4 @@
import type { AliyunConfig, ArizeConfig, LangFuseConfig, LangSmithConfig, OpikConfig, PhoenixConfig, TracingProvider, WeaveConfig } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
import type { AliyunConfig, ArizeConfig, LangFuseConfig, LangSmithConfig, OpikConfig, PhoenixConfig, TencentConfig, TracingProvider, WeaveConfig } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
import type { App, AppMode, AppTemplate, SiteConfig } from '@/types/app'
import type { Dependency } from '@/app/components/plugins/types'
@ -109,5 +109,5 @@ export type TracingStatus = {
export type TracingConfig = {
tracing_provider: TracingProvider
tracing_config: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig
tracing_config: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig | TencentConfig
}

View File

@ -222,6 +222,8 @@
},
"pnpm": {
"overrides": {
"lexical": "0.37.0",
"@lexical/*": "0.37.0",
"@eslint/plugin-kit@<0.3.4": "0.3.4",
"brace-expansion@<2.0.2": "2.0.2",
"devalue@<5.3.2": "5.3.2",

View File

@ -15,6 +15,8 @@ overrides:
vite: ~6.2
prismjs: ~1.30
brace-expansion: ~2.0
lexical: 0.37.0
'@lexical/*': 0.37.0
'@eslint/plugin-kit@<0.3.4': 0.3.4
brace-expansion@<2.0.2: 2.0.2
devalue@<5.3.2: 5.3.2
@ -199,8 +201,8 @@ importers:
specifier: ^1.2.1
version: 1.2.1
lexical:
specifier: ^0.36.2
version: 0.36.2
specifier: 0.37.0
version: 0.37.0
line-clamp:
specifier: ^1.0.0
version: 1.0.0
@ -6241,9 +6243,6 @@ packages:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
lexical@0.36.2:
resolution: {integrity: sha512-gIDJCmSAhtxD7h95WK17Nz19wCZu92Zn0p1/R45X01S/KAsLCwEtVJ2fTvIJNFTyx3QNJTuGcm5mYgRMUwq8rg==}
lexical@0.37.0:
resolution: {integrity: sha512-r5VJR2TioQPAsZATfktnJFrGIiy6gjQN8b/+0a2u1d7/QTH7lhbB7byhGSvcq1iaa1TV/xcf/pFV55a5V5hTDQ==}
@ -10538,7 +10537,7 @@ snapshots:
'@lexical/list': 0.36.2
'@lexical/selection': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/clipboard@0.37.0':
dependencies:
@ -10551,7 +10550,7 @@ snapshots:
'@lexical/code@0.36.2':
dependencies:
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
prismjs: 1.30.0
'@lexical/devtools-core@0.36.2(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
@ -10561,20 +10560,20 @@ snapshots:
'@lexical/mark': 0.36.2
'@lexical/table': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
'@lexical/dragon@0.36.2':
dependencies:
'@lexical/extension': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/extension@0.36.2':
dependencies:
'@lexical/utils': 0.36.2
'@preact/signals-core': 1.12.1
lexical: 0.36.2
lexical: 0.37.0
'@lexical/extension@0.37.0':
dependencies:
@ -10586,19 +10585,19 @@ snapshots:
dependencies:
'@lexical/text': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/history@0.36.2':
dependencies:
'@lexical/extension': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/html@0.36.2':
dependencies:
'@lexical/selection': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/html@0.37.0':
dependencies:
@ -10610,14 +10609,14 @@ snapshots:
dependencies:
'@lexical/extension': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/list@0.36.2':
dependencies:
'@lexical/extension': 0.36.2
'@lexical/selection': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/list@0.37.0':
dependencies:
@ -10629,7 +10628,7 @@ snapshots:
'@lexical/mark@0.36.2':
dependencies:
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/markdown@0.36.2':
dependencies:
@ -10639,15 +10638,15 @@ snapshots:
'@lexical/rich-text': 0.36.2
'@lexical/text': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/offset@0.36.2':
dependencies:
lexical: 0.36.2
lexical: 0.37.0
'@lexical/overflow@0.36.2':
dependencies:
lexical: 0.36.2
lexical: 0.37.0
'@lexical/plain-text@0.36.2':
dependencies:
@ -10655,7 +10654,7 @@ snapshots:
'@lexical/dragon': 0.36.2
'@lexical/selection': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/react@0.36.2(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(yjs@13.6.27)':
dependencies:
@ -10676,7 +10675,7 @@ snapshots:
'@lexical/text': 0.36.2
'@lexical/utils': 0.36.2
'@lexical/yjs': 0.36.2(yjs@13.6.27)
lexical: 0.36.2
lexical: 0.37.0
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
react-error-boundary: 6.0.0(react@19.1.1)
@ -10689,11 +10688,11 @@ snapshots:
'@lexical/dragon': 0.36.2
'@lexical/selection': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/selection@0.36.2':
dependencies:
lexical: 0.36.2
lexical: 0.37.0
'@lexical/selection@0.37.0':
dependencies:
@ -10704,7 +10703,7 @@ snapshots:
'@lexical/clipboard': 0.36.2
'@lexical/extension': 0.36.2
'@lexical/utils': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/table@0.37.0':
dependencies:
@ -10715,14 +10714,14 @@ snapshots:
'@lexical/text@0.36.2':
dependencies:
lexical: 0.36.2
lexical: 0.37.0
'@lexical/utils@0.36.2':
dependencies:
'@lexical/list': 0.36.2
'@lexical/selection': 0.36.2
'@lexical/table': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
'@lexical/utils@0.37.0':
dependencies:
@ -10735,7 +10734,7 @@ snapshots:
dependencies:
'@lexical/offset': 0.36.2
'@lexical/selection': 0.36.2
lexical: 0.36.2
lexical: 0.37.0
yjs: 13.6.27
'@mdx-js/loader@3.1.1(webpack@5.102.1(esbuild@0.25.0)(uglify-js@3.19.3))':
@ -15401,8 +15400,6 @@ snapshots:
prelude-ls: 1.2.1
type-check: 0.4.0
lexical@0.36.2: {}
lexical@0.37.0: {}
lib0@0.2.114: