refactor: generalize method for getting doc link respecting locale and fix error link paths (#20801)

This commit is contained in:
Bowen Liang
2025-06-13 16:58:43 +08:00
committed by GitHub
parent 3a628bc671
commit f4df759ba6
36 changed files with 149 additions and 136 deletions

View File

@@ -5,6 +5,7 @@ import { RiBookOpenLine } from '@remixicon/react'
import type { CreateExternalAPIReq, FormSchema } from '../declarations'
import Input from '@/app/components/base/input'
import cn from '@/utils/classnames'
import { useDocLink } from '@/context/i18n'
type FormProps = {
className?: string
@@ -26,6 +27,7 @@ const Form: FC<FormProps> = React.memo(({
inputClassName,
}) => {
const { t, i18n } = useTranslation()
const docLink = useDocLink()
const [changeKey, setChangeKey] = useState('')
const handleFormChange = (key: string, val: string) => {
@@ -57,7 +59,7 @@ const Form: FC<FormProps> = React.memo(({
</label>
{variable === 'endpoint' && (
<a
href={'https://docs.dify.ai/guides/knowledge-base/external-knowledge-api-documentation' || '/'}
href={docLink('/guides/knowledge-base/external-knowledge-api-documentation') || '/'}
target='_blank'
rel='noopener noreferrer'
className='body-xs-regular flex items-center text-text-accent'