Merge branch 'main' into feat/dify_agent

This commit is contained in:
zyssyz123
2026-05-18 12:07:49 +08:00
committed by GitHub
9 changed files with 379 additions and 229 deletions

View File

@ -120,7 +120,11 @@ jobs:
if: github.event_name != 'merge_group' && steps.api-changes.outputs.any_changed == 'true'
run: |
cd api
uv run dev/generate_swagger_markdown_docs.py --swagger-dir openapi --markdown-dir openapi/markdown
uv run dev/generate_swagger_markdown_docs.py --swagger-dir ../packages/contracts/openapi --markdown-dir openapi/markdown --keep-swagger-json
- name: Generate frontend contracts
if: github.event_name != 'merge_group' && steps.api-changes.outputs.any_changed == 'true'
run: pnpm --dir packages/contracts gen-api-contract-from-openapi
- name: ESLint autofix
if: github.event_name != 'merge_group' && steps.web-changes.outputs.any_changed == 'true'

View File

@ -556,28 +556,8 @@ export type WorkflowRunNodeExecutionListResponse = {
data: Array<WorkflowRunNodeExecutionResponse>
}
export type WorkflowCommentBasic = {
content?: string
created_at?: {
[key: string]: unknown
}
created_by?: string
created_by_account?: AnonymousInlineModel6Fec07Cd0D85
id?: string
mention_count?: number
participants?: Array<AnonymousInlineModel6Fec07Cd0D85>
position_x?: number
position_y?: number
reply_count?: number
resolved?: boolean
resolved_at?: {
[key: string]: unknown
}
resolved_by?: string
resolved_by_account?: AnonymousInlineModel6Fec07Cd0D85
updated_at?: {
[key: string]: unknown
}
export type WorkflowCommentBasicList = {
data: Array<WorkflowCommentBasic>
}
export type WorkflowCommentCreatePayload = {
@ -588,10 +568,8 @@ export type WorkflowCommentCreatePayload = {
}
export type WorkflowCommentCreate = {
created_at?: {
[key: string]: unknown
}
id?: string
created_at?: number | null
id: string
}
export type WorkflowCommentMentionUsersPayload = {
@ -599,26 +577,20 @@ export type WorkflowCommentMentionUsersPayload = {
}
export type WorkflowCommentDetail = {
content?: string
created_at?: {
[key: string]: unknown
}
created_by?: string
created_by_account?: AnonymousInlineModel6Fec07Cd0D85
id?: string
mentions?: Array<AnonymousInlineModelF7Ff64Cce858>
position_x?: number
position_y?: number
replies?: Array<AnonymousInlineModel55C39C6A4B9e>
resolved?: boolean
resolved_at?: {
[key: string]: unknown
}
resolved_by?: string
resolved_by_account?: AnonymousInlineModel6Fec07Cd0D85
updated_at?: {
[key: string]: unknown
}
content: string
created_at?: number | null
created_by: string
created_by_account?: WorkflowCommentAccount
id: string
mentions: Array<WorkflowCommentMention>
position_x: number
position_y: number
replies: Array<WorkflowCommentReply>
resolved: boolean
resolved_at?: number | null
resolved_by?: string | null
resolved_by_account?: WorkflowCommentAccount
updated_at?: number | null
}
export type WorkflowCommentUpdatePayload = {
@ -629,10 +601,8 @@ export type WorkflowCommentUpdatePayload = {
}
export type WorkflowCommentUpdate = {
id?: string
updated_at?: {
[key: string]: unknown
}
id: string
updated_at?: number | null
}
export type WorkflowCommentReplyPayload = {
@ -641,26 +611,20 @@ export type WorkflowCommentReplyPayload = {
}
export type WorkflowCommentReplyCreate = {
created_at?: {
[key: string]: unknown
}
id?: string
created_at?: number | null
id: string
}
export type WorkflowCommentReplyUpdate = {
id?: string
updated_at?: {
[key: string]: unknown
}
id: string
updated_at?: number | null
}
export type WorkflowCommentResolve = {
id?: string
resolved?: boolean
resolved_at?: {
[key: string]: unknown
}
resolved_by?: string
id: string
resolved: boolean
resolved_at?: number | null
resolved_by?: string | null
}
export type WorkflowPagination = {
@ -1167,13 +1131,22 @@ export type SimpleEndUser = {
type: string
}
export type AnonymousInlineModel6Fec07Cd0D85 = {
avatar_url?: {
[key: string]: unknown
}
email?: string
id?: string
name?: string
export type WorkflowCommentBasic = {
content: string
created_at?: number | null
created_by: string
created_by_account?: WorkflowCommentAccount
id: string
mention_count: number
participants: Array<WorkflowCommentAccount>
position_x: number
position_y: number
reply_count: number
resolved: boolean
resolved_at?: number | null
resolved_by?: string | null
resolved_by_account?: WorkflowCommentAccount
updated_at?: number | null
}
export type AccountWithRole = {
@ -1188,20 +1161,25 @@ export type AccountWithRole = {
status: string
}
export type AnonymousInlineModelF7Ff64Cce858 = {
mentioned_user_account?: AnonymousInlineModel6Fec07Cd0D85
mentioned_user_id?: string
reply_id?: string
export type WorkflowCommentAccount = {
readonly avatar_url: string | null
email: string
id: string
name: string
}
export type AnonymousInlineModel55C39C6A4B9e = {
content?: string
created_at?: {
[key: string]: unknown
}
created_by?: string
created_by_account?: AnonymousInlineModel6Fec07Cd0D85
id?: string
export type WorkflowCommentMention = {
mentioned_user_account?: WorkflowCommentAccount
mentioned_user_id: string
reply_id?: string | null
}
export type WorkflowCommentReply = {
content: string
created_at?: number | null
created_by: string
created_by_account?: WorkflowCommentAccount
id: string
}
export type ConversationVariable = {
@ -1349,11 +1327,7 @@ export type UserActionConfig = {
title: string
}
export type FormInputConfig
= | ParagraphInputConfig
| SelectInputConfig
| FileInputConfig
| FileListInputConfig
export type FormInputConfig = unknown
export type ButtonStyle = 'accent' | 'default' | 'ghost' | 'primary'
@ -1404,6 +1378,65 @@ export type FileTransferMethod = 'datasource_file' | 'local_file' | 'remote_url'
export type ValueSourceType = 'constant' | 'variable'
export type WorkflowCommentBasicListWritable = {
data: Array<WorkflowCommentBasicWritable>
}
export type WorkflowCommentDetailWritable = {
content: string
created_at?: number | null
created_by: string
created_by_account?: WorkflowCommentAccountWritable
id: string
mentions: Array<WorkflowCommentMentionWritable>
position_x: number
position_y: number
replies: Array<WorkflowCommentReplyWritable>
resolved: boolean
resolved_at?: number | null
resolved_by?: string | null
resolved_by_account?: WorkflowCommentAccountWritable
updated_at?: number | null
}
export type WorkflowCommentBasicWritable = {
content: string
created_at?: number | null
created_by: string
created_by_account?: WorkflowCommentAccountWritable
id: string
mention_count: number
participants: Array<WorkflowCommentAccountWritable>
position_x: number
position_y: number
reply_count: number
resolved: boolean
resolved_at?: number | null
resolved_by?: string | null
resolved_by_account?: WorkflowCommentAccountWritable
updated_at?: number | null
}
export type WorkflowCommentAccountWritable = {
email: string
id: string
name: string
}
export type WorkflowCommentMentionWritable = {
mentioned_user_account?: WorkflowCommentAccountWritable
mentioned_user_id: string
reply_id?: string | null
}
export type WorkflowCommentReplyWritable = {
content: string
created_at?: number | null
created_by: string
created_by_account?: WorkflowCommentAccountWritable
id: string
}
export type GetAppsData = {
body?: never
path?: never
@ -3562,7 +3595,7 @@ export type GetAppsByAppIdWorkflowCommentsData = {
}
export type GetAppsByAppIdWorkflowCommentsResponses = {
200: WorkflowCommentBasic
200: WorkflowCommentBasicList
}
export type GetAppsByAppIdWorkflowCommentsResponse

View File

@ -373,9 +373,12 @@ export const zWorkflowCommentCreatePayload = z.object({
position_y: z.number(),
})
/**
* WorkflowCommentCreate
*/
export const zWorkflowCommentCreate = z.object({
created_at: z.record(z.string(), z.unknown()).optional(),
id: z.string().optional(),
created_at: z.int().nullish(),
id: z.string(),
})
/**
@ -388,9 +391,12 @@ export const zWorkflowCommentUpdatePayload = z.object({
position_y: z.number().nullish(),
})
/**
* WorkflowCommentUpdate
*/
export const zWorkflowCommentUpdate = z.object({
id: z.string().optional(),
updated_at: z.record(z.string(), z.unknown()).optional(),
id: z.string(),
updated_at: z.int().nullish(),
})
/**
@ -401,21 +407,30 @@ export const zWorkflowCommentReplyPayload = z.object({
mentioned_user_ids: z.array(z.string()).optional(),
})
/**
* WorkflowCommentReplyCreate
*/
export const zWorkflowCommentReplyCreate = z.object({
created_at: z.record(z.string(), z.unknown()).optional(),
id: z.string().optional(),
created_at: z.int().nullish(),
id: z.string(),
})
/**
* WorkflowCommentReplyUpdate
*/
export const zWorkflowCommentReplyUpdate = z.object({
id: z.string().optional(),
updated_at: z.record(z.string(), z.unknown()).optional(),
id: z.string(),
updated_at: z.int().nullish(),
})
/**
* WorkflowCommentResolve
*/
export const zWorkflowCommentResolve = z.object({
id: z.string().optional(),
resolved: z.boolean().optional(),
resolved_at: z.record(z.string(), z.unknown()).optional(),
resolved_by: z.string().optional(),
id: z.string(),
resolved: z.boolean(),
resolved_at: z.int().nullish(),
resolved_by: z.string().nullish(),
})
/**
@ -993,31 +1008,6 @@ export const zWorkflowRunNodeExecutionListResponse = z.object({
data: z.array(zWorkflowRunNodeExecutionResponse),
})
export const zAnonymousInlineModel6Fec07Cd0D85 = z.object({
avatar_url: z.record(z.string(), z.unknown()).optional(),
email: z.string().optional(),
id: z.string().optional(),
name: z.string().optional(),
})
export const zWorkflowCommentBasic = z.object({
content: z.string().optional(),
created_at: z.record(z.string(), z.unknown()).optional(),
created_by: z.string().optional(),
created_by_account: zAnonymousInlineModel6Fec07Cd0D85.optional(),
id: z.string().optional(),
mention_count: z.int().optional(),
participants: z.array(zAnonymousInlineModel6Fec07Cd0D85).optional(),
position_x: z.number().optional(),
position_y: z.number().optional(),
reply_count: z.int().optional(),
resolved: z.boolean().optional(),
resolved_at: z.record(z.string(), z.unknown()).optional(),
resolved_by: z.string().optional(),
resolved_by_account: zAnonymousInlineModel6Fec07Cd0D85.optional(),
updated_at: z.record(z.string(), z.unknown()).optional(),
})
/**
* AccountWithRole
*/
@ -1040,35 +1030,82 @@ export const zWorkflowCommentMentionUsersPayload = z.object({
users: z.array(zAccountWithRole),
})
export const zAnonymousInlineModelF7Ff64Cce858 = z.object({
mentioned_user_account: zAnonymousInlineModel6Fec07Cd0D85.optional(),
mentioned_user_id: z.string().optional(),
reply_id: z.string().optional(),
/**
* WorkflowCommentAccount
*/
export const zWorkflowCommentAccount = z.object({
avatar_url: z.string().readonly().nullable(),
email: z.string(),
id: z.string(),
name: z.string(),
})
export const zAnonymousInlineModel55C39C6A4B9e = z.object({
content: z.string().optional(),
created_at: z.record(z.string(), z.unknown()).optional(),
created_by: z.string().optional(),
created_by_account: zAnonymousInlineModel6Fec07Cd0D85.optional(),
id: z.string().optional(),
/**
* WorkflowCommentBasic
*/
export const zWorkflowCommentBasic = z.object({
content: z.string(),
created_at: z.int().nullish(),
created_by: z.string(),
created_by_account: zWorkflowCommentAccount.optional(),
id: z.string(),
mention_count: z.int(),
participants: z.array(zWorkflowCommentAccount),
position_x: z.number(),
position_y: z.number(),
reply_count: z.int(),
resolved: z.boolean(),
resolved_at: z.int().nullish(),
resolved_by: z.string().nullish(),
resolved_by_account: zWorkflowCommentAccount.optional(),
updated_at: z.int().nullish(),
})
/**
* WorkflowCommentBasicList
*/
export const zWorkflowCommentBasicList = z.object({
data: z.array(zWorkflowCommentBasic),
})
/**
* WorkflowCommentMention
*/
export const zWorkflowCommentMention = z.object({
mentioned_user_account: zWorkflowCommentAccount.optional(),
mentioned_user_id: z.string(),
reply_id: z.string().nullish(),
})
/**
* WorkflowCommentReply
*/
export const zWorkflowCommentReply = z.object({
content: z.string(),
created_at: z.int().nullish(),
created_by: z.string(),
created_by_account: zWorkflowCommentAccount.optional(),
id: z.string(),
})
/**
* WorkflowCommentDetail
*/
export const zWorkflowCommentDetail = z.object({
content: z.string().optional(),
created_at: z.record(z.string(), z.unknown()).optional(),
created_by: z.string().optional(),
created_by_account: zAnonymousInlineModel6Fec07Cd0D85.optional(),
id: z.string().optional(),
mentions: z.array(zAnonymousInlineModelF7Ff64Cce858).optional(),
position_x: z.number().optional(),
position_y: z.number().optional(),
replies: z.array(zAnonymousInlineModel55C39C6A4B9e).optional(),
resolved: z.boolean().optional(),
resolved_at: z.record(z.string(), z.unknown()).optional(),
resolved_by: z.string().optional(),
resolved_by_account: zAnonymousInlineModel6Fec07Cd0D85.optional(),
updated_at: z.record(z.string(), z.unknown()).optional(),
content: z.string(),
created_at: z.int().nullish(),
created_by: z.string(),
created_by_account: zWorkflowCommentAccount.optional(),
id: z.string(),
mentions: z.array(zWorkflowCommentMention),
position_x: z.number(),
position_y: z.number(),
replies: z.array(zWorkflowCommentReply),
resolved: z.boolean(),
resolved_at: z.int().nullish(),
resolved_by: z.string().nullish(),
resolved_by_account: zWorkflowCommentAccount.optional(),
updated_at: z.int().nullish(),
})
export const zConversationVariable = z.object({
@ -1524,6 +1561,8 @@ export const zWorkflowArchivedLogPaginationResponse = z.object({
total: z.int(),
})
export const zFormInputConfig = z.unknown()
/**
* ButtonStyle
*
@ -1542,6 +1581,72 @@ export const zUserActionConfig = z.object({
title: z.string().max(100),
})
/**
* HumanInputFormDefinition
*/
export const zHumanInputFormDefinition = z.object({
actions: z.array(zUserActionConfig).optional(),
display_in_ui: z.boolean().optional().default(false),
expiration_time: z.int(),
form_content: z.string(),
form_id: z.string(),
form_token: z.string().nullish(),
inputs: z.array(zFormInputConfig).optional(),
node_id: z.string(),
node_title: z.string(),
resolved_default_values: z.record(z.string(), z.unknown()).optional(),
})
/**
* HumanInputContent
*/
export const zHumanInputContent = z.object({
form_definition: zHumanInputFormDefinition.optional(),
form_submission_data: zHumanInputFormSubmissionData.optional(),
submitted: z.boolean(),
type: zExecutionContentType.optional(),
workflow_run_id: z.string(),
})
/**
* MessageDetailResponse
*/
export const zMessageDetailResponse = z.object({
agent_thoughts: z.array(zAgentThought).optional(),
annotation: zConversationAnnotation.optional(),
annotation_hit_history: zConversationAnnotationHitHistory.optional(),
answer_tokens: z.int().nullish(),
conversation_id: z.string(),
created_at: z.int().nullish(),
error: z.string().nullish(),
extra_contents: z.array(zHumanInputContent).optional(),
feedbacks: z.array(zFeedback).optional(),
from_account_id: z.string().nullish(),
from_end_user_id: z.string().nullish(),
from_source: z.string(),
id: z.string(),
inputs: z.record(z.string(), zJsonValue),
message: zJsonValue.optional(),
message_files: z.array(zMessageFile).optional(),
message_metadata_dict: zJsonValue.optional(),
message_tokens: z.int().nullish(),
parent_message_id: z.string().nullish(),
provider_response_latency: z.number().nullish(),
query: z.string(),
re_sign_file_url_answer: z.string(),
status: z.string(),
workflow_run_id: z.string().nullish(),
})
/**
* MessageInfiniteScrollPaginationResponse
*/
export const zMessageInfiniteScrollPaginationResponse = z.object({
data: z.array(zMessageDetailResponse),
has_more: z.boolean(),
limit: z.int(),
})
/**
* FileType
*/
@ -1628,77 +1733,81 @@ export const zSelectInputConfig = z.object({
type: z.string().optional().default('select'),
})
export const zFormInputConfig = z.union([
zParagraphInputConfig,
zSelectInputConfig,
zFileInputConfig,
zFileListInputConfig,
])
/**
* HumanInputFormDefinition
* WorkflowCommentAccount
*/
export const zHumanInputFormDefinition = z.object({
actions: z.array(zUserActionConfig).optional(),
display_in_ui: z.boolean().optional().default(false),
expiration_time: z.int(),
form_content: z.string(),
form_id: z.string(),
form_token: z.string().nullish(),
inputs: z.array(zFormInputConfig).optional(),
node_id: z.string(),
node_title: z.string(),
resolved_default_values: z.record(z.string(), z.unknown()).optional(),
})
/**
* HumanInputContent
*/
export const zHumanInputContent = z.object({
form_definition: zHumanInputFormDefinition.optional(),
form_submission_data: zHumanInputFormSubmissionData.optional(),
submitted: z.boolean(),
type: zExecutionContentType.optional(),
workflow_run_id: z.string(),
})
/**
* MessageDetailResponse
*/
export const zMessageDetailResponse = z.object({
agent_thoughts: z.array(zAgentThought).optional(),
annotation: zConversationAnnotation.optional(),
annotation_hit_history: zConversationAnnotationHitHistory.optional(),
answer_tokens: z.int().nullish(),
conversation_id: z.string(),
created_at: z.int().nullish(),
error: z.string().nullish(),
extra_contents: z.array(zHumanInputContent).optional(),
feedbacks: z.array(zFeedback).optional(),
from_account_id: z.string().nullish(),
from_end_user_id: z.string().nullish(),
from_source: z.string(),
export const zWorkflowCommentAccountWritable = z.object({
email: z.string(),
id: z.string(),
inputs: z.record(z.string(), zJsonValue),
message: zJsonValue.optional(),
message_files: z.array(zMessageFile).optional(),
message_metadata_dict: zJsonValue.optional(),
message_tokens: z.int().nullish(),
parent_message_id: z.string().nullish(),
provider_response_latency: z.number().nullish(),
query: z.string(),
re_sign_file_url_answer: z.string(),
status: z.string(),
workflow_run_id: z.string().nullish(),
name: z.string(),
})
/**
* MessageInfiniteScrollPaginationResponse
* WorkflowCommentBasic
*/
export const zMessageInfiniteScrollPaginationResponse = z.object({
data: z.array(zMessageDetailResponse),
has_more: z.boolean(),
limit: z.int(),
export const zWorkflowCommentBasicWritable = z.object({
content: z.string(),
created_at: z.int().nullish(),
created_by: z.string(),
created_by_account: zWorkflowCommentAccountWritable.optional(),
id: z.string(),
mention_count: z.int(),
participants: z.array(zWorkflowCommentAccountWritable),
position_x: z.number(),
position_y: z.number(),
reply_count: z.int(),
resolved: z.boolean(),
resolved_at: z.int().nullish(),
resolved_by: z.string().nullish(),
resolved_by_account: zWorkflowCommentAccountWritable.optional(),
updated_at: z.int().nullish(),
})
/**
* WorkflowCommentBasicList
*/
export const zWorkflowCommentBasicListWritable = z.object({
data: z.array(zWorkflowCommentBasicWritable),
})
/**
* WorkflowCommentMention
*/
export const zWorkflowCommentMentionWritable = z.object({
mentioned_user_account: zWorkflowCommentAccountWritable.optional(),
mentioned_user_id: z.string(),
reply_id: z.string().nullish(),
})
/**
* WorkflowCommentReply
*/
export const zWorkflowCommentReplyWritable = z.object({
content: z.string(),
created_at: z.int().nullish(),
created_by: z.string(),
created_by_account: zWorkflowCommentAccountWritable.optional(),
id: z.string(),
})
/**
* WorkflowCommentDetail
*/
export const zWorkflowCommentDetailWritable = z.object({
content: z.string(),
created_at: z.int().nullish(),
created_by: z.string(),
created_by_account: zWorkflowCommentAccountWritable.optional(),
id: z.string(),
mentions: z.array(zWorkflowCommentMentionWritable),
position_x: z.number(),
position_y: z.number(),
replies: z.array(zWorkflowCommentReplyWritable),
resolved: z.boolean(),
resolved_at: z.int().nullish(),
resolved_by: z.string().nullish(),
resolved_by_account: zWorkflowCommentAccountWritable.optional(),
updated_at: z.int().nullish(),
})
export const zGetAppsQuery = z.object({
@ -2793,7 +2902,7 @@ export const zGetAppsByAppIdWorkflowCommentsPath = z.object({
/**
* Comments retrieved successfully
*/
export const zGetAppsByAppIdWorkflowCommentsResponse = zWorkflowCommentBasic
export const zGetAppsByAppIdWorkflowCommentsResponse = zWorkflowCommentBasicList
export const zPostAppsByAppIdWorkflowCommentsBody = zWorkflowCommentCreatePayload

View File

@ -13,6 +13,7 @@ export type EmailCodeLoginPayload = {
code: string
email: string
language?: string | null
timezone?: string | null
token: string
}

View File

@ -17,6 +17,7 @@ export const zEmailCodeLoginPayload = z.object({
code: z.string(),
email: z.string(),
language: z.string().nullish(),
timezone: z.string().nullish(),
token: z.string(),
})

View File

@ -16,6 +16,10 @@ export type TagBasePayload = {
type: TagType
}
export type TagUpdateRequestPayload = {
name: string
}
export type TagType = 'app' | 'knowledge'
export type GetTagsData = {
@ -67,7 +71,7 @@ export type DeleteTagsByTagIdResponses = {
export type DeleteTagsByTagIdResponse = DeleteTagsByTagIdResponses[keyof DeleteTagsByTagIdResponses]
export type PatchTagsByTagIdData = {
body: TagBasePayload
body: TagUpdateRequestPayload
path: {
tag_id: string
}

View File

@ -12,6 +12,13 @@ export const zTagResponse = z.object({
type: z.string().nullish(),
})
/**
* TagUpdateRequestPayload
*/
export const zTagUpdateRequestPayload = z.object({
name: z.string().min(1).max(50),
})
/**
* TagType
*
@ -53,7 +60,7 @@ export const zDeleteTagsByTagIdPath = z.object({
*/
export const zDeleteTagsByTagIdResponse = z.record(z.string(), z.unknown())
export const zPatchTagsByTagIdBody = zTagBasePayload
export const zPatchTagsByTagIdBody = zTagUpdateRequestPayload
export const zPatchTagsByTagIdPath = z.object({
tag_id: z.string(),

View File

@ -563,16 +563,6 @@ const createApiConfig = (job: ApiJob): UserConfig => ({
suffix: '.gen',
},
path: job.outputPath,
postProcess: [
{
args: ['fmt', '{{path}}'],
command: 'vp',
},
{
args: ['--fix', '{{path}}/*.ts'],
command: 'eslint',
},
],
},
plugins: [
{

View File

@ -14,7 +14,8 @@
}
},
"scripts": {
"gen-api-contract": "pnpm gen-api-openapi && node -e \"fs.rmSync('generated/api', { recursive: true, force: true })\" && openapi-ts -f openapi-ts.api.config.ts",
"gen-api-contract": "pnpm gen-api-openapi && pnpm gen-api-contract-from-openapi",
"gen-api-contract-from-openapi": "node -e \"fs.rmSync('generated/api', { recursive: true, force: true })\" && openapi-ts -f openapi-ts.api.config.ts && vp fmt generated/api && eslint --fix generated/api",
"gen-api-openapi": "uv run --project ../../api ../../api/dev/generate_swagger_specs.py --output-dir openapi",
"gen-enterprise-contract": "openapi-ts -f openapi-ts.enterprise.config.ts",
"type-check": "tsgo"