chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动

演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-18 13:59:25 +08:00
1 parent 60158935f4
commit 6519682885
15831 files changed
+3063428

No files matched your search

@@ -0,0 +1,49 @@
import type {
DocumentResponse,
DocumentStatusResponse,
} from '@dify/contracts/api/console/datasets/types.gen'
import { toCreationDataSourceType } from '@/app/components/datasets/dataset-fields'
import { getNotionPageIcon } from '@/app/components/datasets/documents/document-source'
const EMBEDDING_STATUSES = ['indexing', 'splitting', 'parsing', 'cleaning', 'waiting'] as const
/**
* Check if a status indicates the source is being embedded
*/
export const isSourceEmbedding = (detail: DocumentStatusResponse): boolean =>
EMBEDDING_STATUSES.includes(detail.indexing_status as (typeof EMBEDDING_STATUSES)[number])
/**
* Calculate the progress percentage for a document
*/
export const getSourcePercent = (detail: DocumentStatusResponse): number => {
const completedCount = detail.completed_segments || 0
const totalCount = detail.total_segments || 0
if (totalCount === 0) return 0
const percent = Math.round((completedCount * 100) / totalCount)
return Math.min(percent, 100)
}
/**
* Get file extension from filename, defaults to 'txt'
*/
export const getFileType = (name?: string): string => name?.split('.').pop() || 'txt'
/**
* Document lookup utilities - provides document info by ID from a list
*/
export const createDocumentLookup = (documents: DocumentResponse[]) => {
const documentMap = new Map(documents.map((doc) => [doc.id, doc]))
return {
getDocument: (id: string) => documentMap.get(id),
getName: (id: string) => documentMap.get(id)?.name,
getSourceType: (id: string) => toCreationDataSourceType(documentMap.get(id)?.data_source_type),
getNotionIcon: (id: string) => getNotionPageIcon(documentMap.get(id)?.data_source_info, false),
}
}