mirror of
https://github.com/langgenius/dify.git
synced 2026-04-30 23:48:04 +08:00
generate with a better input
This commit is contained in:
@ -1,306 +1,160 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { oc } from '@orpc/contract'
|
||||
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'
|
||||
import { zAudioToTextData, zAudioToTextResponse, zCreateAnnotationData, zCreateAnnotationResponse, zDeleteAnnotationData, zDeleteConversationData, zGetAnnotationListData, zGetAnnotationListResponse, zGetChatAppFeedbacksData, zGetChatAppFeedbacksResponse, zGetChatAppInfoResponse, zGetChatAppMetaResponse, zGetChatAppParametersData, zGetChatAppParametersResponse, zGetChatWebAppSettingsResponse, zGetConversationHistoryData, zGetConversationHistoryResponse, zGetConversationsListData, zGetConversationsListResponse, zGetConversationVariablesData, zGetConversationVariablesResponse, zGetInitialAnnotationReplySettingsStatusData, zGetInitialAnnotationReplySettingsStatusResponse, zGetSuggestedQuestionsData, zGetSuggestedQuestionsResponse, zInitialAnnotationReplySettingsData, zInitialAnnotationReplySettingsResponse, zPostChatMessageFeedbackData, zPostChatMessageFeedbackResponse, zPreviewChatFileData, zPreviewChatFileResponse, zRenameConversationData, zRenameConversationResponse, zSendChatMessageData, zSendChatMessageResponse, zStopChatMessageGenerationData, zStopChatMessageGenerationResponse, zTextToAudioChatData, zTextToAudioChatResponse, zUpdateAnnotationData, zUpdateAnnotationResponse, zUploadChatFileData, zUploadChatFileResponse } from './zod.gen'
|
||||
|
||||
export const base = oc.$route({ inputStructure: 'detailed' })
|
||||
|
||||
/**
|
||||
* Convert audio file to text using speech-to-text service.
|
||||
* Send a request to the chat application.
|
||||
*/
|
||||
export const audioToTextContract = base.route({ path: '/audio-to-text', method: 'POST' })
|
||||
export const sendChatMessageContract = base.route({ path: '/chat-messages', method: 'POST' }).input(zSendChatMessageData).output(zSendChatMessageResponse)
|
||||
|
||||
/**
|
||||
* Create a chat message for conversational applications.
|
||||
* Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text. Supports png, jpg, jpeg, webp, gif formats. Uploaded files are for use by the current end-user only.
|
||||
*/
|
||||
export const createChatMessageContract = base.route({ path: '/chat-messages', method: 'POST' }).input(zCreateChatMessageData)
|
||||
export const uploadChatFileContract = base.route({ path: '/files/upload', method: 'POST' }).input(zUploadChatFileData).output(zUploadChatFileResponse)
|
||||
|
||||
/**
|
||||
* Stop a running chat message task.
|
||||
* Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. Files can only be accessed if they belong to messages within the requesting application.
|
||||
*/
|
||||
export const stopChatMessageContract = base.route({ path: '/chat-messages/{task_id}/stop', method: 'POST' }).input(zStopChatMessageData)
|
||||
export const previewChatFileContract = base.route({ path: '/files/{file_id}/preview', method: 'GET' }).input(zPreviewChatFileData).output(zPreviewChatFileResponse)
|
||||
|
||||
/**
|
||||
* Create a completion message for text generation applications.
|
||||
* Stops a chat message generation task. Only supported in streaming mode.
|
||||
*/
|
||||
export const createCompletionMessageContract = base.route({ path: '/completion-messages', method: 'POST' }).input(zCreateCompletionMessageData)
|
||||
export const stopChatMessageGenerationContract = base.route({ path: '/chat-messages/{task_id}/stop', method: 'POST' }).input(zStopChatMessageGenerationData).output(zStopChatMessageGenerationResponse)
|
||||
|
||||
/**
|
||||
* Stop a running completion message task.
|
||||
* End-users can provide feedback messages, facilitating application developers to optimize expected outputs.
|
||||
*/
|
||||
export const stopCompletionMessageContract = base.route({ path: '/completion-messages/{task_id}/stop', method: 'POST' }).input(zStopCompletionMessageData)
|
||||
export const postChatMessageFeedbackContract = base.route({ path: '/messages/{message_id}/feedbacks', method: 'POST' }).input(zPostChatMessageFeedbackData).output(zPostChatMessageFeedbackResponse)
|
||||
|
||||
/**
|
||||
* Retrieve paginated list of conversations for a chat application.
|
||||
* Get application's feedbacks.
|
||||
*/
|
||||
export const getConversationListContract = base.route({ path: '/conversations', method: 'GET' }).input(zGetConversationListData)
|
||||
export const getChatAppFeedbacksContract = base.route({ path: '/app/feedbacks', method: 'GET' }).input(zGetChatAppFeedbacksData).output(zGetChatAppFeedbacksResponse)
|
||||
|
||||
/**
|
||||
* Delete a specific conversation.
|
||||
* Get next questions suggestions for the current message.
|
||||
*/
|
||||
export const deleteConversationContract = base.route({ path: '/conversations/{c_id}', method: 'DELETE' }).input(zDeleteConversationData)
|
||||
export const getSuggestedQuestionsContract = base.route({ path: '/messages/{message_id}/suggested', method: 'GET' }).input(zGetSuggestedQuestionsData).output(zGetSuggestedQuestionsResponse)
|
||||
|
||||
/**
|
||||
* Rename a specific conversation with a custom name or auto-generate one.
|
||||
* Returns historical chat records in a scrolling load format, with the first page returning the latest `{limit}` messages, i.e., in reverse order.
|
||||
*/
|
||||
export const renameConversationContract = base.route({ path: '/conversations/{c_id}/name', method: 'POST' }).input(zRenameConversationData)
|
||||
export const getConversationHistoryContract = base.route({ path: '/messages', method: 'GET' }).input(zGetConversationHistoryData).output(zGetConversationHistoryResponse)
|
||||
|
||||
/**
|
||||
* Pin a specific conversation to keep it at the top of the list.
|
||||
* Retrieve the conversation list for the current user, defaulting to the most recent 20 entries.
|
||||
*/
|
||||
export const pinConversationContract = base.route({ path: '/conversations/{c_id}/pin', method: 'PATCH' }).input(zPinConversationData)
|
||||
export const getConversationsListContract = base.route({ path: '/conversations', method: 'GET' }).input(zGetConversationsListData).output(zGetConversationsListResponse)
|
||||
|
||||
/**
|
||||
* Unpin a specific conversation to remove it from the top of the list.
|
||||
* Delete a conversation.
|
||||
*/
|
||||
export const unpinConversationContract = base.route({ path: '/conversations/{c_id}/unpin', method: 'PATCH' }).input(zUnpinConversationData)
|
||||
export const deleteConversationContract = base.route({ path: '/conversations/{conversation_id}', method: 'DELETE' }).input(zDeleteConversationData)
|
||||
|
||||
/**
|
||||
* Send email verification code for login
|
||||
* Rename the session. The session name is used for display on clients that support multiple sessions.
|
||||
*/
|
||||
export const sendEmailCodeLoginContract = base.route({ path: '/email-code-login', method: 'POST' }).input(zSendEmailCodeLoginData)
|
||||
export const renameConversationContract = base.route({ path: '/conversations/{conversation_id}/name', method: 'POST' }).input(zRenameConversationData).output(zRenameConversationResponse)
|
||||
|
||||
/**
|
||||
* Verify email code and complete login
|
||||
* Retrieve variables from a specific conversation.
|
||||
*/
|
||||
export const verifyEmailCodeLoginContract = base.route({ path: '/email-code-login/validity', method: 'POST' }).input(zVerifyEmailCodeLoginData)
|
||||
export const getConversationVariablesContract = base.route({ path: '/conversations/{conversation_id}/variables', method: 'GET' }).input(zGetConversationVariablesData).output(zGetConversationVariablesResponse)
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB.
|
||||
*/
|
||||
export const uploadFileContract = base.route({ path: '/files/upload', method: 'POST' }).output(zUploadFileResponse)
|
||||
export const audioToTextContract = base.route({ path: '/audio-to-text', method: 'POST' }).input(zAudioToTextData).output(zAudioToTextResponse)
|
||||
|
||||
/**
|
||||
* Send password reset email
|
||||
* Convert text to speech.
|
||||
*/
|
||||
export const sendForgotPasswordEmailContract = base.route({ path: '/forgot-password', method: 'POST' }).input(zSendForgotPasswordEmailData)
|
||||
export const textToAudioChatContract = base.route({ path: '/text-to-audio', method: 'POST' }).input(zTextToAudioChatData).output(zTextToAudioChatResponse)
|
||||
|
||||
/**
|
||||
* Reset user password with verification token
|
||||
* Used to get basic information about this application.
|
||||
*/
|
||||
export const resetPasswordContract = base.route({ path: '/forgot-password/resets', method: 'POST' }).input(zResetPasswordData)
|
||||
export const getChatAppInfoContract = base.route({ path: '/info', method: 'GET' }).output(zGetChatAppInfoResponse)
|
||||
|
||||
/**
|
||||
* Verify password reset token validity
|
||||
* Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
|
||||
*/
|
||||
export const checkForgotPasswordTokenContract = base.route({ path: '/forgot-password/validity', method: 'POST' }).input(zCheckForgotPasswordTokenData)
|
||||
export const getChatAppParametersContract = base.route({ path: '/parameters', method: 'GET' }).input(zGetChatAppParametersData).output(zGetChatAppParametersResponse)
|
||||
|
||||
/**
|
||||
* Authenticate user for web application access
|
||||
* Used to get icons of tools in this application.
|
||||
*/
|
||||
export const webAppLoginContract = base.route({ path: '/login', method: 'POST' }).input(zWebAppLoginData)
|
||||
export const getChatAppMetaContract = base.route({ path: '/meta', method: 'GET' }).output(zGetChatAppMetaResponse)
|
||||
|
||||
/**
|
||||
* Check login status
|
||||
* Used to get the WebApp settings of the application.
|
||||
*/
|
||||
export const webAppLoginStatusContract = base.route({ path: '/login/status', method: 'GET' })
|
||||
export const getChatWebAppSettingsContract = base.route({ path: '/site', method: 'GET' }).output(zGetChatWebAppSettingsResponse)
|
||||
|
||||
/**
|
||||
* Logout user from web application
|
||||
* Retrieves a list of annotations for the application.
|
||||
*/
|
||||
export const webAppLogoutContract = base.route({ path: '/logout', method: 'POST' })
|
||||
export const getAnnotationListContract = base.route({ path: '/apps/annotations', method: 'GET' }).input(zGetAnnotationListData).output(zGetAnnotationListResponse)
|
||||
|
||||
/**
|
||||
* Retrieve paginated list of messages from a conversation in a chat application.
|
||||
* Creates a new annotation.
|
||||
*/
|
||||
export const getMessageListContract = base.route({ path: '/messages', method: 'GET' }).input(zGetMessageListData)
|
||||
export const createAnnotationContract = base.route({ path: '/apps/annotations', method: 'POST' }).input(zCreateAnnotationData).output(zCreateAnnotationResponse)
|
||||
|
||||
/**
|
||||
* Submit feedback (like/dislike) for a specific message.
|
||||
* Deletes an annotation.
|
||||
*/
|
||||
export const createMessageFeedbackContract = base.route({ path: '/messages/{message_id}/feedbacks', method: 'POST' }).input(zCreateMessageFeedbackData)
|
||||
export const deleteAnnotationContract = base.route({ path: '/apps/annotations/{annotation_id}', method: 'DELETE' }).input(zDeleteAnnotationData)
|
||||
|
||||
/**
|
||||
* Generate a new completion similar to an existing message (completion apps only).
|
||||
* Updates an existing annotation.
|
||||
*/
|
||||
export const generateMoreLikeThisContract = base.route({ path: '/messages/{message_id}/more-like-this', method: 'GET' }).input(zGenerateMoreLikeThisData)
|
||||
export const updateAnnotationContract = base.route({ path: '/apps/annotations/{annotation_id}', method: 'PUT' }).input(zUpdateAnnotationData).output(zUpdateAnnotationResponse)
|
||||
|
||||
/**
|
||||
* Get suggested follow-up questions after a message (chat apps only).
|
||||
* Enable or disable annotation reply settings and configure embedding models. This interface is executed asynchronously.
|
||||
*/
|
||||
export const getSuggestedQuestionsContract = base.route({ path: '/messages/{message_id}/suggested-questions', method: 'GET' }).input(zGetSuggestedQuestionsData)
|
||||
export const initialAnnotationReplySettingsContract = base.route({ path: '/apps/annotation-reply/{action}', method: 'POST' }).input(zInitialAnnotationReplySettingsData).output(zInitialAnnotationReplySettingsResponse)
|
||||
|
||||
/**
|
||||
* Retrieve the metadata for a specific app.
|
||||
* Queries the status of an asynchronously executed annotation reply settings task.
|
||||
*/
|
||||
export const getAppMetaContract = base.route({ path: '/meta', method: 'GET' })
|
||||
export const getInitialAnnotationReplySettingsStatusContract = base.route({ path: '/apps/annotation-reply/{action}/status/{job_id}', method: 'GET' }).input(zGetInitialAnnotationReplySettingsStatusData).output(zGetInitialAnnotationReplySettingsStatusResponse)
|
||||
|
||||
/**
|
||||
* 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 const contracts = {
|
||||
chat: {
|
||||
sendChatMessageContract,
|
||||
stopChatMessageGenerationContract,
|
||||
getSuggestedQuestionsContract,
|
||||
},
|
||||
files: { uploadChatFileContract, previewChatFileContract },
|
||||
feedback: { postChatMessageFeedbackContract, getChatAppFeedbacksContract },
|
||||
conversations: {
|
||||
getConversationHistoryContract,
|
||||
getConversationsListContract,
|
||||
deleteConversationContract,
|
||||
renameConversationContract,
|
||||
getConversationVariablesContract,
|
||||
},
|
||||
tTS: { audioToTextContract, textToAudioChatContract },
|
||||
application: {
|
||||
getChatAppInfoContract,
|
||||
getChatAppParametersContract,
|
||||
getChatAppMetaContract,
|
||||
getChatWebAppSettingsContract,
|
||||
},
|
||||
annotations: {
|
||||
getAnnotationListContract,
|
||||
createAnnotationContract,
|
||||
deleteAnnotationContract,
|
||||
updateAnnotationContract,
|
||||
initialAnnotationReplySettingsContract,
|
||||
getInitialAnnotationReplySettingsStatusContract,
|
||||
},
|
||||
}
|
||||
|
||||
export type Contracts = typeof contracts
|
||||
|
||||
2745
web/gen/types.gen.ts
2745
web/gen/types.gen.ts
File diff suppressed because it is too large
Load Diff
1277
web/gen/zod.gen.ts
1277
web/gen/zod.gen.ts
File diff suppressed because it is too large
Load Diff
@ -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/web-api.json',
|
||||
input: './openapi_chat.json',
|
||||
output: {
|
||||
indexFile: false,
|
||||
path: './gen',
|
||||
|
||||
1935
web/openapi_chat.json
Normal file
1935
web/openapi_chat.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user