chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动

演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-18 13:59:25 +08:00
1 parent 60158935f4
commit 6519682885
15831 files changed
+3063428

No files matched your search

@@ -0,0 +1,23 @@
// 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 zRecommendedAppNotFoundError = /* @__PURE__ */ (() =>
zErrorResponse.and(
z.object({
code: z.literal('recommended_app_not_found'),
status: z.literal(404),
}),
))()
export const get2Errors = {
recommended_app_not_found: { status: 404, data: zRecommendedAppNotFoundError },
}
@@ -0,0 +1,91 @@
// This file is auto-generated by @hey-api/openapi-ts
import { oc } from '@orpc/contract'
import * as z from 'zod'
import { zRecommendedAppNotFoundError } from './zod.gen.ts'
import {
zGetExploreAppsByAppIdPath,
zGetExploreAppsByAppIdResponse,
zGetExploreAppsLearnDifyQuery,
zGetExploreAppsLearnDifyResponse,
zGetExploreAppsQuery,
zGetExploreAppsResponse,
zGetExploreBannersQuery,
zGetExploreBannersResponse,
} from './zod.gen.ts'
export const get = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'getExploreAppsLearnDify',
path: '/explore/apps/learn-dify',
tags: ['console'],
})
.input(z.object({ query: zGetExploreAppsLearnDifyQuery.optional() }).optional())
.output(zGetExploreAppsLearnDifyResponse)
export const learnDify = {
get,
}
export const get2 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'getExploreAppsByAppId',
path: '/explore/apps/{app_id}',
tags: ['console'],
})
.input(z.object({ params: zGetExploreAppsByAppIdPath }))
.output(zGetExploreAppsByAppIdResponse)
.errors({ recommended_app_not_found: { status: 404, data: zRecommendedAppNotFoundError } })
export const byAppId = {
get: get2,
}
export const get3 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'getExploreApps',
path: '/explore/apps',
tags: ['console'],
})
.input(z.object({ query: zGetExploreAppsQuery.optional() }).optional())
.output(zGetExploreAppsResponse)
export const apps = {
get: get3,
learnDify,
byAppId,
}
/**
* Get banner list
*/
export const get4 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'getExploreBanners',
path: '/explore/banners',
summary: 'Get banner list',
tags: ['default'],
})
.input(z.object({ query: zGetExploreBannersQuery.optional() }).optional())
.output(zGetExploreBannersResponse)
export const banners = {
get: get4,
}
export const explore = {
apps,
banners,
}
export const contract = {
explore,
}
@@ -0,0 +1,204 @@
// This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = {
baseUrl: `${string}://${string}/console/api` | (string & {})
}
export type RecommendedAppListResponse = {
categories: Array<string>
recommended_apps: Array<RecommendedAppResponse>
}
export type ErrorResponse = {
code: string
details?: {
[key: string]: unknown
}
message: string
params?: string
status: number
}
export type LearnDifyAppListResponse = {
recommended_apps: Array<RecommendedAppResponse>
}
export type RecommendedAppDetailResponse = {
can_trial: boolean
export_data: string
icon?: string | null
icon_background?: string | null
id: string
mode: string
name: string
package_url?: string | null
version_id?: string | null
}
export type RecommendedAppNotFoundError = ErrorResponse & {
code: 'recommended_app_not_found'
status: 404
}
export type BannerListResponse = Array<BannerResponse>
export type RecommendedAppResponse = {
app?: RecommendedAppInfoResponse | null
app_id: string
can_trial: boolean
categories?: Array<string>
copyright?: string | null
custom_disclaimer?: string | null
description?: string | null
is_listed?: boolean | null
position?: number | null
privacy_policy?: string | null
}
export type BannerResponse = {
content: BannerContentResponse
created_at: string
id: string
link: string
sort: number
status: BannerStatus
}
export type RecommendedAppInfoResponse = {
icon?: string | null
icon_background?: string | null
icon_type?: string | null
readonly icon_url: string | null
id: string
mode?: string | null
name?: string | null
}
export type BannerContentResponse = {
category: string
description: string
'img-src': string
title: string
}
export type BannerStatus = 'disabled' | 'enabled'
export type RecommendedAppListResponseWritable = {
categories: Array<string>
recommended_apps: Array<RecommendedAppResponseWritable>
}
export type LearnDifyAppListResponseWritable = {
recommended_apps: Array<RecommendedAppResponseWritable>
}
export type RecommendedAppResponseWritable = {
app?: RecommendedAppInfoResponseWritable | null
app_id: string
can_trial: boolean
categories?: Array<string>
copyright?: string | null
custom_disclaimer?: string | null
description?: string | null
is_listed?: boolean | null
position?: number | null
privacy_policy?: string | null
}
export type RecommendedAppInfoResponseWritable = {
icon?: string | null
icon_background?: string | null
icon_type?: string | null
id: string
mode?: string | null
name?: string | null
}
export type GetExploreAppsData = {
body?: never
path?: never
query?: {
language?: string
}
url: '/explore/apps'
}
export type GetExploreAppsErrors = {
default: ErrorResponse
}
export type GetExploreAppsError = GetExploreAppsErrors[keyof GetExploreAppsErrors]
export type GetExploreAppsResponses = {
200: RecommendedAppListResponse
}
export type GetExploreAppsResponse = GetExploreAppsResponses[keyof GetExploreAppsResponses]
export type GetExploreAppsLearnDifyData = {
body?: never
path?: never
query?: {
language?: string
}
url: '/explore/apps/learn-dify'
}
export type GetExploreAppsLearnDifyErrors = {
default: ErrorResponse
}
export type GetExploreAppsLearnDifyError =
GetExploreAppsLearnDifyErrors[keyof GetExploreAppsLearnDifyErrors]
export type GetExploreAppsLearnDifyResponses = {
200: LearnDifyAppListResponse
}
export type GetExploreAppsLearnDifyResponse =
GetExploreAppsLearnDifyResponses[keyof GetExploreAppsLearnDifyResponses]
export type GetExploreAppsByAppIdData = {
body?: never
path: {
app_id: string
}
query?: never
url: '/explore/apps/{app_id}'
}
export type GetExploreAppsByAppIdErrors = {
404: RecommendedAppNotFoundError | ErrorResponse
default: ErrorResponse
}
export type GetExploreAppsByAppIdError =
GetExploreAppsByAppIdErrors[keyof GetExploreAppsByAppIdErrors]
export type GetExploreAppsByAppIdResponses = {
200: RecommendedAppDetailResponse
}
export type GetExploreAppsByAppIdResponse =
GetExploreAppsByAppIdResponses[keyof GetExploreAppsByAppIdResponses]
export type GetExploreBannersData = {
body?: never
path?: never
query?: {
language?: string
}
url: '/explore/banners'
}
export type GetExploreBannersErrors = {
default: ErrorResponse
}
export type GetExploreBannersError = GetExploreBannersErrors[keyof GetExploreBannersErrors]
export type GetExploreBannersResponses = {
200: BannerListResponse
}
export type GetExploreBannersResponse = GetExploreBannersResponses[keyof GetExploreBannersResponses]
@@ -0,0 +1,203 @@
// 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(),
})
/**
* RecommendedAppDetailResponse
*/
export const zRecommendedAppDetailResponse = z.object({
can_trial: z.boolean(),
export_data: z.string(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
id: z.string(),
mode: z.string(),
name: z.string(),
package_url: z.string().nullish(),
version_id: z.string().nullish(),
})
/**
* RecommendedAppNotFoundError
*
* Recommended app not found.
*/
export const zRecommendedAppNotFoundError = zErrorResponse.and(
z.object({
code: z.literal('recommended_app_not_found'),
status: z.literal(404),
}),
)
/**
* RecommendedAppInfoResponse
*/
export const zRecommendedAppInfoResponse = z.object({
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
icon_url: z.string().nullable(),
id: z.string(),
mode: z.string().nullish(),
name: z.string().nullish(),
})
/**
* RecommendedAppResponse
*/
export const zRecommendedAppResponse = z.object({
app: zRecommendedAppInfoResponse.nullish(),
app_id: z.string(),
can_trial: z.boolean(),
categories: z.array(z.string()).optional(),
copyright: z.string().nullish(),
custom_disclaimer: z.string().nullish(),
description: z.string().nullish(),
is_listed: z.boolean().nullish(),
position: z.int().nullish(),
privacy_policy: z.string().nullish(),
})
/**
* RecommendedAppListResponse
*/
export const zRecommendedAppListResponse = z.object({
categories: z.array(z.string()),
recommended_apps: z.array(zRecommendedAppResponse),
})
/**
* LearnDifyAppListResponse
*/
export const zLearnDifyAppListResponse = z.object({
recommended_apps: z.array(zRecommendedAppResponse),
})
/**
* BannerContentResponse
*/
export const zBannerContentResponse = z.object({
category: z.string(),
description: z.string(),
'img-src': z.string().min(1),
title: z.string().min(1),
})
/**
* BannerStatus
*
* ExporleBanner status
*/
export const zBannerStatus = z.enum(['disabled', 'enabled'])
/**
* BannerResponse
*/
export const zBannerResponse = z.object({
content: zBannerContentResponse,
created_at: z.string(),
id: z.string(),
link: z.string(),
sort: z.int(),
status: zBannerStatus,
})
/**
* BannerListResponse
*/
export const zBannerListResponse = z.array(zBannerResponse)
/**
* RecommendedAppInfoResponse
*/
export const zRecommendedAppInfoResponseWritable = z.object({
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
id: z.string(),
mode: z.string().nullish(),
name: z.string().nullish(),
})
/**
* RecommendedAppResponse
*/
export const zRecommendedAppResponseWritable = z.object({
app: zRecommendedAppInfoResponseWritable.nullish(),
app_id: z.string(),
can_trial: z.boolean(),
categories: z.array(z.string()).optional(),
copyright: z.string().nullish(),
custom_disclaimer: z.string().nullish(),
description: z.string().nullish(),
is_listed: z.boolean().nullish(),
position: z.int().nullish(),
privacy_policy: z.string().nullish(),
})
/**
* RecommendedAppListResponse
*/
export const zRecommendedAppListResponseWritable = z.object({
categories: z.array(z.string()),
recommended_apps: z.array(zRecommendedAppResponseWritable),
})
/**
* LearnDifyAppListResponse
*/
export const zLearnDifyAppListResponseWritable = z.object({
recommended_apps: z.array(zRecommendedAppResponseWritable),
})
export const zGetExploreAppsQuery = z.object({
language: z.string().optional().default('en-US'),
})
/**
* Success
*/
export const zGetExploreAppsResponse = zRecommendedAppListResponse
export const zGetExploreAppsLearnDifyQuery = z.object({
language: z.string().optional().default('en-US'),
})
/**
* Success
*/
export const zGetExploreAppsLearnDifyResponse = zLearnDifyAppListResponse
export const zGetExploreAppsByAppIdPath = z.object({
app_id: z.uuid(),
})
/**
* Success
*/
export const zGetExploreAppsByAppIdResponse = zRecommendedAppDetailResponse
export const zGetExploreBannersQuery = z.object({
language: z.string().optional().default('en-US'),
})
/**
* Success
*/
export const zGetExploreBannersResponse = zBannerListResponse