Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

2.0 KB
Raw Blame
import type { DatasetDetailWithPartialMembersResponse } from '@dify/contracts/api/console/datasets/types.gen'
import { zDatasetListItemResponse } from '@dify/contracts/api/console/datasets/zod.gen'

/** A general-purpose, high-quality knowledge base as the console dataset list returns it. */
export const createDatasetFixture = (
  overrides: Partial<DatasetDetailWithPartialMembersResponse> = {},
) =>
  zDatasetListItemResponse.parse({
    id: 'dataset-1',
    knowledge_fs_upgrade: { can_retry: false, can_upgrade: false },
    name: 'Test Dataset',
    description: 'Test description',
    provider: 'vendor',
    permission: 'only_me',
    data_source_type: 'upload_file',
    indexing_technique: 'high_quality',
    keyword_number: 10,
    app_count: 0,
    document_count: 0,
    word_count: 0,
    created_by: 'user-1',
    author_name: 'Test Author',
    created_at: 1700000000,
    updated_by: 'user-1',
    updated_at: 1700000000,
    embedding_model: 'text-embedding-ada-002',
    embedding_model_provider: 'openai',
    embedding_available: true,
    retrieval_model_dict: {
      search_method: 'semantic_search',
      reranking_enable: false,
      reranking_model: { reranking_provider_name: '', reranking_model_name: '' },
      top_k: 3,
      score_threshold_enabled: false,
      score_threshold: 0.5,
    },
    summary_index_setting: {},
    tags: [],
    doc_form: 'text_model',
    external_knowledge_info: {},
    external_retrieval_model: { top_k: 3, score_threshold: 0.5, score_threshold_enabled: false },
    doc_metadata: [],
    built_in_field_enabled: false,
    pipeline_id: null,
    runtime_mode: 'general',
    chunk_structure: null,
    icon_info: { icon_type: 'emoji', icon: '📙', icon_background: '#FFF4ED', icon_url: '' },
    is_published: false,
    total_documents: 0,
    total_available_documents: 0,
    enable_api: true,
    is_multimodal: false,
    permission_keys: [],
    maintainer: null,
    ...overrides,
    partial_member_list: overrides.partial_member_list ?? [],
  })