mirror of
https://github.com/langgenius/dify.git
synced 2026-01-14 06:07:33 +08:00
Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
30 lines
668 B
TypeScript
30 lines
668 B
TypeScript
import type {
|
|
TagKey,
|
|
} from './constants'
|
|
|
|
import { LanguagesSupported } from '@/i18n-config/language'
|
|
import {
|
|
categoryKeys,
|
|
tagKeys,
|
|
} from './constants'
|
|
|
|
export const getValidTagKeys = (tags: TagKey[]) => {
|
|
return tags.filter(tag => tagKeys.includes(tag))
|
|
}
|
|
|
|
export const getValidCategoryKeys = (category?: string) => {
|
|
return categoryKeys.find(key => key === category)
|
|
}
|
|
|
|
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}`
|
|
}
|