mirror of
https://github.com/langgenius/dify.git
synced 2026-09-24 23:22:26 +08:00
feat: optimize integrations initial loading (#40118)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
autofix-ci[bot]
parent
6f2e4d72d3
commit
5dfd83e9ab
File diff suppressed because it is too large
Load Diff
@@ -227,6 +227,24 @@ export type ModelProviderListResponse = {
|
||||
data: Array<ProviderResponse>
|
||||
}
|
||||
|
||||
export type ModelProviderCreditsResponse = {
|
||||
exhausted_at: number | null
|
||||
is_exhausted: boolean
|
||||
is_unlimited: boolean
|
||||
next_credit_reset_date: number | null
|
||||
pool_type: 'paid' | 'trial' | null
|
||||
quota_limit: number | null
|
||||
quota_used: number | null
|
||||
remaining_credits: number | null
|
||||
}
|
||||
|
||||
export type ModelProviderSummaryListResponse = {
|
||||
data: Array<ModelProviderSummaryResponse>
|
||||
plugins: {
|
||||
[key: string]: ModelProviderPluginSummaryResponse
|
||||
}
|
||||
}
|
||||
|
||||
export type ModelProviderPaymentCheckoutUrlResponse = {
|
||||
payment_link: string
|
||||
}
|
||||
@@ -417,6 +435,10 @@ export type ParserPluginIdentifiers = {
|
||||
plugin_unique_identifiers: Array<string>
|
||||
}
|
||||
|
||||
export type PluginInstalledIdsResponse = {
|
||||
plugin_ids: Array<string>
|
||||
}
|
||||
|
||||
export type PluginListResponse = {
|
||||
plugins: Array<PluginEntity>
|
||||
total: number
|
||||
@@ -1192,6 +1214,30 @@ export type ProviderResponse = {
|
||||
tenant_id: string
|
||||
}
|
||||
|
||||
export type ModelProviderSummaryResponse = {
|
||||
configurate_methods: Array<ConfigurateMethod>
|
||||
custom_configuration: ModelProviderCustomConfigurationSummaryResponse
|
||||
description?: I18nObject | null
|
||||
icon_small?: I18nObject | null
|
||||
icon_small_dark?: I18nObject | null
|
||||
is_configured: boolean
|
||||
label: I18nObject
|
||||
plugin_id: string
|
||||
preferred_provider_type: ProviderType
|
||||
provider: string
|
||||
supported_model_types: Array<ModelType>
|
||||
system_configuration: ModelProviderSystemConfigurationSummaryResponse
|
||||
}
|
||||
|
||||
export type ModelProviderPluginSummaryResponse = {
|
||||
installation_id: string
|
||||
plugin_id: string
|
||||
plugin_unique_identifier: string
|
||||
runtime_type: string
|
||||
source: PluginInstallationSource
|
||||
version: string
|
||||
}
|
||||
|
||||
export type ModelType = 'llm' | 'moderation' | 'rerank' | 'speech2text' | 'text-embedding' | 'tts'
|
||||
|
||||
export type ModelWithProviderEntityResponse = {
|
||||
@@ -1730,6 +1776,21 @@ export type SystemConfigurationResponse = {
|
||||
quota_configurations?: Array<QuotaConfiguration>
|
||||
}
|
||||
|
||||
export type ModelProviderCustomConfigurationSummaryResponse = {
|
||||
available_credentials: Array<CredentialConfiguration>
|
||||
current_credential_id?: string | null
|
||||
current_credential_name?: string | null
|
||||
current_credential_usable: boolean
|
||||
has_custom_models: boolean
|
||||
status: CustomConfigurationStatus
|
||||
}
|
||||
|
||||
export type ModelProviderSystemConfigurationSummaryResponse = {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export type PluginInstallationSource = 'github' | 'marketplace' | 'package' | 'remote'
|
||||
|
||||
export type ModelFeature =
|
||||
| 'agent-thought'
|
||||
| 'audio'
|
||||
@@ -1900,8 +1961,6 @@ export type PluginInstallTaskPluginStatus = {
|
||||
|
||||
export type PluginInstallTaskStatus = 'failed' | 'pending' | 'running' | 'success'
|
||||
|
||||
export type PluginInstallationSource = 'github' | 'marketplace' | 'package' | 'remote'
|
||||
|
||||
export type PluginDeclarationResponse = {
|
||||
agent_strategy?: {
|
||||
[key: string]: unknown
|
||||
@@ -3029,6 +3088,34 @@ export type GetWorkspacesCurrentModelProvidersResponses = {
|
||||
export type GetWorkspacesCurrentModelProvidersResponse =
|
||||
GetWorkspacesCurrentModelProvidersResponses[keyof GetWorkspacesCurrentModelProvidersResponses]
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersCreditsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/workspaces/current/model-providers/credits'
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersCreditsResponses = {
|
||||
200: ModelProviderCreditsResponse
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersCreditsResponse =
|
||||
GetWorkspacesCurrentModelProvidersCreditsResponses[keyof GetWorkspacesCurrentModelProvidersCreditsResponses]
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersSummaryData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/workspaces/current/model-providers/summary'
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersSummaryResponses = {
|
||||
200: ModelProviderSummaryListResponse
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersSummaryResponse =
|
||||
GetWorkspacesCurrentModelProvidersSummaryResponses[keyof GetWorkspacesCurrentModelProvidersSummaryResponses]
|
||||
|
||||
export type GetWorkspacesCurrentModelProvidersByProviderCheckoutUrlData = {
|
||||
body?: never
|
||||
path: {
|
||||
@@ -3575,6 +3662,22 @@ export type PostWorkspacesCurrentPluginInstallPkgResponses = {
|
||||
export type PostWorkspacesCurrentPluginInstallPkgResponse =
|
||||
PostWorkspacesCurrentPluginInstallPkgResponses[keyof PostWorkspacesCurrentPluginInstallPkgResponses]
|
||||
|
||||
export type GetWorkspacesCurrentPluginInstalledIdsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
category: 'agent-strategy' | 'datasource' | 'extension' | 'model' | 'tool' | 'trigger'
|
||||
}
|
||||
url: '/workspaces/current/plugin/installed-ids'
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentPluginInstalledIdsResponses = {
|
||||
200: PluginInstalledIdsResponse
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentPluginInstalledIdsResponse =
|
||||
GetWorkspacesCurrentPluginInstalledIdsResponses[keyof GetWorkspacesCurrentPluginInstalledIdsResponses]
|
||||
|
||||
export type GetWorkspacesCurrentPluginListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
@@ -3888,8 +3991,11 @@ export type GetWorkspacesCurrentPluginByCategoryListData = {
|
||||
category: string
|
||||
}
|
||||
query?: {
|
||||
language?: 'en_US' | 'ja_JP' | 'pt_BR' | 'zh_Hans'
|
||||
page?: number
|
||||
page_size?: number
|
||||
query?: string
|
||||
tags?: Array<string>
|
||||
}
|
||||
url: '/workspaces/current/plugin/{category}/list'
|
||||
}
|
||||
|
||||
@@ -158,6 +158,20 @@ export const zMemberRoleUpdatePayload = z.object({
|
||||
role: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ModelProviderCreditsResponse
|
||||
*/
|
||||
export const zModelProviderCreditsResponse = z.object({
|
||||
exhausted_at: z.int().nullable(),
|
||||
is_exhausted: z.boolean(),
|
||||
is_unlimited: z.boolean(),
|
||||
next_credit_reset_date: z.int().nullable(),
|
||||
pool_type: z.enum(['paid', 'trial']).nullable(),
|
||||
quota_limit: z.int().nullable(),
|
||||
quota_used: z.int().nullable(),
|
||||
remaining_credits: z.int().nullable(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ModelProviderPaymentCheckoutUrlResponse
|
||||
*/
|
||||
@@ -283,6 +297,13 @@ export const zParserPluginIdentifiers = z.object({
|
||||
plugin_unique_identifiers: z.array(z.string()),
|
||||
})
|
||||
|
||||
/**
|
||||
* PluginInstalledIdsResponse
|
||||
*/
|
||||
export const zPluginInstalledIdsResponse = z.object({
|
||||
plugin_ids: z.array(z.string()),
|
||||
})
|
||||
|
||||
/**
|
||||
* ParserLatest
|
||||
*/
|
||||
@@ -1613,6 +1634,30 @@ export const zConfigurateMethod = z.enum(['customizable-model', 'predefined-mode
|
||||
*/
|
||||
export const zProviderType = z.enum(['custom', 'system'])
|
||||
|
||||
/**
|
||||
* ModelProviderSystemConfigurationSummaryResponse
|
||||
*/
|
||||
export const zModelProviderSystemConfigurationSummaryResponse = z.object({
|
||||
enabled: z.boolean(),
|
||||
})
|
||||
|
||||
/**
|
||||
* PluginInstallationSource
|
||||
*/
|
||||
export const zPluginInstallationSource = z.enum(['github', 'marketplace', 'package', 'remote'])
|
||||
|
||||
/**
|
||||
* ModelProviderPluginSummaryResponse
|
||||
*/
|
||||
export const zModelProviderPluginSummaryResponse = z.object({
|
||||
installation_id: z.string(),
|
||||
plugin_id: z.string(),
|
||||
plugin_unique_identifier: z.string(),
|
||||
runtime_type: z.string(),
|
||||
source: zPluginInstallationSource,
|
||||
version: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ModelFeature
|
||||
*
|
||||
@@ -1803,6 +1848,46 @@ export const zAvailableModelListResponse = z.object({
|
||||
data: z.array(zProviderWithModelsResponse),
|
||||
})
|
||||
|
||||
/**
|
||||
* ModelProviderCustomConfigurationSummaryResponse
|
||||
*/
|
||||
export const zModelProviderCustomConfigurationSummaryResponse = z.object({
|
||||
available_credentials: z.array(zCredentialConfiguration),
|
||||
current_credential_id: z.string().nullish(),
|
||||
current_credential_name: z.string().nullish(),
|
||||
current_credential_usable: z.boolean(),
|
||||
has_custom_models: z.boolean(),
|
||||
status: zCustomConfigurationStatus,
|
||||
})
|
||||
|
||||
/**
|
||||
* ModelProviderSummaryResponse
|
||||
*
|
||||
* Fields required to render the collapsed model-provider list.
|
||||
*/
|
||||
export const zModelProviderSummaryResponse = z.object({
|
||||
configurate_methods: z.array(zConfigurateMethod),
|
||||
custom_configuration: zModelProviderCustomConfigurationSummaryResponse,
|
||||
description: zI18nObject.nullish(),
|
||||
icon_small: zI18nObject.nullish(),
|
||||
icon_small_dark: zI18nObject.nullish(),
|
||||
is_configured: z.boolean(),
|
||||
label: zI18nObject,
|
||||
plugin_id: z.string(),
|
||||
preferred_provider_type: zProviderType,
|
||||
provider: z.string(),
|
||||
supported_model_types: z.array(zModelType),
|
||||
system_configuration: zModelProviderSystemConfigurationSummaryResponse,
|
||||
})
|
||||
|
||||
/**
|
||||
* ModelProviderSummaryListResponse
|
||||
*/
|
||||
export const zModelProviderSummaryListResponse = z.object({
|
||||
data: z.array(zModelProviderSummaryResponse),
|
||||
plugins: z.record(z.string(), zModelProviderPluginSummaryResponse),
|
||||
})
|
||||
|
||||
/**
|
||||
* TenantPluginAutoUpgradeStrategySetting
|
||||
*/
|
||||
@@ -1948,11 +2033,6 @@ export const zPluginTaskResponse = z.object({
|
||||
task: zPluginInstallTask,
|
||||
})
|
||||
|
||||
/**
|
||||
* PluginInstallationSource
|
||||
*/
|
||||
export const zPluginInstallationSource = z.enum(['github', 'marketplace', 'package', 'remote'])
|
||||
|
||||
/**
|
||||
* PluginBundleDependencyType
|
||||
*/
|
||||
@@ -3696,6 +3776,16 @@ export const zGetWorkspacesCurrentModelProvidersQuery = z.object({
|
||||
*/
|
||||
export const zGetWorkspacesCurrentModelProvidersResponse = zModelProviderListResponse
|
||||
|
||||
/**
|
||||
* Model provider credits retrieved successfully
|
||||
*/
|
||||
export const zGetWorkspacesCurrentModelProvidersCreditsResponse = zModelProviderCreditsResponse
|
||||
|
||||
/**
|
||||
* Model provider summaries retrieved successfully
|
||||
*/
|
||||
export const zGetWorkspacesCurrentModelProvidersSummaryResponse = zModelProviderSummaryListResponse
|
||||
|
||||
export const zGetWorkspacesCurrentModelProvidersByProviderCheckoutUrlPath = z.object({
|
||||
provider: z.string(),
|
||||
})
|
||||
@@ -4071,6 +4161,15 @@ export const zPostWorkspacesCurrentPluginInstallPkgBody = zParserPluginIdentifie
|
||||
*/
|
||||
export const zPostWorkspacesCurrentPluginInstallPkgResponse = zPluginInstallTaskStartResponse
|
||||
|
||||
export const zGetWorkspacesCurrentPluginInstalledIdsQuery = z.object({
|
||||
category: z.enum(['agent-strategy', 'datasource', 'extension', 'model', 'tool', 'trigger']),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetWorkspacesCurrentPluginInstalledIdsResponse = zPluginInstalledIdsResponse
|
||||
|
||||
export const zGetWorkspacesCurrentPluginListQuery = z.object({
|
||||
page: z.int().gte(1).optional().default(1),
|
||||
page_size: z.int().gte(1).lte(256).optional().default(256),
|
||||
@@ -4241,8 +4340,11 @@ export const zGetWorkspacesCurrentPluginByCategoryListPath = z.object({
|
||||
})
|
||||
|
||||
export const zGetWorkspacesCurrentPluginByCategoryListQuery = z.object({
|
||||
language: z.enum(['en_US', 'ja_JP', 'pt_BR', 'zh_Hans']).optional().default('en_US'),
|
||||
page: z.int().gte(1).optional().default(1),
|
||||
page_size: z.int().gte(1).lte(256).optional().default(256),
|
||||
query: z.string().max(256).optional().default(''),
|
||||
tags: z.array(z.string()).max(128).optional(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user