mirror of
https://github.com/langgenius/dify.git
synced 2026-04-30 23:48:04 +08:00
web api for open api v3
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,306 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { oc } from '@orpc/contract'
|
||||
import { zGetConsoleApiPingResponse } from './zod.gen'
|
||||
import { zCheckAppPermissionData, zCheckForgotPasswordTokenData, zCreateChatMessageData, zCreateCompletionMessageData, zCreateMessageFeedbackData, zDeleteConversationData, zDeleteSavedMessageData, zGenerateMoreLikeThisData, zGetAppAccessModeData, zGetConversationListData, zGetMessageListData, zGetRemoteFileInfoData, zGetRemoteFileInfoResponse, zGetSavedMessagesData, zGetSuggestedQuestionsData, zPinConversationData, zRenameConversationData, zResetPasswordData, zRunWorkflowData, zSaveMessageData, zSendEmailCodeLoginData, zSendForgotPasswordEmailData, zStopChatMessageData, zStopCompletionMessageData, zStopWorkflowTaskData, zTextToAudioData, zUnpinConversationData, zUploadFileResponse, zUploadRemoteFileResponse, zVerifyEmailCodeLoginData, zWebAppLoginData } from './zod.gen'
|
||||
|
||||
export const base = oc.$route({ inputStructure: 'detailed' })
|
||||
|
||||
/**
|
||||
* Health check endpoint for connection testing.
|
||||
* Convert audio file to text using speech-to-text service.
|
||||
*/
|
||||
export const getConsoleApiPingContract = base.route({ path: '/console/api/ping', method: 'GET' }).output(zGetConsoleApiPingResponse)
|
||||
export const audioToTextContract = base.route({ path: '/audio-to-text', method: 'POST' })
|
||||
|
||||
export const contracts = { console: { getConsoleApiPingContract } }
|
||||
/**
|
||||
* Create a chat message for conversational applications.
|
||||
*/
|
||||
export const createChatMessageContract = base.route({ path: '/chat-messages', method: 'POST' }).input(zCreateChatMessageData)
|
||||
|
||||
/**
|
||||
* Stop a running chat message task.
|
||||
*/
|
||||
export const stopChatMessageContract = base.route({ path: '/chat-messages/{task_id}/stop', method: 'POST' }).input(zStopChatMessageData)
|
||||
|
||||
/**
|
||||
* Create a completion message for text generation applications.
|
||||
*/
|
||||
export const createCompletionMessageContract = base.route({ path: '/completion-messages', method: 'POST' }).input(zCreateCompletionMessageData)
|
||||
|
||||
/**
|
||||
* Stop a running completion message task.
|
||||
*/
|
||||
export const stopCompletionMessageContract = base.route({ path: '/completion-messages/{task_id}/stop', method: 'POST' }).input(zStopCompletionMessageData)
|
||||
|
||||
/**
|
||||
* Retrieve paginated list of conversations for a chat application.
|
||||
*/
|
||||
export const getConversationListContract = base.route({ path: '/conversations', method: 'GET' }).input(zGetConversationListData)
|
||||
|
||||
/**
|
||||
* Delete a specific conversation.
|
||||
*/
|
||||
export const deleteConversationContract = base.route({ path: '/conversations/{c_id}', method: 'DELETE' }).input(zDeleteConversationData)
|
||||
|
||||
/**
|
||||
* Rename a specific conversation with a custom name or auto-generate one.
|
||||
*/
|
||||
export const renameConversationContract = base.route({ path: '/conversations/{c_id}/name', method: 'POST' }).input(zRenameConversationData)
|
||||
|
||||
/**
|
||||
* Pin a specific conversation to keep it at the top of the list.
|
||||
*/
|
||||
export const pinConversationContract = base.route({ path: '/conversations/{c_id}/pin', method: 'PATCH' }).input(zPinConversationData)
|
||||
|
||||
/**
|
||||
* Unpin a specific conversation to remove it from the top of the list.
|
||||
*/
|
||||
export const unpinConversationContract = base.route({ path: '/conversations/{c_id}/unpin', method: 'PATCH' }).input(zUnpinConversationData)
|
||||
|
||||
/**
|
||||
* Send email verification code for login
|
||||
*/
|
||||
export const sendEmailCodeLoginContract = base.route({ path: '/email-code-login', method: 'POST' }).input(zSendEmailCodeLoginData)
|
||||
|
||||
/**
|
||||
* Verify email code and complete login
|
||||
*/
|
||||
export const verifyEmailCodeLoginContract = base.route({ path: '/email-code-login/validity', method: 'POST' }).input(zVerifyEmailCodeLoginData)
|
||||
|
||||
/**
|
||||
* Upload a file for use in web applications
|
||||
* Accepts file uploads for use within web applications, supporting
|
||||
* multiple file types with automatic validation and storage.
|
||||
*
|
||||
* Args:
|
||||
* app_model: The associated application model
|
||||
* end_user: The end user uploading the file
|
||||
*
|
||||
* Form Parameters:
|
||||
* file: The file to upload (required)
|
||||
* source: Optional source type (datasets or None)
|
||||
*
|
||||
* Returns:
|
||||
* dict: File information including ID, URL, and metadata
|
||||
* int: HTTP status code 201 for success
|
||||
*
|
||||
* Raises:
|
||||
* NoFileUploadedError: No file provided in request
|
||||
* TooManyFilesError: Multiple files provided (only one allowed)
|
||||
* FilenameNotExistsError: File has no filename
|
||||
* FileTooLargeError: File exceeds size limit
|
||||
* UnsupportedFileTypeError: File type not supported
|
||||
*/
|
||||
export const uploadFileContract = base.route({ path: '/files/upload', method: 'POST' }).output(zUploadFileResponse)
|
||||
|
||||
/**
|
||||
* Send password reset email
|
||||
*/
|
||||
export const sendForgotPasswordEmailContract = base.route({ path: '/forgot-password', method: 'POST' }).input(zSendForgotPasswordEmailData)
|
||||
|
||||
/**
|
||||
* Reset user password with verification token
|
||||
*/
|
||||
export const resetPasswordContract = base.route({ path: '/forgot-password/resets', method: 'POST' }).input(zResetPasswordData)
|
||||
|
||||
/**
|
||||
* Verify password reset token validity
|
||||
*/
|
||||
export const checkForgotPasswordTokenContract = base.route({ path: '/forgot-password/validity', method: 'POST' }).input(zCheckForgotPasswordTokenData)
|
||||
|
||||
/**
|
||||
* Authenticate user for web application access
|
||||
*/
|
||||
export const webAppLoginContract = base.route({ path: '/login', method: 'POST' }).input(zWebAppLoginData)
|
||||
|
||||
/**
|
||||
* Check login status
|
||||
*/
|
||||
export const webAppLoginStatusContract = base.route({ path: '/login/status', method: 'GET' })
|
||||
|
||||
/**
|
||||
* Logout user from web application
|
||||
*/
|
||||
export const webAppLogoutContract = base.route({ path: '/logout', method: 'POST' })
|
||||
|
||||
/**
|
||||
* Retrieve paginated list of messages from a conversation in a chat application.
|
||||
*/
|
||||
export const getMessageListContract = base.route({ path: '/messages', method: 'GET' }).input(zGetMessageListData)
|
||||
|
||||
/**
|
||||
* Submit feedback (like/dislike) for a specific message.
|
||||
*/
|
||||
export const createMessageFeedbackContract = base.route({ path: '/messages/{message_id}/feedbacks', method: 'POST' }).input(zCreateMessageFeedbackData)
|
||||
|
||||
/**
|
||||
* Generate a new completion similar to an existing message (completion apps only).
|
||||
*/
|
||||
export const generateMoreLikeThisContract = base.route({ path: '/messages/{message_id}/more-like-this', method: 'GET' }).input(zGenerateMoreLikeThisData)
|
||||
|
||||
/**
|
||||
* Get suggested follow-up questions after a message (chat apps only).
|
||||
*/
|
||||
export const getSuggestedQuestionsContract = base.route({ path: '/messages/{message_id}/suggested-questions', method: 'GET' }).input(zGetSuggestedQuestionsData)
|
||||
|
||||
/**
|
||||
* Retrieve the metadata for a specific app.
|
||||
*/
|
||||
export const getAppMetaContract = base.route({ path: '/meta', method: 'GET' })
|
||||
|
||||
/**
|
||||
* Retrieve the parameters for a specific app.
|
||||
*/
|
||||
export const getAppParametersContract = base.route({ path: '/parameters', method: 'GET' })
|
||||
|
||||
/**
|
||||
* Get authentication passport for web application access
|
||||
*/
|
||||
export const getPassportContract = base.route({ path: '/passport', method: 'GET' })
|
||||
|
||||
/**
|
||||
* Upload a file from a remote URL
|
||||
* Downloads a file from the provided remote URL and uploads it
|
||||
* to the platform storage for use in web applications.
|
||||
*
|
||||
* Args:
|
||||
* app_model: The associated application model
|
||||
* end_user: The end user making the request
|
||||
*
|
||||
* JSON Parameters:
|
||||
* url: The remote URL to download the file from (required)
|
||||
*
|
||||
* Returns:
|
||||
* dict: File information including ID, signed URL, and metadata
|
||||
* int: HTTP status code 201 for success
|
||||
*
|
||||
* Raises:
|
||||
* RemoteFileUploadError: Failed to fetch file from remote URL
|
||||
* FileTooLargeError: File exceeds size limit
|
||||
* UnsupportedFileTypeError: File type not supported
|
||||
*/
|
||||
export const uploadRemoteFileContract = base.route({ path: '/remote-files/upload', method: 'POST' }).output(zUploadRemoteFileResponse)
|
||||
|
||||
/**
|
||||
* Get information about a remote file
|
||||
* Retrieves basic information about a file located at a remote URL,
|
||||
* including content type and content length.
|
||||
*
|
||||
* Args:
|
||||
* app_model: The associated application model
|
||||
* end_user: The end user making the request
|
||||
* url: URL-encoded path to the remote file
|
||||
*
|
||||
* Returns:
|
||||
* dict: Remote file information including type and length
|
||||
*
|
||||
* Raises:
|
||||
* HTTPException: If the remote file cannot be accessed
|
||||
*/
|
||||
export const getRemoteFileInfoContract = base.route({ path: '/remote-files/{url}', method: 'GET' }).input(zGetRemoteFileInfoData).output(zGetRemoteFileInfoResponse)
|
||||
|
||||
/**
|
||||
* Retrieve paginated list of saved messages for a completion application.
|
||||
*/
|
||||
export const getSavedMessagesContract = base.route({ path: '/saved-messages', method: 'GET' }).input(zGetSavedMessagesData)
|
||||
|
||||
/**
|
||||
* Save a specific message for later reference.
|
||||
*/
|
||||
export const saveMessageContract = base.route({ path: '/saved-messages', method: 'POST' }).input(zSaveMessageData)
|
||||
|
||||
/**
|
||||
* Remove a message from saved messages.
|
||||
*/
|
||||
export const deleteSavedMessageContract = base.route({ path: '/saved-messages/{message_id}', method: 'DELETE' }).input(zDeleteSavedMessageData)
|
||||
|
||||
/**
|
||||
* Retrieve app site information and configuration.
|
||||
*/
|
||||
export const getAppSiteInfoContract = base.route({ path: '/site', method: 'GET' })
|
||||
|
||||
/**
|
||||
* Get system feature flags and configuration
|
||||
* Returns the current system feature flags and configuration
|
||||
* that control various functionalities across the platform.
|
||||
*
|
||||
* Returns:
|
||||
* dict: System feature configuration object
|
||||
*
|
||||
* This endpoint is akin to the `SystemFeatureApi` endpoint in api/controllers/console/feature.py,
|
||||
* except it is intended for use by the web app, instead of the console dashboard.
|
||||
*
|
||||
* NOTE: This endpoint is unauthenticated by design, as it provides system features
|
||||
* data required for webapp initialization.
|
||||
*
|
||||
* Authentication would create circular dependency (can't authenticate without webapp loading).
|
||||
*
|
||||
* Only non-sensitive configuration data should be returned by this endpoint.
|
||||
*/
|
||||
export const getSystemFeaturesContract = base.route({ path: '/system-features', method: 'GET' })
|
||||
|
||||
/**
|
||||
* Convert text to audio using text-to-speech service.
|
||||
*/
|
||||
export const textToAudioContract = base.route({ path: '/text-to-audio', method: 'POST' }).input(zTextToAudioData)
|
||||
|
||||
/**
|
||||
* Retrieve the access mode for a web application (public or restricted).
|
||||
*/
|
||||
export const getAppAccessModeContract = base.route({ path: '/webapp/access-mode', method: 'GET' }).input(zGetAppAccessModeData)
|
||||
|
||||
/**
|
||||
* Check if user has permission to access a web application.
|
||||
*/
|
||||
export const checkAppPermissionContract = base.route({ path: '/webapp/permission', method: 'GET' }).input(zCheckAppPermissionData)
|
||||
|
||||
/**
|
||||
* Execute a workflow with provided inputs and files.
|
||||
*/
|
||||
export const runWorkflowContract = base.route({ path: '/workflows/run', method: 'POST' }).input(zRunWorkflowData)
|
||||
|
||||
/**
|
||||
* Stop a running workflow task.
|
||||
*/
|
||||
export const stopWorkflowTaskContract = base.route({ path: '/workflows/tasks/{task_id}/stop', method: 'POST' }).input(zStopWorkflowTaskData)
|
||||
|
||||
export const contracts = { web: {
|
||||
audioToTextContract,
|
||||
createChatMessageContract,
|
||||
stopChatMessageContract,
|
||||
createCompletionMessageContract,
|
||||
stopCompletionMessageContract,
|
||||
getConversationListContract,
|
||||
deleteConversationContract,
|
||||
renameConversationContract,
|
||||
pinConversationContract,
|
||||
unpinConversationContract,
|
||||
sendEmailCodeLoginContract,
|
||||
verifyEmailCodeLoginContract,
|
||||
uploadFileContract,
|
||||
sendForgotPasswordEmailContract,
|
||||
resetPasswordContract,
|
||||
checkForgotPasswordTokenContract,
|
||||
webAppLoginContract,
|
||||
webAppLoginStatusContract,
|
||||
webAppLogoutContract,
|
||||
getMessageListContract,
|
||||
createMessageFeedbackContract,
|
||||
generateMoreLikeThisContract,
|
||||
getSuggestedQuestionsContract,
|
||||
getAppMetaContract,
|
||||
getAppParametersContract,
|
||||
getPassportContract,
|
||||
uploadRemoteFileContract,
|
||||
getRemoteFileInfoContract,
|
||||
getSavedMessagesContract,
|
||||
saveMessageContract,
|
||||
deleteSavedMessageContract,
|
||||
getAppSiteInfoContract,
|
||||
getSystemFeaturesContract,
|
||||
textToAudioContract,
|
||||
getAppAccessModeContract,
|
||||
checkAppPermissionContract,
|
||||
runWorkflowContract,
|
||||
stopWorkflowTaskContract,
|
||||
} }
|
||||
|
||||
export type Contracts = typeof contracts
|
||||
|
||||
1946
web/gen/types.gen.ts
1946
web/gen/types.gen.ts
File diff suppressed because it is too large
Load Diff
@ -2,37 +2,651 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zErrorSchema = z.object({
|
||||
error: z.object({
|
||||
type: z.string(),
|
||||
message: z.string(),
|
||||
status: z.number().int(),
|
||||
details: z.string().optional(),
|
||||
}),
|
||||
/**
|
||||
* TextToAudioPayload
|
||||
*/
|
||||
export const zTextToAudioPayload = z.object({
|
||||
message_id: z.record(z.unknown()).optional(),
|
||||
voice: z.record(z.unknown()).optional(),
|
||||
text: z.record(z.unknown()).optional(),
|
||||
streaming: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export type ErrorSchemaZodType = z.infer<typeof zErrorSchema>
|
||||
export type TextToAudioPayloadZodType = z.infer<typeof zTextToAudioPayload>
|
||||
|
||||
/**
|
||||
* PingResponse
|
||||
* CompletionMessagePayload
|
||||
*/
|
||||
export const zPingResponse = z.object({
|
||||
result: z.string().describe('Health check result'),
|
||||
export const zCompletionMessagePayload = z.object({
|
||||
inputs: z.record(z.unknown()).describe('Input variables for the completion'),
|
||||
query: z.string().describe('Query text for completion').optional().default(''),
|
||||
files: z.record(z.unknown()).describe('Files to be processed').optional(),
|
||||
response_mode: z.record(z.unknown()).describe('Response mode: blocking or streaming').optional(),
|
||||
retriever_from: z.string().describe('Source of retriever').optional().default('web_app'),
|
||||
})
|
||||
|
||||
export type PingResponseZodType = z.infer<typeof zPingResponse>
|
||||
export type CompletionMessagePayloadZodType = z.infer<typeof zCompletionMessagePayload>
|
||||
|
||||
export const zGetConsoleApiPingData = z.object({
|
||||
/**
|
||||
* ChatMessagePayload
|
||||
*/
|
||||
export const zChatMessagePayload = z.object({
|
||||
inputs: z.record(z.unknown()).describe('Input variables for the chat'),
|
||||
query: z.string().describe('User query/message'),
|
||||
files: z.record(z.unknown()).describe('Files to be processed').optional(),
|
||||
response_mode: z.record(z.unknown()).describe('Response mode: blocking or streaming').optional(),
|
||||
conversation_id: z.record(z.unknown()).describe('Conversation ID').optional(),
|
||||
parent_message_id: z.record(z.unknown()).describe('Parent message ID').optional(),
|
||||
retriever_from: z.string().describe('Source of retriever').optional().default('web_app'),
|
||||
})
|
||||
|
||||
export type ChatMessagePayloadZodType = z.infer<typeof zChatMessagePayload>
|
||||
|
||||
/**
|
||||
* FileResponse
|
||||
*/
|
||||
export const zFileResponse = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
size: z.number().int(),
|
||||
extension: z.record(z.unknown()).optional(),
|
||||
mime_type: z.record(z.unknown()).optional(),
|
||||
created_by: z.record(z.unknown()).optional(),
|
||||
created_at: z.record(z.unknown()).optional(),
|
||||
preview_url: z.record(z.unknown()).optional(),
|
||||
source_url: z.record(z.unknown()).optional(),
|
||||
original_url: z.record(z.unknown()).optional(),
|
||||
user_id: z.record(z.unknown()).optional(),
|
||||
tenant_id: z.record(z.unknown()).optional(),
|
||||
conversation_id: z.record(z.unknown()).optional(),
|
||||
file_key: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export type FileResponseZodType = z.infer<typeof zFileResponse>
|
||||
|
||||
/**
|
||||
* ForgotPasswordSendPayload
|
||||
*/
|
||||
export const zForgotPasswordSendPayload = z.object({
|
||||
email: z.string(),
|
||||
language: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export type ForgotPasswordSendPayloadZodType = z.infer<typeof zForgotPasswordSendPayload>
|
||||
|
||||
/**
|
||||
* ForgotPasswordCheckPayload
|
||||
*/
|
||||
export const zForgotPasswordCheckPayload = z.object({
|
||||
email: z.string(),
|
||||
code: z.string(),
|
||||
token: z.string().min(1),
|
||||
})
|
||||
|
||||
export type ForgotPasswordCheckPayloadZodType = z.infer<typeof zForgotPasswordCheckPayload>
|
||||
|
||||
/**
|
||||
* ForgotPasswordResetPayload
|
||||
*/
|
||||
export const zForgotPasswordResetPayload = z.object({
|
||||
token: z.string().min(1),
|
||||
new_password: z.string(),
|
||||
password_confirm: z.string(),
|
||||
})
|
||||
|
||||
export type ForgotPasswordResetPayloadZodType = z.infer<typeof zForgotPasswordResetPayload>
|
||||
|
||||
/**
|
||||
* LoginPayload
|
||||
*/
|
||||
export const zLoginPayload = z.object({
|
||||
email: z.string(),
|
||||
password: z.string(),
|
||||
})
|
||||
|
||||
export type LoginPayloadZodType = z.infer<typeof zLoginPayload>
|
||||
|
||||
/**
|
||||
* EmailCodeLoginSendPayload
|
||||
*/
|
||||
export const zEmailCodeLoginSendPayload = z.object({
|
||||
email: z.string(),
|
||||
language: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export type EmailCodeLoginSendPayloadZodType = z.infer<typeof zEmailCodeLoginSendPayload>
|
||||
|
||||
/**
|
||||
* EmailCodeLoginVerifyPayload
|
||||
*/
|
||||
export const zEmailCodeLoginVerifyPayload = z.object({
|
||||
email: z.string(),
|
||||
code: z.string(),
|
||||
token: z.string().min(1),
|
||||
})
|
||||
|
||||
export type EmailCodeLoginVerifyPayloadZodType = z.infer<typeof zEmailCodeLoginVerifyPayload>
|
||||
|
||||
/**
|
||||
* MessageMoreLikeThisQuery
|
||||
*/
|
||||
export const zMessageMoreLikeThisQuery = z.object({
|
||||
response_mode: z.enum(['blocking', 'streaming']).describe('Response mode'),
|
||||
})
|
||||
|
||||
export type MessageMoreLikeThisQueryZodType = z.infer<typeof zMessageMoreLikeThisQuery>
|
||||
|
||||
/**
|
||||
* RemoteFileInfo
|
||||
*/
|
||||
export const zRemoteFileInfo = z.object({
|
||||
file_type: z.string(),
|
||||
file_length: z.number().int(),
|
||||
})
|
||||
|
||||
export type RemoteFileInfoZodType = z.infer<typeof zRemoteFileInfo>
|
||||
|
||||
/**
|
||||
* FileWithSignedUrl
|
||||
*/
|
||||
export const zFileWithSignedUrl = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
size: z.number().int(),
|
||||
extension: z.record(z.unknown()).optional(),
|
||||
url: z.record(z.unknown()).optional(),
|
||||
mime_type: z.record(z.unknown()).optional(),
|
||||
created_by: z.record(z.unknown()).optional(),
|
||||
created_at: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export type FileWithSignedUrlZodType = z.infer<typeof zFileWithSignedUrl>
|
||||
|
||||
/**
|
||||
* WorkflowRunPayload
|
||||
*/
|
||||
export const zWorkflowRunPayload = z.object({
|
||||
inputs: z.record(z.unknown()).describe('Input variables for the workflow'),
|
||||
files: z.record(z.unknown()).describe('Files to be processed by the workflow').optional(),
|
||||
})
|
||||
|
||||
export type WorkflowRunPayloadZodType = z.infer<typeof zWorkflowRunPayload>
|
||||
|
||||
/**
|
||||
* AppAccessModeQuery
|
||||
*/
|
||||
export const zAppAccessModeQuery = z.object({
|
||||
appId: z.record(z.unknown()).describe('Application ID').optional(),
|
||||
appCode: z.record(z.unknown()).describe('Application code').optional(),
|
||||
})
|
||||
|
||||
export type AppAccessModeQueryZodType = z.infer<typeof zAppAccessModeQuery>
|
||||
|
||||
/**
|
||||
* ConversationListQuery
|
||||
*/
|
||||
export const zConversationListQuery = z.object({
|
||||
last_id: z.record(z.unknown()).optional(),
|
||||
limit: z.number().int().gte(1).lte(100).optional(),
|
||||
pinned: z.record(z.unknown()).optional(),
|
||||
sort_by: z.enum([
|
||||
'created_at',
|
||||
'-created_at',
|
||||
'updated_at',
|
||||
'-updated_at',
|
||||
]).optional(),
|
||||
})
|
||||
|
||||
export type ConversationListQueryZodType = z.infer<typeof zConversationListQuery>
|
||||
|
||||
/**
|
||||
* ConversationRenamePayload
|
||||
*/
|
||||
export const zConversationRenamePayload = z.object({
|
||||
name: z.record(z.unknown()).optional(),
|
||||
auto_generate: z.boolean().optional().default(false),
|
||||
})
|
||||
|
||||
export type ConversationRenamePayloadZodType = z.infer<typeof zConversationRenamePayload>
|
||||
|
||||
/**
|
||||
* MessageListQuery
|
||||
*/
|
||||
export const zMessageListQuery = z.object({
|
||||
conversation_id: z.string().describe('Conversation UUID'),
|
||||
first_id: z.record(z.unknown()).describe('First message ID for pagination').optional(),
|
||||
limit: z.number().int().gte(1).lte(100).describe('Number of messages to return (1-100)').optional(),
|
||||
})
|
||||
|
||||
export type MessageListQueryZodType = z.infer<typeof zMessageListQuery>
|
||||
|
||||
/**
|
||||
* MessageFeedbackPayload
|
||||
*/
|
||||
export const zMessageFeedbackPayload = z.object({
|
||||
rating: z.record(z.unknown()).describe('Feedback rating').optional(),
|
||||
content: z.record(z.unknown()).describe('Feedback content').optional(),
|
||||
})
|
||||
|
||||
export type MessageFeedbackPayloadZodType = z.infer<typeof zMessageFeedbackPayload>
|
||||
|
||||
/**
|
||||
* RemoteFileUploadPayload
|
||||
*/
|
||||
export const zRemoteFileUploadPayload = z.object({
|
||||
url: z.string().url().min(1).max(2083).describe('Remote file URL'),
|
||||
})
|
||||
|
||||
export type RemoteFileUploadPayloadZodType = z.infer<typeof zRemoteFileUploadPayload>
|
||||
|
||||
/**
|
||||
* SavedMessageListQuery
|
||||
*/
|
||||
export const zSavedMessageListQuery = z.object({
|
||||
last_id: z.record(z.unknown()).optional(),
|
||||
limit: z.number().int().gte(1).lte(100).optional(),
|
||||
})
|
||||
|
||||
export type SavedMessageListQueryZodType = z.infer<typeof zSavedMessageListQuery>
|
||||
|
||||
/**
|
||||
* SavedMessageCreatePayload
|
||||
*/
|
||||
export const zSavedMessageCreatePayload = z.object({
|
||||
message_id: z.string(),
|
||||
})
|
||||
|
||||
export type SavedMessageCreatePayloadZodType = z.infer<typeof zSavedMessageCreatePayload>
|
||||
|
||||
export const zAudioToTextData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetConsoleApiPingDataZodType = z.infer<typeof zGetConsoleApiPingData>
|
||||
export type AudioToTextDataZodType = z.infer<typeof zAudioToTextData>
|
||||
|
||||
export const zCreateChatMessageData = z.object({
|
||||
body: zChatMessagePayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type CreateChatMessageDataZodType = z.infer<typeof zCreateChatMessageData>
|
||||
|
||||
export const zStopChatMessageData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
task_id: z.string().describe('Task ID to stop'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type StopChatMessageDataZodType = z.infer<typeof zStopChatMessageData>
|
||||
|
||||
export const zCreateCompletionMessageData = z.object({
|
||||
body: zCompletionMessagePayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type CreateCompletionMessageDataZodType = z.infer<typeof zCreateCompletionMessageData>
|
||||
|
||||
export const zStopCompletionMessageData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
task_id: z.string().describe('Task ID to stop'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type StopCompletionMessageDataZodType = z.infer<typeof zStopCompletionMessageData>
|
||||
|
||||
export const zGetConversationListData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.object({
|
||||
last_id: z.string().describe('Last conversation ID for pagination').optional(),
|
||||
limit: z.number().int().describe('Number of conversations to return (1-100)').optional().default(20),
|
||||
pinned: z.enum(['true', 'false']).describe('Filter by pinned status').optional(),
|
||||
sort_by: z.enum([
|
||||
'created_at',
|
||||
'-created_at',
|
||||
'updated_at',
|
||||
'-updated_at',
|
||||
]).describe('Sort order').optional(),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type GetConversationListDataZodType = z.infer<typeof zGetConversationListData>
|
||||
|
||||
export const zDeleteConversationData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
c_id: z.string().describe('Conversation UUID'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type DeleteConversationDataZodType = z.infer<typeof zDeleteConversationData>
|
||||
|
||||
/**
|
||||
* OK
|
||||
* Conversation deleted successfully
|
||||
*/
|
||||
export const zGetConsoleApiPingResponse = zPingResponse
|
||||
export const zDeleteConversationResponse = z.void().describe('Conversation deleted successfully')
|
||||
|
||||
export type GetConsoleApiPingResponseZodType = z.infer<typeof zGetConsoleApiPingResponse>
|
||||
export type DeleteConversationResponseZodType = z.infer<typeof zDeleteConversationResponse>
|
||||
|
||||
export const zRenameConversationData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
c_id: z.string().describe('Conversation UUID'),
|
||||
}),
|
||||
query: z.object({
|
||||
name: z.string().describe('New conversation name').optional(),
|
||||
auto_generate: z.boolean().describe('Auto-generate conversation name').optional().default(false),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type RenameConversationDataZodType = z.infer<typeof zRenameConversationData>
|
||||
|
||||
export const zPinConversationData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
c_id: z.string().describe('Conversation UUID'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type PinConversationDataZodType = z.infer<typeof zPinConversationData>
|
||||
|
||||
export const zUnpinConversationData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
c_id: z.string().describe('Conversation UUID'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type UnpinConversationDataZodType = z.infer<typeof zUnpinConversationData>
|
||||
|
||||
export const zSendEmailCodeLoginData = z.object({
|
||||
body: zEmailCodeLoginSendPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type SendEmailCodeLoginDataZodType = z.infer<typeof zSendEmailCodeLoginData>
|
||||
|
||||
export const zVerifyEmailCodeLoginData = z.object({
|
||||
body: zEmailCodeLoginVerifyPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type VerifyEmailCodeLoginDataZodType = z.infer<typeof zVerifyEmailCodeLoginData>
|
||||
|
||||
export const zUploadFileData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type UploadFileDataZodType = z.infer<typeof zUploadFileData>
|
||||
|
||||
/**
|
||||
* File uploaded successfully
|
||||
*/
|
||||
export const zUploadFileResponse = zFileResponse
|
||||
|
||||
export type UploadFileResponseZodType = z.infer<typeof zUploadFileResponse>
|
||||
|
||||
export const zSendForgotPasswordEmailData = z.object({
|
||||
body: zForgotPasswordSendPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type SendForgotPasswordEmailDataZodType = z.infer<typeof zSendForgotPasswordEmailData>
|
||||
|
||||
export const zResetPasswordData = z.object({
|
||||
body: zForgotPasswordResetPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type ResetPasswordDataZodType = z.infer<typeof zResetPasswordData>
|
||||
|
||||
export const zCheckForgotPasswordTokenData = z.object({
|
||||
body: zForgotPasswordCheckPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type CheckForgotPasswordTokenDataZodType = z.infer<typeof zCheckForgotPasswordTokenData>
|
||||
|
||||
export const zWebAppLoginData = z.object({
|
||||
body: zLoginPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type WebAppLoginDataZodType = z.infer<typeof zWebAppLoginData>
|
||||
|
||||
export const zWebAppLoginStatusData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type WebAppLoginStatusDataZodType = z.infer<typeof zWebAppLoginStatusData>
|
||||
|
||||
export const zWebAppLogoutData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type WebAppLogoutDataZodType = z.infer<typeof zWebAppLogoutData>
|
||||
|
||||
export const zGetMessageListData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.object({
|
||||
conversation_id: z.string().describe('Conversation UUID'),
|
||||
first_id: z.string().describe('First message ID for pagination').optional(),
|
||||
limit: z.number().int().describe('Number of messages to return (1-100)').optional().default(20),
|
||||
}),
|
||||
})
|
||||
|
||||
export type GetMessageListDataZodType = z.infer<typeof zGetMessageListData>
|
||||
|
||||
export const zCreateMessageFeedbackData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
message_id: z.string().describe('Message UUID'),
|
||||
}),
|
||||
query: z.object({
|
||||
rating: z.enum(['like', 'dislike']).describe('Feedback rating').optional(),
|
||||
content: z.string().describe('Feedback content').optional(),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type CreateMessageFeedbackDataZodType = z.infer<typeof zCreateMessageFeedbackData>
|
||||
|
||||
export const zGenerateMoreLikeThisData = z.object({
|
||||
body: zMessageMoreLikeThisQuery,
|
||||
path: z.object({
|
||||
message_id: z.string(),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GenerateMoreLikeThisDataZodType = z.infer<typeof zGenerateMoreLikeThisData>
|
||||
|
||||
export const zGetSuggestedQuestionsData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
message_id: z.string().describe('Message UUID'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetSuggestedQuestionsDataZodType = z.infer<typeof zGetSuggestedQuestionsData>
|
||||
|
||||
export const zGetAppMetaData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetAppMetaDataZodType = z.infer<typeof zGetAppMetaData>
|
||||
|
||||
export const zGetAppParametersData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetAppParametersDataZodType = z.infer<typeof zGetAppParametersData>
|
||||
|
||||
export const zGetPassportData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetPassportDataZodType = z.infer<typeof zGetPassportData>
|
||||
|
||||
export const zUploadRemoteFileData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type UploadRemoteFileDataZodType = z.infer<typeof zUploadRemoteFileData>
|
||||
|
||||
/**
|
||||
* Remote file uploaded successfully
|
||||
*/
|
||||
export const zUploadRemoteFileResponse = zFileWithSignedUrl
|
||||
|
||||
export type UploadRemoteFileResponseZodType = z.infer<typeof zUploadRemoteFileResponse>
|
||||
|
||||
export const zGetRemoteFileInfoData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetRemoteFileInfoDataZodType = z.infer<typeof zGetRemoteFileInfoData>
|
||||
|
||||
/**
|
||||
* Remote file information retrieved successfully
|
||||
*/
|
||||
export const zGetRemoteFileInfoResponse = zRemoteFileInfo
|
||||
|
||||
export type GetRemoteFileInfoResponseZodType = z.infer<typeof zGetRemoteFileInfoResponse>
|
||||
|
||||
export const zGetSavedMessagesData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.object({
|
||||
last_id: z.string().describe('Last message ID for pagination').optional(),
|
||||
limit: z.number().int().describe('Number of messages to return (1-100)').optional().default(20),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type GetSavedMessagesDataZodType = z.infer<typeof zGetSavedMessagesData>
|
||||
|
||||
export const zSaveMessageData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.object({
|
||||
message_id: z.string().describe('Message UUID to save'),
|
||||
}),
|
||||
})
|
||||
|
||||
export type SaveMessageDataZodType = z.infer<typeof zSaveMessageData>
|
||||
|
||||
export const zDeleteSavedMessageData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
message_id: z.string().describe('Message UUID to delete'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type DeleteSavedMessageDataZodType = z.infer<typeof zDeleteSavedMessageData>
|
||||
|
||||
/**
|
||||
* Message removed successfully
|
||||
*/
|
||||
export const zDeleteSavedMessageResponse = z.void().describe('Message removed successfully')
|
||||
|
||||
export type DeleteSavedMessageResponseZodType = z.infer<typeof zDeleteSavedMessageResponse>
|
||||
|
||||
export const zGetAppSiteInfoData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetAppSiteInfoDataZodType = z.infer<typeof zGetAppSiteInfoData>
|
||||
|
||||
export const zGetSystemFeaturesData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type GetSystemFeaturesDataZodType = z.infer<typeof zGetSystemFeaturesData>
|
||||
|
||||
export const zTextToAudioData = z.object({
|
||||
body: zTextToAudioPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type TextToAudioDataZodType = z.infer<typeof zTextToAudioData>
|
||||
|
||||
export const zGetAppAccessModeData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.object({
|
||||
appId: z.string().describe('Application ID').optional(),
|
||||
appCode: z.string().describe('Application code').optional(),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type GetAppAccessModeDataZodType = z.infer<typeof zGetAppAccessModeData>
|
||||
|
||||
export const zCheckAppPermissionData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.never().optional(),
|
||||
query: z.object({
|
||||
appId: z.string().describe('Application ID'),
|
||||
}),
|
||||
})
|
||||
|
||||
export type CheckAppPermissionDataZodType = z.infer<typeof zCheckAppPermissionData>
|
||||
|
||||
export const zRunWorkflowData = z.object({
|
||||
body: zWorkflowRunPayload,
|
||||
path: z.never().optional(),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type RunWorkflowDataZodType = z.infer<typeof zRunWorkflowData>
|
||||
|
||||
export const zStopWorkflowTaskData = z.object({
|
||||
body: z.never().optional(),
|
||||
path: z.object({
|
||||
task_id: z.string().describe('Task ID to stop'),
|
||||
}),
|
||||
query: z.never().optional(),
|
||||
})
|
||||
|
||||
export type StopWorkflowTaskDataZodType = z.infer<typeof zStopWorkflowTaskData>
|
||||
|
||||
@ -3,7 +3,7 @@ import { defineConfig } from '@hey-api/openapi-ts'
|
||||
import { defineConfig as defineOrpcConfig } from './plugins/hey-api-orpc/config'
|
||||
|
||||
export default defineConfig({
|
||||
input: '../open-api/fastopenapi.json',
|
||||
input: '../open-api/web-api.json',
|
||||
output: {
|
||||
indexFile: false,
|
||||
path: './gen',
|
||||
|
||||
Reference in New Issue
Block a user