mirror of
https://github.com/YFGaia/dify-plus.git
synced 2026-06-12 18:11:42 +08:00
feat: 合并更新到1.11.2
This commit is contained in:
@@ -24,7 +24,7 @@ export type AccessControlAccount = {
|
||||
avatarUrl: 'string'
|
||||
}
|
||||
|
||||
export type SubjectGroup = { subjectId: string; subjectType: SubjectType; groupData: AccessControlGroup }
|
||||
export type SubjectAccount = { subjectId: string; subjectType: SubjectType; accountData: AccessControlAccount }
|
||||
export type SubjectGroup = { subjectId: string, subjectType: SubjectType, groupData: AccessControlGroup }
|
||||
export type SubjectAccount = { subjectId: string, subjectType: SubjectType, accountData: AccessControlAccount }
|
||||
|
||||
export type Subject = SubjectGroup | SubjectAccount
|
||||
|
||||
+30
-66
@@ -1,63 +1,18 @@
|
||||
import type { AliyunConfig, ArizeConfig, LangFuseConfig, LangSmithConfig, OpikConfig, PhoenixConfig, TracingProvider, WeaveConfig } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
|
||||
import type { App, AppMode, AppTemplate, SiteConfig } from '@/types/app'
|
||||
import type {
|
||||
AliyunConfig,
|
||||
ArizeConfig,
|
||||
DatabricksConfig,
|
||||
LangFuseConfig,
|
||||
LangSmithConfig,
|
||||
MLflowConfig,
|
||||
OpikConfig,
|
||||
PhoenixConfig,
|
||||
TencentConfig,
|
||||
TracingProvider,
|
||||
WeaveConfig,
|
||||
} from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type'
|
||||
import type { Dependency } from '@/app/components/plugins/types'
|
||||
|
||||
/* export type App = {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
mode: AppMode
|
||||
enable_site: boolean
|
||||
enable_api: boolean
|
||||
api_rpm: number
|
||||
api_rph: number
|
||||
is_demo: boolean
|
||||
model_config: AppModelConfig
|
||||
providers: Array<{ provider: string; token_is_set: boolean }>
|
||||
site: SiteConfig
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export type AppModelConfig = {
|
||||
provider: string
|
||||
model_id: string
|
||||
configs: {
|
||||
prompt_template: string
|
||||
prompt_variables: Array<PromptVariable>
|
||||
completion_params: CompletionParam
|
||||
}
|
||||
}
|
||||
|
||||
export type PromptVariable = {
|
||||
key: string
|
||||
name: string
|
||||
description: string
|
||||
type: string | number
|
||||
default: string
|
||||
options: string[]
|
||||
}
|
||||
|
||||
export type CompletionParam = {
|
||||
max_tokens: number
|
||||
temperature: number
|
||||
top_p: number
|
||||
echo: boolean
|
||||
stop: string[]
|
||||
presence_penalty: number
|
||||
frequency_penalty: number
|
||||
}
|
||||
|
||||
export type SiteConfig = {
|
||||
access_token: string
|
||||
title: string
|
||||
author: string
|
||||
support_email: string
|
||||
default_language: string
|
||||
customize_domain: string
|
||||
theme: string
|
||||
customize_token_strategy: 'must' | 'allow' | 'not_allow'
|
||||
prompt_public: boolean
|
||||
} */
|
||||
import type { App, AppModeEnum, AppTemplate, SiteConfig } from '@/types/app'
|
||||
|
||||
export enum DSLImportMode {
|
||||
YAML_CONTENT = 'yaml-content',
|
||||
@@ -85,7 +40,7 @@ export type AppDetailResponse = App
|
||||
export type DSLImportResponse = {
|
||||
id: string
|
||||
status: DSLImportStatus
|
||||
app_mode: AppMode
|
||||
app_mode: AppModeEnum
|
||||
app_id?: string
|
||||
current_dsl_version?: string
|
||||
imported_dsl_version?: string
|
||||
@@ -102,15 +57,15 @@ export type CreateAppResponse = App
|
||||
export type UpdateAppSiteCodeResponse = { app_id: string } & SiteConfig
|
||||
|
||||
export type AppDailyMessagesResponse = {
|
||||
data: Array<{ date: string; message_count: number }>
|
||||
data: Array<{ date: string, message_count: number }>
|
||||
}
|
||||
|
||||
export type AppDailyConversationsResponse = {
|
||||
data: Array<{ date: string; conversation_count: number }>
|
||||
data: Array<{ date: string, conversation_count: number }>
|
||||
}
|
||||
|
||||
export type WorkflowDailyConversationsResponse = {
|
||||
data: Array<{ date: string; runs: number }>
|
||||
data: Array<{ date: string, runs: number }>
|
||||
}
|
||||
|
||||
export type AppStatisticsResponse = {
|
||||
@@ -118,11 +73,11 @@ export type AppStatisticsResponse = {
|
||||
}
|
||||
|
||||
export type AppDailyEndUsersResponse = {
|
||||
data: Array<{ date: string; terminal_count: number }>
|
||||
data: Array<{ date: string, terminal_count: number }>
|
||||
}
|
||||
|
||||
export type AppTokenCostsResponse = {
|
||||
data: Array<{ date: string; token_count: number; total_price: number; currency: number }>
|
||||
data: Array<{ date: string, token_count: number, total_price: number, currency: number }>
|
||||
}
|
||||
|
||||
export type UpdateAppModelConfigResponse = { result: string }
|
||||
@@ -187,5 +142,14 @@ export type TracingStatus = {
|
||||
|
||||
export type TracingConfig = {
|
||||
tracing_provider: TracingProvider
|
||||
tracing_config: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig
|
||||
tracing_config: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | DatabricksConfig | MLflowConfig | OpikConfig | WeaveConfig | AliyunConfig | TencentConfig
|
||||
}
|
||||
|
||||
export type WebhookTriggerResponse = {
|
||||
id: string
|
||||
webhook_id: string
|
||||
webhook_url: string
|
||||
webhook_debug_url: string
|
||||
node_id: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
@@ -152,6 +152,9 @@ export type IWorkspace = {
|
||||
export type ICurrentWorkspace = Omit<IWorkspace, 'current'> & {
|
||||
role: 'owner' | 'admin' | 'editor' | 'dataset_operator' | 'normal'
|
||||
providers: Provider[]
|
||||
trial_credits: number
|
||||
trial_credits_used: number
|
||||
next_credit_reset_date: number
|
||||
trial_end_reason?: string
|
||||
custom_config?: {
|
||||
remove_webapp_brand?: boolean
|
||||
@@ -246,10 +249,14 @@ export type PluginProvider = {
|
||||
export type FileUploadConfigResponse = {
|
||||
batch_count_limit: number
|
||||
image_file_size_limit?: number | string // default is 10MB
|
||||
image_file_batch_limit: number // default is 10, for dataset attachment upload only
|
||||
single_chunk_attachment_limit: number // default is 10, for dataset attachment upload only
|
||||
attachment_image_file_size_limit: number // default is 2MB, for dataset attachment upload only
|
||||
file_size_limit: number // default is 15MB
|
||||
audio_file_size_limit?: number // default is 50MB
|
||||
video_file_size_limit?: number // default is 100MB
|
||||
workflow_file_upload_limit?: number // default is 10
|
||||
file_upload_limit: number // default is 5
|
||||
}
|
||||
|
||||
export type InvitationResult = {
|
||||
@@ -314,7 +321,7 @@ export type CodeBasedExtensionForm = {
|
||||
label: I18nText
|
||||
variable: string
|
||||
required: boolean
|
||||
options: { label: I18nText; value: string }[]
|
||||
options: { label: I18nText, value: string }[]
|
||||
default: string
|
||||
placeholder: string
|
||||
max_length?: number
|
||||
@@ -352,7 +359,7 @@ export type ModerationService = (
|
||||
body: {
|
||||
app_id: string
|
||||
text: string
|
||||
}
|
||||
},
|
||||
) => Promise<ModerateResponse>
|
||||
|
||||
export type StructuredOutputRulesRequestBody = {
|
||||
|
||||
+184
-20
@@ -1,9 +1,13 @@
|
||||
import type { DataSourceNotionPage, DataSourceProvider } from './common'
|
||||
import type { AppIconType, AppMode, RetrievalConfig } from '@/types/app'
|
||||
import type { DatasourceType } from './pipeline'
|
||||
import type { Tag } from '@/app/components/base/tag-management/constant'
|
||||
import type { IndexingType } from '@/app/components/datasets/create/step-two'
|
||||
import type { MetadataFilteringVariableType } from '@/app/components/workflow/nodes/knowledge-retrieval/types'
|
||||
import type { MetadataItemWithValue } from '@/app/components/datasets/metadata/types'
|
||||
import type { MetadataFilteringVariableType } from '@/app/components/workflow/nodes/knowledge-retrieval/types'
|
||||
import type { AppIconType, AppModeEnum, RetrievalConfig, TransferMethod } from '@/types/app'
|
||||
import type { I18nKeysByPrefix } from '@/types/i18n'
|
||||
import { ExternalKnowledgeBase, General, ParentChild, Qa } from '@/app/components/base/icons/src/public/knowledge/dataset-card'
|
||||
import { GeneralChunk, ParentChildChunk, QuestionAndAnswer } from '@/app/components/base/icons/src/vender/knowledge'
|
||||
|
||||
export enum DataSourceType {
|
||||
FILE = 'upload_file',
|
||||
@@ -21,6 +25,7 @@ export enum ChunkingMode {
|
||||
text = 'text_model', // General text
|
||||
qa = 'qa_model', // General QA
|
||||
parentChild = 'hierarchical_model', // Parent-Child
|
||||
// graph = 'graph', // todo: Graph RAG
|
||||
}
|
||||
|
||||
export type MetadataInDoc = {
|
||||
@@ -30,21 +35,31 @@ export type MetadataInDoc = {
|
||||
name: string
|
||||
}
|
||||
|
||||
export type IconInfo = {
|
||||
icon: string
|
||||
icon_background?: string
|
||||
icon_type: AppIconType
|
||||
icon_url?: string
|
||||
}
|
||||
|
||||
export type DataSet = {
|
||||
id: string
|
||||
name: string
|
||||
icon: string
|
||||
icon_background: string
|
||||
indexing_status: DocumentIndexingStatus
|
||||
icon_info: IconInfo
|
||||
description: string
|
||||
permission: DatasetPermission
|
||||
data_source_type: DataSourceType
|
||||
indexing_technique: IndexingType
|
||||
author_name?: string
|
||||
created_by: string
|
||||
updated_by: string
|
||||
updated_at: number
|
||||
app_count: number
|
||||
doc_form: ChunkingMode
|
||||
document_count: number
|
||||
total_document_count: number
|
||||
total_available_documents?: number
|
||||
word_count: number
|
||||
provider: string
|
||||
embedding_model: string
|
||||
@@ -67,6 +82,12 @@ export type DataSet = {
|
||||
}
|
||||
built_in_field_enabled: boolean
|
||||
doc_metadata?: MetadataInDoc[]
|
||||
keyword_number?: number
|
||||
pipeline_id?: string
|
||||
is_published?: boolean // Indicates if the pipeline is published
|
||||
runtime_mode: 'rag_pipeline' | 'general'
|
||||
enable_api: boolean // Indicates if the service API is enabled
|
||||
is_multimodal: boolean // Indicates if the dataset supports multimodal
|
||||
}
|
||||
|
||||
export type ExternalAPIItem = {
|
||||
@@ -78,7 +99,7 @@ export type ExternalAPIItem = {
|
||||
endpoint: string
|
||||
api_key: string
|
||||
}
|
||||
dataset_bindings: { id: string; name: string }[]
|
||||
dataset_bindings: { id: string, name: string }[]
|
||||
created_by: string
|
||||
created_at: string
|
||||
}
|
||||
@@ -141,6 +162,17 @@ export type CrawlResultItem = {
|
||||
source_url: string
|
||||
}
|
||||
|
||||
export type CrawlResult = {
|
||||
data: CrawlResultItem[]
|
||||
time_consuming: number | string
|
||||
}
|
||||
|
||||
export enum CrawlStep {
|
||||
init = 'init',
|
||||
running = 'running',
|
||||
finished = 'finished',
|
||||
}
|
||||
|
||||
export type FileItem = {
|
||||
fileID: string
|
||||
file: CustomFile
|
||||
@@ -159,6 +191,14 @@ export type FetchDatasetsParams = {
|
||||
}
|
||||
}
|
||||
|
||||
export type DatasetListRequest = {
|
||||
initialPage: number
|
||||
tag_ids?: string[]
|
||||
limit: number
|
||||
include_all?: boolean
|
||||
keyword?: string
|
||||
}
|
||||
|
||||
export type DataSetListResponse = {
|
||||
data: DataSet[]
|
||||
has_more: boolean
|
||||
@@ -185,7 +225,7 @@ export type IndexingEstimateResponse = {
|
||||
total_price: number
|
||||
currency: string
|
||||
total_segments: number
|
||||
preview: Array<{ content: string; child_chunks: string[] }>
|
||||
preview: Array<{ content: string, child_chunks: string[] }>
|
||||
qa_preview?: QA[]
|
||||
}
|
||||
|
||||
@@ -272,7 +312,7 @@ export const DisplayStatusList = [
|
||||
|
||||
export type DocumentDisplayStatus = typeof DisplayStatusList[number]
|
||||
|
||||
export type DataSourceInfo = {
|
||||
export type LegacyDataSourceInfo = {
|
||||
upload_file: {
|
||||
id: string
|
||||
name: string
|
||||
@@ -288,18 +328,62 @@ export type DataSourceInfo = {
|
||||
provider?: DataSourceProvider
|
||||
job_id: string
|
||||
url: string
|
||||
credential_id?: string
|
||||
}
|
||||
|
||||
export type LocalFileInfo = {
|
||||
extension: string
|
||||
mime_type: string
|
||||
name: string
|
||||
related_id: string
|
||||
size: number
|
||||
transfer_method: TransferMethod
|
||||
url: string
|
||||
}
|
||||
|
||||
export type WebsiteCrawlInfo = {
|
||||
content: string
|
||||
credential_id: string
|
||||
description: string
|
||||
source_url: string
|
||||
title: string
|
||||
provider?: string
|
||||
job_id?: string
|
||||
}
|
||||
|
||||
export type OnlineDocumentInfo = {
|
||||
credential_id: string
|
||||
workspace_id: string
|
||||
page: {
|
||||
last_edited_time: string
|
||||
page_icon: DataSourceNotionPage['page_icon']
|
||||
page_id: string
|
||||
page_name: string
|
||||
parent_id: string
|
||||
type: string
|
||||
}
|
||||
}
|
||||
|
||||
export type OnlineDriveInfo = {
|
||||
bucket: string
|
||||
credential_id: string
|
||||
id: string
|
||||
name: string
|
||||
type: 'file' | 'folder'
|
||||
}
|
||||
|
||||
export type DataSourceInfo = LegacyDataSourceInfo | LocalFileInfo | OnlineDocumentInfo | WebsiteCrawlInfo
|
||||
|
||||
export type InitialDocumentDetail = {
|
||||
id: string
|
||||
batch: string
|
||||
position: number
|
||||
dataset_id: string
|
||||
data_source_type: DataSourceType
|
||||
data_source_type: DataSourceType | DatasourceType
|
||||
data_source_info: DataSourceInfo
|
||||
dataset_process_rule_id: string
|
||||
name: string
|
||||
created_from: 'api' | 'web'
|
||||
created_from: 'rag-pipeline' | 'api' | 'web'
|
||||
created_by: string
|
||||
created_at: number
|
||||
indexing_status: DocumentIndexingStatus
|
||||
@@ -313,7 +397,6 @@ export type InitialDocumentDetail = {
|
||||
export type SimpleDocumentDetail = InitialDocumentDetail & {
|
||||
enabled: boolean
|
||||
word_count: number
|
||||
is_qa: boolean // TODO waiting for backend to add this field
|
||||
error?: string | null
|
||||
archived: boolean
|
||||
updated_at: number
|
||||
@@ -338,7 +421,7 @@ export type DocumentListResponse = {
|
||||
|
||||
export type DocumentReq = {
|
||||
original_document_id?: string
|
||||
indexing_technique?: string
|
||||
indexing_technique?: IndexingType
|
||||
doc_form: ChunkingMode
|
||||
doc_language: string
|
||||
process_rule: ProcessRule
|
||||
@@ -374,6 +457,7 @@ export type DataSource = {
|
||||
export type NotionInfo = {
|
||||
workspace_id: string
|
||||
pages: DataSourceNotionPage[]
|
||||
credential_id: string
|
||||
}
|
||||
export type NotionPage = {
|
||||
page_id: string
|
||||
@@ -391,11 +475,6 @@ export type createDocumentResponse = {
|
||||
documents: InitialDocumentDetail[]
|
||||
}
|
||||
|
||||
export type PrecessRule = {
|
||||
mode: ProcessMode
|
||||
rules: Rules
|
||||
}
|
||||
|
||||
export type FullDocumentDetail = SimpleDocumentDetail & {
|
||||
batch: string
|
||||
created_api_request_id: string
|
||||
@@ -418,7 +497,7 @@ export type FullDocumentDetail = SimpleDocumentDetail & {
|
||||
doc_type?: DocType | null | 'others'
|
||||
doc_metadata?: DocMetadata | null
|
||||
segment_count: number
|
||||
dataset_process_rule: PrecessRule
|
||||
dataset_process_rule: ProcessRule
|
||||
document_process_rule: ProcessRule
|
||||
[key: string]: any
|
||||
}
|
||||
@@ -464,6 +543,15 @@ export type SegmentsQuery = {
|
||||
enabled?: boolean | 'all'
|
||||
}
|
||||
|
||||
export type Attachment = {
|
||||
id: string
|
||||
name: string
|
||||
size: number
|
||||
extension: string
|
||||
mime_type: string
|
||||
source_url: string
|
||||
}
|
||||
|
||||
export type SegmentDetailModel = {
|
||||
id: string
|
||||
position: number
|
||||
@@ -489,6 +577,7 @@ export type SegmentDetailModel = {
|
||||
answer?: string
|
||||
child_chunks?: ChildChunkDetail[]
|
||||
updated_at: number
|
||||
attachments: Attachment[]
|
||||
}
|
||||
|
||||
export type SegmentsResponse = {
|
||||
@@ -500,14 +589,20 @@ export type SegmentsResponse = {
|
||||
page: number
|
||||
}
|
||||
|
||||
export type Query = {
|
||||
content: string
|
||||
content_type: 'text_query' | 'image_query'
|
||||
file_info: Attachment | null
|
||||
}
|
||||
|
||||
export type HitTestingRecord = {
|
||||
id: string
|
||||
content: string
|
||||
source: 'app' | 'hit_testing' | 'plugin'
|
||||
source_app_id: string
|
||||
created_by_role: 'account' | 'end_user'
|
||||
created_by: string
|
||||
created_at: number
|
||||
queries: Query[]
|
||||
}
|
||||
|
||||
export type HitTestingChildChunk = {
|
||||
@@ -521,7 +616,8 @@ export type HitTesting = {
|
||||
content: Segment
|
||||
score: number
|
||||
tsne_position: TsnePosition
|
||||
child_chunks?: HitTestingChildChunk[] | null
|
||||
child_chunks: HitTestingChildChunk[] | null
|
||||
files: Attachment[]
|
||||
}
|
||||
|
||||
export type ExternalKnowledgeBaseHitTesting = {
|
||||
@@ -586,7 +682,7 @@ export type ExternalKnowledgeBaseHitTestingResponse = {
|
||||
export type RelatedApp = {
|
||||
id: string
|
||||
name: string
|
||||
mode: AppMode
|
||||
mode: AppModeEnum
|
||||
icon_type: AppIconType | null
|
||||
icon: string
|
||||
icon_background: string
|
||||
@@ -603,6 +699,7 @@ export type SegmentUpdater = {
|
||||
answer?: string
|
||||
keywords?: string[]
|
||||
regenerate_child_chunks?: boolean
|
||||
attachment_ids?: string[]
|
||||
}
|
||||
|
||||
export type ErrorDocsResponse = {
|
||||
@@ -693,3 +790,70 @@ export type BatchImportResponse = {
|
||||
job_id: string
|
||||
job_status: string
|
||||
}
|
||||
|
||||
export const DOC_FORM_ICON_WITH_BG: Record<ChunkingMode | 'external', React.ComponentType<{ className: string }>> = {
|
||||
[ChunkingMode.text]: General,
|
||||
[ChunkingMode.qa]: Qa,
|
||||
[ChunkingMode.parentChild]: ParentChild,
|
||||
// [ChunkingMode.graph]: Graph, // todo: Graph RAG
|
||||
external: ExternalKnowledgeBase,
|
||||
}
|
||||
|
||||
export const DOC_FORM_ICON: Record<ChunkingMode.text | ChunkingMode.qa | ChunkingMode.parentChild, React.ComponentType<{ className: string }>> = {
|
||||
[ChunkingMode.text]: GeneralChunk,
|
||||
[ChunkingMode.qa]: QuestionAndAnswer,
|
||||
[ChunkingMode.parentChild]: ParentChildChunk,
|
||||
}
|
||||
|
||||
type ChunkingModeText = I18nKeysByPrefix<'dataset', 'chunkingMode.'>
|
||||
|
||||
export const DOC_FORM_TEXT: Record<ChunkingMode, ChunkingModeText> = {
|
||||
[ChunkingMode.text]: 'general',
|
||||
[ChunkingMode.qa]: 'qa',
|
||||
[ChunkingMode.parentChild]: 'parentChild',
|
||||
// [ChunkingMode.graph]: 'graph', // todo: Graph RAG
|
||||
}
|
||||
|
||||
export type CreateDatasetReq = {
|
||||
yaml_content?: string
|
||||
}
|
||||
|
||||
export type CreateDatasetResponse = {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
permission: DatasetPermission
|
||||
indexing_technique: IndexingType
|
||||
created_by: string
|
||||
created_at: number
|
||||
updated_by: string
|
||||
updated_at: number
|
||||
pipeline_id: string
|
||||
dataset_id: string
|
||||
}
|
||||
|
||||
export type IndexingStatusBatchRequest = {
|
||||
datasetId: string
|
||||
batchId: string
|
||||
}
|
||||
|
||||
export type HitTestingRecordsRequest = {
|
||||
datasetId: string
|
||||
page: number
|
||||
limit: number
|
||||
}
|
||||
|
||||
export type HitTestingRequest = {
|
||||
query: string
|
||||
attachment_ids: string[]
|
||||
retrieval_model: RetrievalConfig
|
||||
}
|
||||
|
||||
export type ExternalKnowledgeBaseHitTestingRequest = {
|
||||
query: string
|
||||
external_retrieval_model: {
|
||||
top_k: number
|
||||
score_threshold: number
|
||||
score_threshold_enabled: boolean
|
||||
}
|
||||
}
|
||||
|
||||
+17
-5
@@ -1,14 +1,16 @@
|
||||
import type { AgentStrategy, ModelModeType, RETRIEVE_TYPE, ToolItem, TtsAutoPlay } from '@/types/app'
|
||||
import type {
|
||||
RerankingModeEnum,
|
||||
WeightedScoreEnum,
|
||||
} from '@/models/datasets'
|
||||
import type { FileUpload } from '@/app/components/base/features/types'
|
||||
import type {
|
||||
MetadataFilteringConditions,
|
||||
MetadataFilteringModeEnum,
|
||||
} from '@/app/components/workflow/nodes/knowledge-retrieval/types'
|
||||
import type { ModelConfig as NodeModelConfig } from '@/app/components/workflow/types'
|
||||
import type { ExternalDataTool } from '@/models/common'
|
||||
import type {
|
||||
RerankingModeEnum,
|
||||
WeightedScoreEnum,
|
||||
} from '@/models/datasets'
|
||||
import type { AgentStrategy, ModelModeType, RETRIEVE_TYPE, ToolItem, TtsAutoPlay } from '@/types/app'
|
||||
|
||||
export type Inputs = Record<string, string | number | object | boolean>
|
||||
|
||||
export enum PromptMode {
|
||||
@@ -133,6 +135,8 @@ export type ModelConfig = {
|
||||
model_id: string
|
||||
mode: ModelModeType
|
||||
configs: PromptConfig
|
||||
chat_prompt_config?: ChatPromptConfig | null
|
||||
completion_prompt_config?: CompletionPromptConfig | null
|
||||
opening_statement: string | null
|
||||
more_like_this: MoreLikeThisConfig | null
|
||||
suggested_questions: string[] | null
|
||||
@@ -143,6 +147,14 @@ export type ModelConfig = {
|
||||
retriever_resource: RetrieverResourceConfig | null
|
||||
sensitive_word_avoidance: ModerationConfig | null
|
||||
annotation_reply: AnnotationReplyConfig | null
|
||||
external_data_tools?: ExternalDataTool[] | null
|
||||
system_parameters: {
|
||||
audio_file_size_limit: number
|
||||
file_size_limit: number
|
||||
image_file_size_limit: number
|
||||
video_file_size_limit: number
|
||||
workflow_file_upload_limit: number
|
||||
}
|
||||
dataSets: any[]
|
||||
agentConfig: AgentConfig
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { AppIconType, AppMode } from '@/types/app'
|
||||
import type { AppIconType, AppModeEnum } from '@/types/app'
|
||||
|
||||
export type AppBasicInfo = {
|
||||
id: string
|
||||
mode: AppMode
|
||||
mode: AppModeEnum
|
||||
icon_type: AppIconType | null
|
||||
icon: string
|
||||
icon_background: string
|
||||
|
||||
+36
-21
@@ -1,28 +1,10 @@
|
||||
import type { Viewport } from 'reactflow'
|
||||
import type { VisionFile } from '@/types/app'
|
||||
import type { Metadata } from '@/app/components/base/chat/chat/type'
|
||||
import type {
|
||||
Edge,
|
||||
Node,
|
||||
} from '@/app/components/workflow/types'
|
||||
import type { Metadata } from '@/app/components/base/chat/chat/type'
|
||||
|
||||
// Log type contains key:string conversation_id:string created_at:string question:string answer:string
|
||||
export type Conversation = {
|
||||
id: string
|
||||
key: string
|
||||
conversationId: string
|
||||
question: string
|
||||
answer: string
|
||||
userRate: number
|
||||
adminRate: number
|
||||
}
|
||||
|
||||
export type ConversationListResponse = {
|
||||
logs: Conversation[]
|
||||
}
|
||||
|
||||
export const fetchLogs = (url: string) =>
|
||||
fetch(url).then<ConversationListResponse>(r => r.json())
|
||||
import type { VisionFile } from '@/types/app'
|
||||
|
||||
export const CompletionParams = ['temperature', 'top_p', 'presence_penalty', 'max_token', 'stop', 'frequency_penalty'] as const
|
||||
|
||||
@@ -80,7 +62,7 @@ export type MessageContent = {
|
||||
conversation_id: string
|
||||
query: string
|
||||
inputs: Record<string, any>
|
||||
message: { role: string; text: string; files?: VisionFile[] }[]
|
||||
message: { role: string, text: string, files?: VisionFile[] }[]
|
||||
message_tokens: number
|
||||
answer_tokens: number
|
||||
answer: string
|
||||
@@ -229,11 +211,38 @@ export type AnnotationsCountResponse = {
|
||||
count: number
|
||||
}
|
||||
|
||||
export enum WorkflowRunTriggeredFrom {
|
||||
DEBUGGING = 'debugging',
|
||||
APP_RUN = 'app-run',
|
||||
RAG_PIPELINE_RUN = 'rag-pipeline-run',
|
||||
RAG_PIPELINE_DEBUGGING = 'rag-pipeline-debugging',
|
||||
WEBHOOK = 'webhook',
|
||||
SCHEDULE = 'schedule',
|
||||
PLUGIN = 'plugin',
|
||||
}
|
||||
|
||||
export type TriggerMetadata = {
|
||||
type?: string
|
||||
endpoint_id?: string
|
||||
plugin_unique_identifier?: string
|
||||
provider_id?: string
|
||||
event_name?: string
|
||||
icon_filename?: string
|
||||
icon_dark_filename?: string
|
||||
icon?: string | null
|
||||
icon_dark?: string | null
|
||||
}
|
||||
|
||||
export type WorkflowLogDetails = {
|
||||
trigger_metadata?: TriggerMetadata
|
||||
}
|
||||
|
||||
export type WorkflowRunDetail = {
|
||||
id: string
|
||||
version: string
|
||||
status: 'running' | 'succeeded' | 'failed' | 'stopped'
|
||||
error?: string
|
||||
triggered_from?: WorkflowRunTriggeredFrom
|
||||
elapsed_time: number
|
||||
total_tokens: number
|
||||
total_price: number
|
||||
@@ -255,6 +264,7 @@ export type EndUserInfo = {
|
||||
export type WorkflowAppLogDetail = {
|
||||
id: string
|
||||
workflow_run: WorkflowRunDetail
|
||||
details?: WorkflowLogDetails
|
||||
created_from: 'service-api' | 'web-app' | 'explore'
|
||||
created_by_role: 'account' | 'end_user'
|
||||
created_by_account?: AccountInfo
|
||||
@@ -285,8 +295,13 @@ export type WorkflowRunDetailResponse = {
|
||||
viewport?: Viewport
|
||||
}
|
||||
inputs: string
|
||||
inputs_truncated: boolean
|
||||
status: 'running' | 'succeeded' | 'failed' | 'stopped'
|
||||
outputs?: string
|
||||
outputs_truncated: boolean
|
||||
outputs_full_content?: {
|
||||
download_url: string
|
||||
}
|
||||
error?: string
|
||||
elapsed_time?: number
|
||||
total_tokens?: number
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
import type { Viewport } from 'reactflow'
|
||||
import type { DSLImportMode, DSLImportStatus } from './app'
|
||||
import type { ChunkingMode, DatasetPermission, DocumentIndexingStatus, FileIndexingEstimateResponse, IconInfo } from './datasets'
|
||||
import type { AppIconSelection } from '@/app/components/base/app-icon-picker'
|
||||
import type { Dependency } from '@/app/components/plugins/types'
|
||||
import type { Edge, EnvironmentVariable, Node, SupportUploadFileTypes } from '@/app/components/workflow/types'
|
||||
import type { TransferMethod } from '@/types/app'
|
||||
import type { NodeRunResult } from '@/types/workflow'
|
||||
import { BaseFieldType } from '@/app/components/base/form/form-scenarios/base/types'
|
||||
|
||||
export enum DatasourceType {
|
||||
localFile = 'local_file',
|
||||
onlineDocument = 'online_document',
|
||||
websiteCrawl = 'website_crawl',
|
||||
onlineDrive = 'online_drive',
|
||||
}
|
||||
|
||||
export type PipelineTemplateListParams = {
|
||||
type: 'built-in' | 'customized'
|
||||
language?: string
|
||||
}
|
||||
|
||||
export type PipelineTemplate = {
|
||||
id: string
|
||||
name: string
|
||||
icon: IconInfo
|
||||
description: string
|
||||
position: number
|
||||
chunk_structure: ChunkingMode
|
||||
}
|
||||
|
||||
export type PipelineTemplateListResponse = {
|
||||
pipeline_templates: PipelineTemplate[]
|
||||
}
|
||||
|
||||
export type PipelineTemplateByIdRequest = {
|
||||
template_id: string
|
||||
type: 'built-in' | 'customized'
|
||||
}
|
||||
|
||||
export type PipelineTemplateByIdResponse = {
|
||||
id: string
|
||||
name: string
|
||||
icon_info: IconInfo
|
||||
description: string
|
||||
chunk_structure: ChunkingMode
|
||||
export_data: string // DSL content
|
||||
graph: {
|
||||
nodes: Node[]
|
||||
edges: Edge[]
|
||||
viewport: Viewport
|
||||
}
|
||||
created_by: string
|
||||
}
|
||||
|
||||
export type CreateFormData = {
|
||||
name: string
|
||||
appIcon: AppIconSelection
|
||||
description: string
|
||||
permission: DatasetPermission
|
||||
selectedMemberIDs: string[]
|
||||
}
|
||||
|
||||
export type UpdateTemplateInfoRequest = {
|
||||
template_id: string
|
||||
name: string
|
||||
icon_info: IconInfo
|
||||
description: string
|
||||
}
|
||||
|
||||
export type UpdateTemplateInfoResponse = {
|
||||
pipeline_id: string
|
||||
name: string
|
||||
icon: IconInfo
|
||||
description: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export type DeleteTemplateResponse = {
|
||||
code: number
|
||||
}
|
||||
|
||||
export type ExportTemplateDSLResponse = {
|
||||
data: string
|
||||
}
|
||||
|
||||
export type ImportPipelineDSLRequest = {
|
||||
mode: DSLImportMode
|
||||
yaml_content?: string
|
||||
yaml_url?: string
|
||||
pipeline_id?: string
|
||||
}
|
||||
|
||||
export type ImportPipelineDSLResponse = {
|
||||
id: string
|
||||
status: DSLImportStatus
|
||||
pipeline_id: string
|
||||
dataset_id: string
|
||||
current_dsl_version: string
|
||||
imported_dsl_version: string
|
||||
}
|
||||
|
||||
export type ImportPipelineDSLConfirmResponse = {
|
||||
status: DSLImportStatus
|
||||
pipeline_id: string
|
||||
dataset_id: string
|
||||
current_dsl_version: string
|
||||
imported_dsl_version: string
|
||||
error: string
|
||||
}
|
||||
|
||||
export type PipelineCheckDependenciesResponse = {
|
||||
leaked_dependencies: Dependency[]
|
||||
}
|
||||
|
||||
export enum PipelineInputVarType {
|
||||
textInput = 'text-input',
|
||||
paragraph = 'paragraph',
|
||||
select = 'select',
|
||||
number = 'number',
|
||||
singleFile = 'file',
|
||||
multiFiles = 'file-list',
|
||||
checkbox = 'checkbox',
|
||||
}
|
||||
|
||||
export const VAR_TYPE_MAP: Record<PipelineInputVarType, BaseFieldType> = {
|
||||
[PipelineInputVarType.textInput]: BaseFieldType.textInput,
|
||||
[PipelineInputVarType.paragraph]: BaseFieldType.paragraph,
|
||||
[PipelineInputVarType.select]: BaseFieldType.select,
|
||||
[PipelineInputVarType.singleFile]: BaseFieldType.file,
|
||||
[PipelineInputVarType.multiFiles]: BaseFieldType.fileList,
|
||||
[PipelineInputVarType.number]: BaseFieldType.numberInput,
|
||||
[PipelineInputVarType.checkbox]: BaseFieldType.checkbox,
|
||||
}
|
||||
|
||||
export type RAGPipelineVariable = {
|
||||
belong_to_node_id: string // indicates belong to which node or 'shared'
|
||||
type: PipelineInputVarType
|
||||
label: string
|
||||
variable: string
|
||||
max_length?: number
|
||||
default_value?: string
|
||||
placeholder?: string
|
||||
unit?: string
|
||||
required: boolean
|
||||
tooltips?: string
|
||||
options?: string[]
|
||||
allowed_file_upload_methods?: TransferMethod[]
|
||||
allowed_file_types?: SupportUploadFileTypes[]
|
||||
allowed_file_extensions?: string[]
|
||||
}
|
||||
|
||||
export type InputVar = Omit<RAGPipelineVariable, 'belong_to_node_id'>
|
||||
export type RAGPipelineVariables = RAGPipelineVariable[]
|
||||
|
||||
export type PipelineProcessingParamsRequest = {
|
||||
pipeline_id: string
|
||||
node_id: string
|
||||
}
|
||||
|
||||
export type PipelineProcessingParamsResponse = {
|
||||
variables: RAGPipelineVariables
|
||||
}
|
||||
|
||||
export type PipelinePreProcessingParamsRequest = {
|
||||
pipeline_id: string
|
||||
node_id: string
|
||||
}
|
||||
|
||||
export type PipelinePreProcessingParamsResponse = {
|
||||
variables: RAGPipelineVariables
|
||||
}
|
||||
|
||||
export type PublishedPipelineInfoResponse = {
|
||||
id: string
|
||||
graph: {
|
||||
nodes: Node[]
|
||||
edges: Edge[]
|
||||
viewport: Viewport
|
||||
}
|
||||
created_at: number
|
||||
created_by: {
|
||||
id: string
|
||||
name: string
|
||||
email: string
|
||||
}
|
||||
hash: string
|
||||
updated_at: number
|
||||
updated_by: {
|
||||
id: string
|
||||
name: string
|
||||
email: string
|
||||
}
|
||||
environment_variables?: EnvironmentVariable[]
|
||||
rag_pipeline_variables?: RAGPipelineVariables
|
||||
version: string
|
||||
marked_name: string
|
||||
marked_comment: string
|
||||
}
|
||||
|
||||
export type PublishedPipelineRunRequest = {
|
||||
pipeline_id: string
|
||||
inputs: Record<string, any>
|
||||
start_node_id: string
|
||||
datasource_type: DatasourceType
|
||||
datasource_info_list: Array<Record<string, any>>
|
||||
original_document_id?: string
|
||||
is_preview: boolean
|
||||
}
|
||||
|
||||
export type PublishedPipelineRunPreviewResponse = {
|
||||
task_iod: string
|
||||
workflow_run_id: string
|
||||
data: {
|
||||
id: string
|
||||
status: string
|
||||
created_at: number
|
||||
elapsed_time: number
|
||||
error: string
|
||||
finished_at: number
|
||||
outputs: FileIndexingEstimateResponse
|
||||
total_steps: number
|
||||
total_tokens: number
|
||||
workflow_id: string
|
||||
}
|
||||
}
|
||||
|
||||
export type PublishedPipelineRunResponse = {
|
||||
batch: string
|
||||
dataset: {
|
||||
chunk_structure: ChunkingMode
|
||||
description: string
|
||||
id: string
|
||||
name: string
|
||||
}
|
||||
documents: InitialDocumentDetail[]
|
||||
}
|
||||
|
||||
export type InitialDocumentDetail = {
|
||||
data_source_info: Record<string, any>
|
||||
data_source_type: DatasourceType
|
||||
enable: boolean
|
||||
error: string
|
||||
id: string
|
||||
indexing_status: DocumentIndexingStatus
|
||||
name: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export type PipelineExecutionLogRequest = {
|
||||
dataset_id: string
|
||||
document_id: string
|
||||
}
|
||||
|
||||
export type PipelineExecutionLogResponse = {
|
||||
datasource_info: Record<string, any>
|
||||
datasource_type: DatasourceType
|
||||
input_data: Record<string, any>
|
||||
datasource_node_id: string
|
||||
}
|
||||
|
||||
export type OnlineDocumentPreviewRequest = {
|
||||
workspaceID: string
|
||||
pageID: string
|
||||
pageType: string
|
||||
pipelineId: string
|
||||
datasourceNodeId: string
|
||||
credentialId: string
|
||||
}
|
||||
|
||||
export type OnlineDocumentPreviewResponse = {
|
||||
content: string
|
||||
}
|
||||
|
||||
export type ConversionResponse = {
|
||||
pipeline_id: string
|
||||
dataset_id: string
|
||||
status: 'success' | 'failed'
|
||||
}
|
||||
|
||||
export enum OnlineDriveFileType {
|
||||
file = 'file',
|
||||
folder = 'folder',
|
||||
bucket = 'bucket',
|
||||
}
|
||||
|
||||
export type OnlineDriveFile = {
|
||||
id: string
|
||||
name: string
|
||||
size?: number
|
||||
type: OnlineDriveFileType
|
||||
}
|
||||
|
||||
export type DatasourceNodeSingleRunRequest = {
|
||||
pipeline_id: string
|
||||
start_node_id: string
|
||||
start_node_title: string
|
||||
datasource_type: DatasourceType
|
||||
datasource_info: Record<string, any>
|
||||
}
|
||||
|
||||
export type DatasourceNodeSingleRunResponse = NodeRunResult
|
||||
@@ -1,17 +0,0 @@
|
||||
export type User = {
|
||||
id: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
name: string
|
||||
phone: string
|
||||
username: string
|
||||
email: string
|
||||
avatar: string
|
||||
}
|
||||
|
||||
export type UserResponse = {
|
||||
users: User[]
|
||||
}
|
||||
|
||||
export const fetchUsers = (url: string) =>
|
||||
fetch(url).then<UserResponse>(r => r.json())
|
||||
Reference in New Issue
Block a user