2025-07-25 15:01:28 +08:00
|
|
|
import { LanguagesSupported } from '@/i18n-config/language'
|
2025-05-03 20:03:56 +08:00
|
|
|
|
2025-02-17 17:05:13 +08:00
|
|
|
import {
|
|
|
|
|
categoryKeys,
|
|
|
|
|
tagKeys,
|
|
|
|
|
} from './constants'
|
|
|
|
|
|
|
|
|
|
export const getValidTagKeys = (tags: string[]) => {
|
|
|
|
|
return tags.filter(tag => tagKeys.includes(tag))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getValidCategoryKeys = (category?: string) => {
|
|
|
|
|
return categoryKeys.find(key => key === category)
|
|
|
|
|
}
|
2025-05-03 20:03:56 +08:00
|
|
|
|
|
|
|
|
export const getDocsUrl = (locale: string, path: string) => {
|
|
|
|
|
let localePath = 'en'
|
|
|
|
|
|
|
|
|
|
if (locale === LanguagesSupported[1])
|
|
|
|
|
localePath = 'zh-hans'
|
|
|
|
|
|
|
|
|
|
else if (locale === LanguagesSupported[7])
|
|
|
|
|
localePath = 'ja-jp'
|
|
|
|
|
|
|
|
|
|
return `https://docs.dify.ai/${localePath}${path}`
|
|
|
|
|
}
|