chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60158935f4
commit
6519682885
15831 files changed
+3063428
No files matched your search
+38
@@ -0,0 +1,38 @@
|
||||
// This file is auto-generated by scripts/add-orpc-error-maps.ts
|
||||
import * as z from 'zod'
|
||||
|
||||
const zErrorResponse = /* @__PURE__ */ (() =>
|
||||
z.object({
|
||||
code: z.string(),
|
||||
details: z.record(z.string(), z.unknown()).optional(),
|
||||
message: z.string(),
|
||||
params: z.string().optional(),
|
||||
status: z.int(),
|
||||
}))()
|
||||
|
||||
const zUnsupportedDataSourceApiKeyAuthProviderError = /* @__PURE__ */ (() =>
|
||||
zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('unsupported_data_source_api_key_auth_provider'),
|
||||
status: z.literal(400),
|
||||
}),
|
||||
))()
|
||||
|
||||
const zDataSourceApiKeyAuthProviderUnavailableError = /* @__PURE__ */ (() =>
|
||||
zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('data_source_api_key_auth_provider_unavailable'),
|
||||
status: z.literal(502),
|
||||
}),
|
||||
))()
|
||||
|
||||
export const postErrors = {
|
||||
data_source_api_key_auth_provider_unavailable: {
|
||||
status: 502,
|
||||
data: zDataSourceApiKeyAuthProviderUnavailableError,
|
||||
},
|
||||
unsupported_data_source_api_key_auth_provider: {
|
||||
status: 400,
|
||||
data: zUnsupportedDataSourceApiKeyAuthProviderError,
|
||||
},
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { oc } from '@orpc/contract'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
zDataSourceApiKeyAuthProviderUnavailableError,
|
||||
zUnsupportedDataSourceApiKeyAuthProviderError,
|
||||
} from './zod.gen.ts'
|
||||
import {
|
||||
zDeleteApiKeyAuthDataSourceByBindingIdPath,
|
||||
zDeleteApiKeyAuthDataSourceByBindingIdResponse,
|
||||
zGetApiKeyAuthDataSourceResponse,
|
||||
zPostApiKeyAuthDataSourceBindingBody,
|
||||
zPostApiKeyAuthDataSourceBindingResponse,
|
||||
} from './zod.gen.ts'
|
||||
|
||||
export const post = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postApiKeyAuthDataSourceBinding',
|
||||
path: '/api-key-auth/data-source/binding',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(z.object({ body: zPostApiKeyAuthDataSourceBindingBody }))
|
||||
.output(zPostApiKeyAuthDataSourceBindingResponse)
|
||||
.errors({
|
||||
data_source_api_key_auth_provider_unavailable: {
|
||||
status: 502,
|
||||
data: zDataSourceApiKeyAuthProviderUnavailableError,
|
||||
},
|
||||
unsupported_data_source_api_key_auth_provider: {
|
||||
status: 400,
|
||||
data: zUnsupportedDataSourceApiKeyAuthProviderError,
|
||||
},
|
||||
})
|
||||
|
||||
export const binding = {
|
||||
post,
|
||||
}
|
||||
|
||||
export const delete_ = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'DELETE',
|
||||
operationId: 'deleteApiKeyAuthDataSourceByBindingId',
|
||||
path: '/api-key-auth/data-source/{binding_id}',
|
||||
successStatus: 204,
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(z.object({ params: zDeleteApiKeyAuthDataSourceByBindingIdPath }))
|
||||
.output(zDeleteApiKeyAuthDataSourceByBindingIdResponse)
|
||||
|
||||
export const byBindingId = {
|
||||
delete: delete_,
|
||||
}
|
||||
|
||||
export const get = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getApiKeyAuthDataSource',
|
||||
path: '/api-key-auth/data-source',
|
||||
tags: ['console'],
|
||||
})
|
||||
.output(zGetApiKeyAuthDataSourceResponse)
|
||||
|
||||
export const dataSource = {
|
||||
get,
|
||||
binding,
|
||||
byBindingId,
|
||||
}
|
||||
|
||||
export const apiKeyAuth = {
|
||||
dataSource,
|
||||
}
|
||||
|
||||
export const contract = {
|
||||
apiKeyAuth,
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}/console/api` | (string & {})
|
||||
}
|
||||
|
||||
export type ApiKeyAuthDataSourceListResponse = {
|
||||
sources: Array<ApiKeyAuthDataSourceItem>
|
||||
}
|
||||
|
||||
export type ErrorResponse = {
|
||||
code: string
|
||||
details?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
message: string
|
||||
params?: string
|
||||
status: number
|
||||
}
|
||||
|
||||
export type ApiKeyAuthBindingPayload = {
|
||||
category: string
|
||||
credentials: ApiKeyAuthCredentialsPayload
|
||||
provider: string
|
||||
}
|
||||
|
||||
export type SimpleResultResponse = {
|
||||
result: string
|
||||
}
|
||||
|
||||
export type UnsupportedDataSourceApiKeyAuthProviderError = ErrorResponse & {
|
||||
code: 'unsupported_data_source_api_key_auth_provider'
|
||||
status: 400
|
||||
}
|
||||
|
||||
export type DataSourceApiKeyAuthProviderUnavailableError = ErrorResponse & {
|
||||
code: 'data_source_api_key_auth_provider_unavailable'
|
||||
status: 502
|
||||
}
|
||||
|
||||
export type ApiKeyAuthDataSourceItem = {
|
||||
category: string
|
||||
created_at: number
|
||||
disabled: boolean
|
||||
id: string
|
||||
provider: string
|
||||
updated_at: number
|
||||
}
|
||||
|
||||
export type ApiKeyAuthCredentialsPayload = {
|
||||
auth_type: string
|
||||
config: ApiKeyAuthConfigPayload
|
||||
}
|
||||
|
||||
export type ApiKeyAuthConfigPayload = {
|
||||
api_key: string
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type GetApiKeyAuthDataSourceData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/api-key-auth/data-source'
|
||||
}
|
||||
|
||||
export type GetApiKeyAuthDataSourceErrors = {
|
||||
default: ErrorResponse
|
||||
}
|
||||
|
||||
export type GetApiKeyAuthDataSourceError =
|
||||
GetApiKeyAuthDataSourceErrors[keyof GetApiKeyAuthDataSourceErrors]
|
||||
|
||||
export type GetApiKeyAuthDataSourceResponses = {
|
||||
200: ApiKeyAuthDataSourceListResponse
|
||||
}
|
||||
|
||||
export type GetApiKeyAuthDataSourceResponse =
|
||||
GetApiKeyAuthDataSourceResponses[keyof GetApiKeyAuthDataSourceResponses]
|
||||
|
||||
export type PostApiKeyAuthDataSourceBindingData = {
|
||||
body: ApiKeyAuthBindingPayload
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/api-key-auth/data-source/binding'
|
||||
}
|
||||
|
||||
export type PostApiKeyAuthDataSourceBindingErrors = {
|
||||
400: UnsupportedDataSourceApiKeyAuthProviderError | ErrorResponse
|
||||
502: DataSourceApiKeyAuthProviderUnavailableError | ErrorResponse
|
||||
default: ErrorResponse
|
||||
}
|
||||
|
||||
export type PostApiKeyAuthDataSourceBindingError =
|
||||
PostApiKeyAuthDataSourceBindingErrors[keyof PostApiKeyAuthDataSourceBindingErrors]
|
||||
|
||||
export type PostApiKeyAuthDataSourceBindingResponses = {
|
||||
200: SimpleResultResponse
|
||||
}
|
||||
|
||||
export type PostApiKeyAuthDataSourceBindingResponse =
|
||||
PostApiKeyAuthDataSourceBindingResponses[keyof PostApiKeyAuthDataSourceBindingResponses]
|
||||
|
||||
export type DeleteApiKeyAuthDataSourceByBindingIdData = {
|
||||
body?: never
|
||||
path: {
|
||||
binding_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/api-key-auth/data-source/{binding_id}'
|
||||
}
|
||||
|
||||
export type DeleteApiKeyAuthDataSourceByBindingIdErrors = {
|
||||
default: ErrorResponse
|
||||
}
|
||||
|
||||
export type DeleteApiKeyAuthDataSourceByBindingIdError =
|
||||
DeleteApiKeyAuthDataSourceByBindingIdErrors[keyof DeleteApiKeyAuthDataSourceByBindingIdErrors]
|
||||
|
||||
export type DeleteApiKeyAuthDataSourceByBindingIdResponses = {
|
||||
204: void
|
||||
}
|
||||
|
||||
export type DeleteApiKeyAuthDataSourceByBindingIdResponse =
|
||||
DeleteApiKeyAuthDataSourceByBindingIdResponses[keyof DeleteApiKeyAuthDataSourceByBindingIdResponses]
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import * as z from 'zod'
|
||||
|
||||
/**
|
||||
* ErrorResponse
|
||||
*
|
||||
* Documented non-2xx body emitted by ``register_external_error_handlers``.
|
||||
*
|
||||
* ``params`` and ``details`` appear only on the errors that set them. The schema
|
||||
* stays open because ``HTTPException.data`` may carry extra keys.
|
||||
*/
|
||||
export const zErrorResponse = z.object({
|
||||
code: z.string(),
|
||||
details: z.record(z.string(), z.unknown()).optional(),
|
||||
message: z.string(),
|
||||
params: z.string().optional(),
|
||||
status: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* SimpleResultResponse
|
||||
*/
|
||||
export const zSimpleResultResponse = z.object({
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* UnsupportedDataSourceApiKeyAuthProviderError
|
||||
*
|
||||
* The data-source API-key authentication provider is not supported.
|
||||
*/
|
||||
export const zUnsupportedDataSourceApiKeyAuthProviderError = zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('unsupported_data_source_api_key_auth_provider'),
|
||||
status: z.literal(400),
|
||||
}),
|
||||
)
|
||||
|
||||
/**
|
||||
* DataSourceApiKeyAuthProviderUnavailableError
|
||||
*
|
||||
* The data-source API-key authentication provider is temporarily unavailable.
|
||||
*/
|
||||
export const zDataSourceApiKeyAuthProviderUnavailableError = zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('data_source_api_key_auth_provider_unavailable'),
|
||||
status: z.literal(502),
|
||||
}),
|
||||
)
|
||||
|
||||
/**
|
||||
* ApiKeyAuthDataSourceItem
|
||||
*/
|
||||
export const zApiKeyAuthDataSourceItem = z.object({
|
||||
category: z.string(),
|
||||
created_at: z.int(),
|
||||
disabled: z.boolean(),
|
||||
id: z.string(),
|
||||
provider: z.string(),
|
||||
updated_at: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ApiKeyAuthDataSourceListResponse
|
||||
*/
|
||||
export const zApiKeyAuthDataSourceListResponse = z.object({
|
||||
sources: z.array(zApiKeyAuthDataSourceItem),
|
||||
})
|
||||
|
||||
/**
|
||||
* ApiKeyAuthConfigPayload
|
||||
*/
|
||||
export const zApiKeyAuthConfigPayload = z.object({
|
||||
api_key: z.string().min(1),
|
||||
})
|
||||
|
||||
/**
|
||||
* ApiKeyAuthCredentialsPayload
|
||||
*/
|
||||
export const zApiKeyAuthCredentialsPayload = z.object({
|
||||
auth_type: z.string().min(1),
|
||||
config: zApiKeyAuthConfigPayload,
|
||||
})
|
||||
|
||||
/**
|
||||
* ApiKeyAuthBindingPayload
|
||||
*/
|
||||
export const zApiKeyAuthBindingPayload = z.object({
|
||||
category: z.string().min(1),
|
||||
credentials: zApiKeyAuthCredentialsPayload,
|
||||
provider: z.string().min(1),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetApiKeyAuthDataSourceResponse = zApiKeyAuthDataSourceListResponse
|
||||
|
||||
export const zPostApiKeyAuthDataSourceBindingBody = zApiKeyAuthBindingPayload
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostApiKeyAuthDataSourceBindingResponse = zSimpleResultResponse
|
||||
|
||||
export const zDeleteApiKeyAuthDataSourceByBindingIdPath = z.object({
|
||||
binding_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Binding deleted successfully
|
||||
*/
|
||||
export const zDeleteApiKeyAuthDataSourceByBindingIdResponse = z.void()
|
||||
Reference in new issue
Block a user