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
commit f4df759ba6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 149 additions and 136 deletions

View file

@ -4,6 +4,7 @@ import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Input from './input'
import Button from '@/app/components/base/button'
import { useDocLink } from '@/context/i18n'
const I18N_PREFIX = 'datasetCreation.stepOne.website'
@ -17,6 +18,7 @@ const UrlInput: FC<Props> = ({
onRun,
}) => {
const { t } = useTranslation()
const docLink = useDocLink()
const [url, setUrl] = useState('')
const handleUrlChange = useCallback((url: string | number) => {
setUrl(url as string)
@ -32,7 +34,7 @@ const UrlInput: FC<Props> = ({
<Input
value={url}
onChange={handleUrlChange}
placeholder='https://docs.dify.ai'
placeholder={docLink()}
/>
<Button
variant='primary'

View file

@ -4,6 +4,7 @@ import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Input from './input'
import Button from '@/app/components/base/button'
import { useDocLink } from '@/context/i18n'
const I18N_PREFIX = 'datasetCreation.stepOne.website'
@ -17,6 +18,7 @@ const UrlInput: FC<Props> = ({
onRun,
}) => {
const { t } = useTranslation()
const docLink = useDocLink()
const [url, setUrl] = useState('')
const handleUrlChange = useCallback((url: string | number) => {
setUrl(url as string)
@ -32,7 +34,7 @@ const UrlInput: FC<Props> = ({
<Input
value={url}
onChange={handleUrlChange}
placeholder='https://docs.dify.ai'
placeholder={docLink()}
/>
<Button
variant='primary'