mirror of
https://github.com/langgenius/dify.git
synced 2026-03-20 05:57:59 +08:00
Merge remote-tracking branch 'origin/main' into feat/trigger
This commit is contained in:
16
web/hooks/use-api-access-url.ts
Normal file
16
web/hooks/use-api-access-url.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { useMemo } from 'react'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
|
||||
export const useDatasetApiAccessUrl = () => {
|
||||
const locale = useGetLanguage()
|
||||
|
||||
const apiReferenceUrl = useMemo(() => {
|
||||
if (locale === 'zh_Hans')
|
||||
return 'https://docs.dify.ai/api-reference/%E6%95%B0%E6%8D%AE%E9%9B%86'
|
||||
if (locale === 'ja_JP')
|
||||
return 'https://docs.dify.ai/api-reference/%E3%83%87%E3%83%BC%E3%82%BF%E3%82%BB%E3%83%83%E3%83%88'
|
||||
return 'https://docs.dify.ai/api-reference/datasets'
|
||||
}, [locale])
|
||||
|
||||
return apiReferenceUrl
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||
import { useFavicon, useTitle } from 'ahooks'
|
||||
import { basePath } from '@/utils/var'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export default function useDocumentTitle(title: string) {
|
||||
const isPending = useGlobalPublicStore(s => s.isGlobalPending)
|
||||
@ -20,5 +21,24 @@ export default function useDocumentTitle(title: string) {
|
||||
}
|
||||
}
|
||||
useTitle(titleStr)
|
||||
useEffect(() => {
|
||||
let apple: HTMLLinkElement | null = null
|
||||
if (systemFeatures.branding.favicon) {
|
||||
document
|
||||
.querySelectorAll(
|
||||
'link[rel=\'icon\'], link[rel=\'shortcut icon\'], link[rel=\'apple-touch-icon\'], link[rel=\'mask-icon\']',
|
||||
)
|
||||
.forEach(n => n.parentNode?.removeChild(n))
|
||||
|
||||
apple = document.createElement('link')
|
||||
apple.rel = 'apple-touch-icon'
|
||||
apple.href = systemFeatures.branding.favicon
|
||||
document.head.appendChild(apple)
|
||||
}
|
||||
|
||||
return () => {
|
||||
apple?.remove()
|
||||
}
|
||||
}, [systemFeatures.branding.favicon])
|
||||
useFavicon(favicon)
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { formatFileSize, formatNumber, formatTime } from '@/utils/format'
|
||||
import { type DocType, ProcessMode } from '@/models/datasets'
|
||||
import { ChunkingMode, type DocType } from '@/models/datasets'
|
||||
import useTimestamp from '@/hooks/use-timestamp'
|
||||
|
||||
export type inputType = 'input' | 'select' | 'textarea'
|
||||
@ -248,9 +248,17 @@ export const useMetadataMap = (): MetadataMap => {
|
||||
text: t('datasetDocuments.metadata.type.technicalParameters'),
|
||||
allowEdit: false,
|
||||
subFieldsMap: {
|
||||
'dataset_process_rule.mode': {
|
||||
'doc_form': {
|
||||
label: t(`${fieldPrefix}.technicalParameters.segmentSpecification`),
|
||||
render: value => value === ProcessMode.general ? (t('datasetDocuments.embedding.custom') as string) : (t('datasetDocuments.embedding.hierarchical') as string),
|
||||
render: (value) => {
|
||||
if (value === ChunkingMode.text)
|
||||
return t('dataset.chunkingMode.general')
|
||||
if (value === ChunkingMode.qa)
|
||||
return t('dataset.chunkingMode.qa')
|
||||
if (value === ChunkingMode.parentChild)
|
||||
return t('dataset.chunkingMode.parentChild')
|
||||
return '--'
|
||||
},
|
||||
},
|
||||
'dataset_process_rule.rules.segmentation.max_tokens': {
|
||||
label: t(`${fieldPrefix}.technicalParameters.segmentLength`),
|
||||
|
||||
Reference in New Issue
Block a user