Underground-Digital/Workflow-Engine
0
1import type { I18nText } from '@/i18n/language'2 3export type CommonResponse = {4 result: 'success' | 'fail'5}6 7export type OauthResponse = {8 redirect_url: string9}10 11export type SetupStatusResponse = {12 step: 'finished' | 'not_started'13 setup_at?: Date14}15 16export type InitValidateStatusResponse = {17 status: 'finished' | 'not_started'18}19 20export type UserProfileResponse = {21 id: string22 name: string23 email: string24 avatar: string25 is_password_set: boolean26 interface_language?: string27 interface_theme?: string28 timezone?: string29 last_login_at?: string30 last_active_at?: string31 last_login_ip?: string32 created_at?: string33}34 35export type UserProfileOriginResponse = {36 json: () => Promise<UserProfileResponse>37 bodyUsed: boolean38 headers: any39}40 41export type LangGeniusVersionResponse = {42 current_version: string43 latest_version: string44 version: string45 release_date: string46 release_notes: string47 can_auto_update: boolean48 current_env: string49}50 51export type TenantInfoResponse = {52 name: string53 created_at: string54 providers: Array<{55 provider: string56 provider_name: string57 token_is_set: boolean58 is_valid: boolean59 token_is_valid: boolean60 }>61 in_trail: boolean62 trial_end_reason: null | 'trial_exceeded' | 'using_custom'63}64 65export type Member = Pick<UserProfileResponse, 'id' | 'name' | 'email' | 'last_login_at' | 'last_active_at' | 'created_at'> & {66 avatar: string67 status: 'pending' | 'active' | 'banned' | 'closed'68 role: 'owner' | 'admin' | 'editor' | 'normal' | 'dataset_operator'69}70 71export enum ProviderName {72 OPENAI = 'openai',73 AZURE_OPENAI = 'azure_openai',74 ANTHROPIC = 'anthropic',75 Replicate = 'replicate',76 HuggingfaceHub = 'huggingface_hub',77 MiniMax = 'minimax',78 Spark = 'spark',79 Tongyi = 'tongyi',80 ChatGLM = 'chatglm',81}82export type ProviderAzureToken = {83 openai_api_base?: string84 openai_api_key?: string85}86export type ProviderAnthropicToken = {87 anthropic_api_key?: string88}89export type ProviderTokenType = {90 [ProviderName.OPENAI]: string91 [ProviderName.AZURE_OPENAI]: ProviderAzureToken92 [ProviderName.ANTHROPIC]: ProviderAnthropicToken93}94export type Provider = {95 [Name in ProviderName]: {96 provider_name: Name97 } & {98 provider_type: 'custom' | 'system'99 is_valid: boolean100 is_enabled: boolean101 last_used: string102 token?: string | ProviderAzureToken | ProviderAnthropicToken103 }104}[ProviderName]105 106export type ProviderHosted = Provider & {107 quota_type: string108 quota_limit: number109 quota_used: number110}111 112export type AccountIntegrate = {113 provider: 'google' | 'github'114 created_at: number115 is_bound: boolean116 link: string117}118 119export type IWorkspace = {120 id: string121 name: string122 plan: string123 status: string124 created_at: number125 current: boolean126}127 128export type ICurrentWorkspace = Omit<IWorkspace, 'current'> & {129 role: 'owner' | 'admin' | 'editor' | 'dataset_operator' | 'normal'130 providers: Provider[]131 in_trail: boolean132 trial_end_reason?: string133 custom_config?: {134 remove_webapp_brand?: boolean135 replace_webapp_logo?: string136 }137}138 139export type DataSourceNotionPage = {140 page_icon: null | {141 type: string | null142 url: string | null143 emoji: string | null144 }145 page_id: string146 page_name: string147 parent_id: string148 type: string149 is_bound: boolean150}151 152export type NotionPage = DataSourceNotionPage & {153 workspace_id: string154}155 156export type DataSourceNotionPageMap = Record<string, DataSourceNotionPage & { workspace_id: string }>157 158export type DataSourceNotionWorkspace = {159 workspace_name: string160 workspace_id: string161 workspace_icon: string | null162 total?: number163 pages: DataSourceNotionPage[]164}165 166export type DataSourceNotionWorkspaceMap = Record<string, DataSourceNotionWorkspace>167 168export type DataSourceNotion = {169 id: string170 provider: string171 is_bound: boolean172 source_info: DataSourceNotionWorkspace173}174 175export enum DataSourceCategory {176 website = 'website',177}178export enum DataSourceProvider {179 fireCrawl = 'firecrawl',180 jinaReader = 'jinareader',181}182 183export type FirecrawlConfig = {184 api_key: string185 base_url: string186}187 188export type DataSourceItem = {189 id: string190 category: DataSourceCategory191 provider: DataSourceProvider192 disabled: boolean193 created_at: number194 updated_at: number195}196 197export type DataSources = {198 sources: DataSourceItem[]199}200 201export type GithubRepo = {202 stargazers_count: number203}204 205export type PluginProvider = {206 tool_name: string207 is_enabled: boolean208 credentials: {209 api_key: string210 } | null211}212 213export type FileUploadConfigResponse = {214 batch_count_limit: number215 image_file_size_limit?: number | string // default is 10MB216 file_size_limit: number // default is 15MB217 audio_file_size_limit?: number // default is 50MB218 video_file_size_limit?: number // default is 100MB219 workflow_file_upload_limit?: number // default is 10220}221 222export type InvitationResult = {223 status: 'success'224 email: string225 url: string226} | {227 status: 'failed'228 email: string229 message: string230}231 232export type InvitationResponse = CommonResponse & {233 invitation_results: InvitationResult[]234}235 236export type ApiBasedExtension = {237 id?: string238 name?: string239 api_endpoint?: string240 api_key?: string241}242 243export type CodeBasedExtensionForm = {244 type: string245 label: I18nText246 variable: string247 required: boolean248 options: { label: I18nText; value: string }[]249 default: string250 placeholder: string251 max_length?: number252}253 254export type CodeBasedExtensionItem = {255 name: string256 label: any257 form_schema: CodeBasedExtensionForm[]258}259export type CodeBasedExtension = {260 module: string261 data: CodeBasedExtensionItem[]262}263 264export type ExternalDataTool = {265 type?: string266 label?: string267 icon?: string268 icon_background?: string269 variable?: string270 enabled?: boolean271 config?: {272 api_based_extension_id?: string273 } & Partial<Record<string, any>>274}275 276export type ModerateResponse = {277 flagged: boolean278 text: string279}280 281export type ModerationService = (282 url: string,283 body: {284 app_id: string285 text: string286 }287) => Promise<ModerateResponse>288 