feat: upgrade knowledge metadata (#16063)

Support filter knowledge by metadata.

Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: NFish <douxc512@gmail.com>
This commit is contained in:
zxhlyh
2025-03-18 11:01:06 +08:00
committed by GitHub
parent 475b8d731e
commit 20376ca951
72 changed files with 4775 additions and 101 deletions

View File

@@ -0,0 +1,28 @@
import { useTranslation } from 'react-i18next'
const i18nPrefix = 'dataset.metadata.checkName'
const useCheckMetadataName = () => {
const { t } = useTranslation()
return {
checkName: (name: string) => {
if (!name) {
return {
errorMsg: t(`${i18nPrefix}.empty`),
}
}
if (!/^[a-z][a-z0-9_]*$/.test(name)) {
return {
errorMsg: t(`${i18nPrefix}.invalid`),
}
}
return {
errorMsg: '',
}
},
}
}
export default useCheckMetadataName