merge main

This commit is contained in:
Joel
2024-10-28 10:51:02 +08:00
858 changed files with 16206 additions and 17932 deletions

View File

@ -6,6 +6,7 @@ import type {
RerankingModeEnum,
WeightedScoreEnum,
} from '@/models/datasets'
import type { UploadFileSetting } from '@/app/components/workflow/types'
export enum Theme {
light = 'light',
@ -24,14 +25,14 @@ export enum ProviderType {
}
export enum AppType {
'chat' = 'chat',
'completion' = 'completion',
chat = 'chat',
completion = 'completion',
}
export enum ModelModeType {
'chat' = 'chat',
'completion' = 'completion',
'unset' = '',
chat = 'chat',
completion = 'completion',
unset = '',
}
export enum RETRIEVE_TYPE {
@ -47,7 +48,7 @@ export enum RETRIEVE_METHOD {
keywordSearch = 'keyword_search',
}
export type VariableInput = {
export interface VariableInput {
key: string
name: string
value: string
@ -68,7 +69,7 @@ export type VariableType = typeof VariableTypes[number]
/**
* Prompt variable parameter
*/
export type PromptVariable = {
export interface PromptVariable {
/** Variable key */
key: string
/** Variable name */
@ -81,7 +82,7 @@ export type PromptVariable = {
max_length?: number
}
export type TextTypeFormItem = {
export interface TextTypeFormItem {
default: string
label: string
variable: string
@ -89,7 +90,7 @@ export type TextTypeFormItem = {
max_length: number
}
export type SelectTypeFormItem = {
export interface SelectTypeFormItem {
default: string
label: string
variable: string
@ -97,7 +98,7 @@ export type SelectTypeFormItem = {
options: string[]
}
export type ParagraphTypeFormItem = {
export interface ParagraphTypeFormItem {
default: string
label: string
variable: string
@ -109,12 +110,12 @@ export type ParagraphTypeFormItem = {
export type UserInputFormItem = {
'text-input': TextTypeFormItem
} | {
'select': SelectTypeFormItem
select: SelectTypeFormItem
} | {
'paragraph': TextTypeFormItem
paragraph: TextTypeFormItem
}
export type AgentTool = {
export interface AgentTool {
provider_id: string
provider_type: CollectionType
provider_name: string
@ -144,7 +145,7 @@ export enum AgentStrategy {
react = 'react',
}
export type CompletionParams = {
export interface CompletionParams {
/** Maximum number of tokens in the answer message returned by Completion */
max_tokens: number
/**
@ -192,7 +193,7 @@ export type CompletionParams = {
/**
* Model configuration. The backend type.
*/
export type Model = {
export interface Model {
/** LLM provider, e.g., OPENAI */
provider: string
/** Model name, e.g, gpt-3.5.turbo */
@ -202,7 +203,7 @@ export type Model = {
completion_params: CompletionParams
}
export type ModelConfig = {
export interface ModelConfig {
opening_statement: string
suggested_questions?: string[]
pre_prompt: string
@ -212,7 +213,7 @@ export type ModelConfig = {
user_input_form: UserInputFormItem[]
dataset_query_variable?: string
more_like_this: {
enabled: boolean
enabled?: boolean
}
suggested_questions_after_answer: {
enabled: boolean
@ -242,9 +243,10 @@ export type ModelConfig = {
dataset_configs: DatasetConfigs
file_upload?: {
image: VisionSettings
}
} & UploadFileSetting
files?: VisionFile[]
created_at?: number
updated_at?: number
}
export type Language = typeof LanguagesSupported[number]
@ -252,7 +254,7 @@ export type Language = typeof LanguagesSupported[number]
/**
* Web Application Configuration
*/
export type SiteConfig = {
export interface SiteConfig {
/** Application URL Identifier: `http://dify.app/{access_token}` */
access_token: string
/** Public Title */
@ -305,7 +307,7 @@ export type AppIconType = 'image' | 'emoji'
/**
* App
*/
export type App = {
export interface App {
/** App ID */
id: string
/** Name */
@ -351,14 +353,14 @@ export type App = {
tags: Tag[]
}
export type AppSSO = {
export interface AppSSO {
enable_sso: boolean
}
/**
* App Template
*/
export type AppTemplate = {
export interface AppTemplate {
/** Name */
name: string
/** Description */
@ -387,7 +389,7 @@ export enum TtsAutoPlay {
export const ALLOW_FILE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'webp', 'gif']
export type VisionSettings = {
export interface VisionSettings {
enabled: boolean
number_limits: number
detail: Resolution
@ -395,7 +397,7 @@ export type VisionSettings = {
image_file_size_limit?: number | string
}
export type ImageFile = {
export interface ImageFile {
type: TransferMethod
_id: string
fileId: string
@ -406,7 +408,7 @@ export type ImageFile = {
deleted?: boolean
}
export type VisionFile = {
export interface VisionFile {
id?: string
type: string
transfer_method: TransferMethod
@ -415,7 +417,7 @@ export type VisionFile = {
belongs_to?: string
}
export type RetrievalConfig = {
export interface RetrievalConfig {
search_method: RETRIEVE_METHOD
reranking_enable: boolean
reranking_model: {

View File

@ -1,10 +1,21 @@
export type SystemFeatures = {
export enum SSOProtocol {
SAML = 'saml',
OIDC = 'oidc',
OAuth2 = 'oauth2',
}
export interface SystemFeatures {
sso_enforced_for_signin: boolean
sso_enforced_for_signin_protocol: string
sso_enforced_for_signin_protocol: SSOProtocol | ''
sso_enforced_for_web: boolean
sso_enforced_for_web_protocol: string
sso_enforced_for_web_protocol: SSOProtocol | ''
enable_web_sso_switch_component: boolean
enable_marketplace: boolean
enable_email_code_login: boolean
enable_email_password_login: boolean
enable_social_oauth_login: boolean
is_allow_create_workspace: boolean
is_allow_register: boolean
}
export const defaultSystemFeatures: SystemFeatures = {
@ -14,4 +25,9 @@ export const defaultSystemFeatures: SystemFeatures = {
sso_enforced_for_web_protocol: '',
enable_web_sso_switch_component: false,
enable_marketplace: false,
enable_email_code_login: false,
enable_email_password_login: false,
enable_social_oauth_login: false,
is_allow_create_workspace: false,
is_allow_register: false,
}

View File

@ -6,8 +6,9 @@ import type {
EnvironmentVariable,
Node,
} from '@/app/components/workflow/types'
import type { TransferMethod } from '@/types/app'
export type NodeTracing = {
export interface NodeTracing {
id: string
index: number
predecessor_node_id: string
@ -51,7 +52,7 @@ export type NodeTracing = {
parent_parallel_start_node_id?: string
}
export type FetchWorkflowDraftResponse = {
export interface FetchWorkflowDraftResponse {
id: string
graph: {
nodes: Node[]
@ -72,11 +73,11 @@ export type FetchWorkflowDraftResponse = {
conversation_variables?: ConversationVariable[]
}
export type NodeTracingListResponse = {
export interface NodeTracingListResponse {
data: NodeTracing[]
}
export type WorkflowStartedResponse = {
export interface WorkflowStartedResponse {
task_id: string
workflow_run_id: string
event: string
@ -88,7 +89,7 @@ export type WorkflowStartedResponse = {
}
}
export type WorkflowFinishedResponse = {
export interface WorkflowFinishedResponse {
task_id: string
workflow_run_id: string
event: string
@ -108,10 +109,11 @@ export type WorkflowFinishedResponse = {
email: string
}
finished_at: number
files?: FileResponse[]
}
}
export type NodeStartedResponse = {
export interface NodeStartedResponse {
task_id: string
workflow_run_id: string
event: string
@ -128,7 +130,18 @@ export type NodeStartedResponse = {
}
}
export type NodeFinishedResponse = {
export interface FileResponse {
related_id: string
extension: string
filename: string
size: number
mime_type: string
transfer_method: TransferMethod
type: string
url: string
}
export interface NodeFinishedResponse {
task_id: string
workflow_run_id: string
event: string
@ -155,10 +168,11 @@ export type NodeFinishedResponse = {
iteration_id?: string
}
created_at: number
files?: FileResponse[]
}
}
export type IterationStartedResponse = {
export interface IterationStartedResponse {
task_id: string
workflow_run_id: string
event: string
@ -175,7 +189,7 @@ export type IterationStartedResponse = {
}
}
export type IterationNextResponse = {
export interface IterationNextResponse {
task_id: string
workflow_run_id: string
event: string
@ -192,7 +206,7 @@ export type IterationNextResponse = {
}
}
export type IterationFinishedResponse = {
export interface IterationFinishedResponse {
task_id: string
workflow_run_id: string
event: string
@ -210,7 +224,7 @@ export type IterationFinishedResponse = {
}
}
export type ParallelBranchStartedResponse = {
export interface ParallelBranchStartedResponse {
task_id: string
workflow_run_id: string
event: string
@ -224,7 +238,7 @@ export type ParallelBranchStartedResponse = {
}
}
export type ParallelBranchFinishedResponse = {
export interface ParallelBranchFinishedResponse {
task_id: string
workflow_run_id: string
event: string
@ -240,7 +254,7 @@ export type ParallelBranchFinishedResponse = {
}
}
export type TextChunkResponse = {
export interface TextChunkResponse {
task_id: string
workflow_run_id: string
event: string
@ -249,7 +263,7 @@ export type TextChunkResponse = {
}
}
export type TextReplaceResponse = {
export interface TextReplaceResponse {
task_id: string
workflow_run_id: string
event: string
@ -258,7 +272,7 @@ export type TextReplaceResponse = {
}
}
export type WorkflowRunHistory = {
export interface WorkflowRunHistory {
id: string
sequence_number: number
version: string
@ -284,11 +298,11 @@ export type WorkflowRunHistory = {
email: string
}
}
export type WorkflowRunHistoryResponse = {
export interface WorkflowRunHistoryResponse {
data: WorkflowRunHistory[]
}
export type ChatRunHistoryResponse = {
export interface ChatRunHistoryResponse {
data: WorkflowRunHistory[]
}
@ -297,7 +311,7 @@ export type NodesDefaultConfigsResponse = {
config: any
}[]
export type ConversationVariableResponse = {
export interface ConversationVariableResponse {
data: (ConversationVariable & { updated_at: number; created_at: number })[]
has_more: boolean
limit: number