diff --git a/web/gen/orpc.gen.ts b/web/gen/orpc.gen.ts index 9a94671183..44ab51addd 100644 --- a/web/gen/orpc.gen.ts +++ b/web/gen/orpc.gen.ts @@ -1,378 +1,42 @@ // This file is auto-generated by @hey-api/openapi-ts import { oc } from '@orpc/contract' -import { z } from 'zod' -import { zAudioToTextData, zAudioToTextResponse2, zCreateAnnotationData, zCreateAnnotationResponse, zDeleteAnnotationData, zDeleteConversationData, zGetAnnotationListData, zGetAnnotationListResponse, zGetChatAppFeedbacksData, zGetChatAppFeedbacksResponse, zGetChatAppInfoResponse, zGetChatAppMetaResponse, zGetChatAppParametersData, zGetChatAppParametersResponse, zGetChatWebAppSettingsResponse, zGetConversationHistoryData, zGetConversationHistoryResponse, zGetConversationsListData, zGetConversationsListResponse, zGetConversationVariablesData, zGetConversationVariablesResponse, zGetInitialAnnotationReplySettingsStatusData, zGetInitialAnnotationReplySettingsStatusResponse, zGetSuggestedQuestionsData, zGetSuggestedQuestionsResponse, zInitialAnnotationReplySettingsData, zInitialAnnotationReplySettingsResponse2, zPostChatMessageFeedbackData, zPostChatMessageFeedbackResponse, zPreviewChatFileData, zPreviewChatFileResponse, zRenameConversationData, zRenameConversationResponse, zSendChatMessageData, zSendChatMessageResponse, zStopChatMessageGenerationData, zStopChatMessageGenerationResponse, zTextToAudioChatData, zTextToAudioChatResponse, zUpdateAnnotationData, zUpdateAnnotationResponse, zUploadChatFileData, zUploadChatFileResponse } from './zod.gen' +import { createAnnotationContract, deleteAnnotationContract, getAnnotationListContract, getInitialAnnotationReplySettingsStatusContract, initialAnnotationReplySettingsContract, updateAnnotationContract } from './orpc/annotations.gen' +import { getChatAppInfoContract, getChatAppMetaContract, getChatAppParametersContract, getChatWebAppSettingsContract } from './orpc/application.gen' +import { getSuggestedQuestionsContract, sendChatMessageContract, stopChatMessageGenerationContract } from './orpc/chat.gen' +import { deleteConversationContract, getConversationHistoryContract, getConversationsListContract, getConversationVariablesContract, renameConversationContract } from './orpc/conversations.gen' +import { getChatAppFeedbacksContract, postChatMessageFeedbackContract } from './orpc/feedback.gen' +import { previewChatFileContract, uploadChatFileContract } from './orpc/files.gen' +import { audioToTextContract, textToAudioChatContract } from './orpc/tts.gen' export const base = oc.$route({ inputStructure: 'detailed', outputStructure: 'detailed' }) -/** - * Send Chat Message - * - * Send a request to the chat application. - */ -export const sendChatMessageContract = base.route({ - path: '/chat-messages', - method: 'POST', - operationId: 'sendChatMessage', - summary: 'Send Chat Message', - description: 'Send a request to the chat application.', - tags: ['Chat'], -}).input(zSendChatMessageData).output(z.object({ body: zSendChatMessageResponse, status: z.literal(200) })) - -/** - * File Upload - * - * 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 uploadChatFileContract = base.route({ - path: '/files/upload', - method: 'POST', - operationId: 'uploadChatFile', - summary: 'File Upload', - description: '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.', - tags: ['Files'], -}).input(zUploadChatFileData).output(z.object({ body: zUploadChatFileResponse, status: z.literal(200) })) - -/** - * File Preview - * - * 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 previewChatFileContract = base.route({ - path: '/files/{file_id}/preview', - method: 'GET', - operationId: 'previewChatFile', - summary: 'File Preview', - description: '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.', - tags: ['Files'], -}).input(zPreviewChatFileData).output(z.object({ body: zPreviewChatFileResponse, status: z.literal(200) })) - -/** - * Stop Chat Message Generation - * - * Stops a chat message generation task. Only supported in streaming mode. - */ -export const stopChatMessageGenerationContract = base.route({ - path: '/chat-messages/{task_id}/stop', - method: 'POST', - operationId: 'stopChatMessageGeneration', - summary: 'Stop Chat Message Generation', - description: 'Stops a chat message generation task. Only supported in streaming mode.', - tags: ['Chat'], -}).input(zStopChatMessageGenerationData).output(z.object({ body: zStopChatMessageGenerationResponse, status: z.literal(200) })) - -/** - * Message Feedback - * - * End-users can provide feedback messages, facilitating application developers to optimize expected outputs. - */ -export const postChatMessageFeedbackContract = base.route({ - path: '/messages/{message_id}/feedbacks', - method: 'POST', - operationId: 'postChatMessageFeedback', - summary: 'Message Feedback', - description: 'End-users can provide feedback messages, facilitating application developers to optimize expected outputs.', - tags: ['Feedback'], -}).input(zPostChatMessageFeedbackData).output(z.object({ body: zPostChatMessageFeedbackResponse, status: z.literal(200) })) - -/** - * Get feedbacks of application - * - * Get application's feedbacks. - */ -export const getChatAppFeedbacksContract = base.route({ - path: '/app/feedbacks', - method: 'GET', - operationId: 'getChatAppFeedbacks', - summary: 'Get feedbacks of application', - description: 'Get application\'s feedbacks.', - tags: ['Feedback'], -}).input(zGetChatAppFeedbacksData).output(z.object({ body: zGetChatAppFeedbacksResponse, status: z.literal(200) })) - -/** - * Next Suggested Questions - * - * Get next questions suggestions for the current message. - */ -export const getSuggestedQuestionsContract = base.route({ - path: '/messages/{message_id}/suggested', - method: 'GET', - operationId: 'getSuggestedQuestions', - summary: 'Next Suggested Questions', - description: 'Get next questions suggestions for the current message.', - tags: ['Chat'], -}).input(zGetSuggestedQuestionsData).output(z.object({ body: zGetSuggestedQuestionsResponse, status: z.literal(200) })) - -/** - * Get Conversation History Messages - * - * 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 getConversationHistoryContract = base.route({ - path: '/messages', - method: 'GET', - operationId: 'getConversationHistory', - summary: 'Get Conversation History Messages', - description: 'Returns historical chat records in a scrolling load format, with the first page returning the latest `{limit}` messages, i.e., in reverse order.', - tags: ['Conversations'], -}).input(zGetConversationHistoryData).output(z.object({ body: zGetConversationHistoryResponse, status: z.literal(200) })) - -/** - * Get Conversations - * - * Retrieve the conversation list for the current user, defaulting to the most recent 20 entries. - */ -export const getConversationsListContract = base.route({ - path: '/conversations', - method: 'GET', - operationId: 'getConversationsList', - summary: 'Get Conversations', - description: 'Retrieve the conversation list for the current user, defaulting to the most recent 20 entries.', - tags: ['Conversations'], -}).input(zGetConversationsListData).output(z.object({ body: zGetConversationsListResponse, status: z.literal(200) })) - -/** - * Delete Conversation - * - * Delete a conversation. - */ -export const deleteConversationContract = base.route({ - path: '/conversations/{conversation_id}', - method: 'DELETE', - operationId: 'deleteConversation', - summary: 'Delete Conversation', - description: 'Delete a conversation.', - tags: ['Conversations'], -}).input(zDeleteConversationData) - -/** - * Conversation Rename - * - * Rename the session. The session name is used for display on clients that support multiple sessions. - */ -export const renameConversationContract = base.route({ - path: '/conversations/{conversation_id}/name', - method: 'POST', - operationId: 'renameConversation', - summary: 'Conversation Rename', - description: 'Rename the session. The session name is used for display on clients that support multiple sessions.', - tags: ['Conversations'], -}).input(zRenameConversationData).output(z.object({ body: zRenameConversationResponse, status: z.literal(200) })) - -/** - * Get Conversation Variables - * - * Retrieve variables from a specific conversation. - */ -export const getConversationVariablesContract = base.route({ - path: '/conversations/{conversation_id}/variables', - method: 'GET', - operationId: 'getConversationVariables', - summary: 'Get Conversation Variables', - description: 'Retrieve variables from a specific conversation.', - tags: ['Conversations'], -}).input(zGetConversationVariablesData).output(z.object({ body: zGetConversationVariablesResponse, status: z.literal(200) })) - -/** - * Speech to Text - * - * Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB. - */ -export const audioToTextContract = base.route({ - path: '/audio-to-text', - method: 'POST', - operationId: 'audioToText', - summary: 'Speech to Text', - description: 'Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB.', - tags: ['TTS'], -}).input(zAudioToTextData).output(z.object({ body: zAudioToTextResponse2, status: z.literal(200) })) - -/** - * Text to Audio - * - * Convert text to speech. - */ -export const textToAudioChatContract = base.route({ - path: '/text-to-audio', - method: 'POST', - operationId: 'textToAudioChat', - summary: 'Text to Audio', - description: 'Convert text to speech.', - tags: ['TTS'], -}).input(zTextToAudioChatData).output(z.object({ body: zTextToAudioChatResponse, status: z.literal(200) })) - -/** - * Get Application Basic Information - * - * Used to get basic information about this application. - */ -export const getChatAppInfoContract = base.route({ - path: '/info', - method: 'GET', - operationId: 'getChatAppInfo', - summary: 'Get Application Basic Information', - description: 'Used to get basic information about this application.', - tags: ['Application'], -}).output(z.object({ body: zGetChatAppInfoResponse, status: z.literal(200) })) - -/** - * Get Application Parameters Information - * - * Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values. - */ -export const getChatAppParametersContract = base.route({ - path: '/parameters', - method: 'GET', - operationId: 'getChatAppParameters', - summary: 'Get Application Parameters Information', - description: 'Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.', - tags: ['Application'], -}).input(zGetChatAppParametersData).output(z.object({ body: zGetChatAppParametersResponse, status: z.literal(200) })) - -/** - * Get Application Meta Information - * - * Used to get icons of tools in this application. - */ -export const getChatAppMetaContract = base.route({ - path: '/meta', - method: 'GET', - operationId: 'getChatAppMeta', - summary: 'Get Application Meta Information', - description: 'Used to get icons of tools in this application.', - tags: ['Application'], -}).output(z.object({ body: zGetChatAppMetaResponse, status: z.literal(200) })) - -/** - * Get Application WebApp Settings - * - * Used to get the WebApp settings of the application. - */ -export const getChatWebAppSettingsContract = base.route({ - path: '/site', - method: 'GET', - operationId: 'getChatWebAppSettings', - summary: 'Get Application WebApp Settings', - description: 'Used to get the WebApp settings of the application.', - tags: ['Application'], -}).output(z.object({ body: zGetChatWebAppSettingsResponse, status: z.literal(200) })) - -/** - * Get Annotation List - * - * Retrieves a list of annotations for the application. - */ -export const getAnnotationListContract = base.route({ - path: '/apps/annotations', - method: 'GET', - operationId: 'getAnnotationList', - summary: 'Get Annotation List', - description: 'Retrieves a list of annotations for the application.', - tags: ['Annotations'], -}).input(zGetAnnotationListData).output(z.object({ body: zGetAnnotationListResponse, status: z.literal(200) })) - -/** - * Create Annotation - * - * Creates a new annotation. - */ -export const createAnnotationContract = base.route({ - path: '/apps/annotations', - method: 'POST', - operationId: 'createAnnotation', - summary: 'Create Annotation', - description: 'Creates a new annotation.', - tags: ['Annotations'], -}).input(zCreateAnnotationData).output(z.object({ body: zCreateAnnotationResponse, status: z.literal(200) })) - -/** - * Delete Annotation - * - * Deletes an annotation. - */ -export const deleteAnnotationContract = base.route({ - path: '/apps/annotations/{annotation_id}', - method: 'DELETE', - operationId: 'deleteAnnotation', - summary: 'Delete Annotation', - description: 'Deletes an annotation.', - tags: ['Annotations'], -}).input(zDeleteAnnotationData) - -/** - * Update Annotation - * - * Updates an existing annotation. - */ -export const updateAnnotationContract = base.route({ - path: '/apps/annotations/{annotation_id}', - method: 'PUT', - operationId: 'updateAnnotation', - summary: 'Update Annotation', - description: 'Updates an existing annotation.', - tags: ['Annotations'], -}).input(zUpdateAnnotationData).output(z.object({ body: zUpdateAnnotationResponse, status: z.literal(200) })) - -/** - * Initial Annotation Reply Settings - * - * Enable or disable annotation reply settings and configure embedding models. This interface is executed asynchronously. - */ -export const initialAnnotationReplySettingsContract = base.route({ - path: '/apps/annotation-reply/{action}', - method: 'POST', - operationId: 'initialAnnotationReplySettings', - summary: 'Initial Annotation Reply Settings', - description: 'Enable or disable annotation reply settings and configure embedding models. This interface is executed asynchronously.', - tags: ['Annotations'], -}).input(zInitialAnnotationReplySettingsData).output(z.object({ body: zInitialAnnotationReplySettingsResponse2, status: z.literal(200) })) - -/** - * Query Initial Annotation Reply Settings Task Status - * - * Queries the status of an asynchronously executed annotation reply settings task. - */ -export const getInitialAnnotationReplySettingsStatusContract = base.route({ - path: '/apps/annotation-reply/{action}/status/{job_id}', - method: 'GET', - operationId: 'getInitialAnnotationReplySettingsStatus', - summary: 'Query Initial Annotation Reply Settings Task Status', - description: 'Queries the status of an asynchronously executed annotation reply settings task.', - tags: ['Annotations'], -}).input(zGetInitialAnnotationReplySettingsStatusData).output(z.object({ body: zGetInitialAnnotationReplySettingsStatusResponse, status: z.literal(200) })) - 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, - }, + sendChatMessageContract, + uploadChatFileContract, + previewChatFileContract, + stopChatMessageGenerationContract, + postChatMessageFeedbackContract, + getChatAppFeedbacksContract, + getSuggestedQuestionsContract, + getConversationHistoryContract, + getConversationsListContract, + deleteConversationContract, + renameConversationContract, + getConversationVariablesContract, + audioToTextContract, + textToAudioChatContract, + getChatAppInfoContract, + getChatAppParametersContract, + getChatAppMetaContract, + getChatWebAppSettingsContract, + getAnnotationListContract, + createAnnotationContract, + deleteAnnotationContract, + updateAnnotationContract, + initialAnnotationReplySettingsContract, + getInitialAnnotationReplySettingsStatusContract, } export type Contracts = typeof contracts diff --git a/web/gen/orpc/annotations.gen.ts b/web/gen/orpc/annotations.gen.ts new file mode 100644 index 0000000000..ddb709d74d --- /dev/null +++ b/web/gen/orpc/annotations.gen.ts @@ -0,0 +1,90 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zCreateAnnotationData, zCreateAnnotationResponse, zDeleteAnnotationData, zGetAnnotationListData, zGetAnnotationListResponse, zGetInitialAnnotationReplySettingsStatusData, zGetInitialAnnotationReplySettingsStatusResponse, zInitialAnnotationReplySettingsData, zInitialAnnotationReplySettingsResponse, zUpdateAnnotationData, zUpdateAnnotationResponse } from '../zod/annotations.gen' + +/** + * Get Annotation List + * + * Retrieves a list of annotations for the application. + */ +export const getAnnotationListContract = base.route({ + path: '/apps/annotations', + method: 'GET', + operationId: 'getAnnotationList', + summary: 'Get Annotation List', + description: 'Retrieves a list of annotations for the application.', + tags: ['Annotations'], +}).input(zGetAnnotationListData).output(z.object({ body: zGetAnnotationListResponse, status: z.literal(200) })) + +/** + * Create Annotation + * + * Creates a new annotation. + */ +export const createAnnotationContract = base.route({ + path: '/apps/annotations', + method: 'POST', + operationId: 'createAnnotation', + summary: 'Create Annotation', + description: 'Creates a new annotation.', + tags: ['Annotations'], +}).input(zCreateAnnotationData).output(z.object({ body: zCreateAnnotationResponse, status: z.literal(200) })) + +/** + * Delete Annotation + * + * Deletes an annotation. + */ +export const deleteAnnotationContract = base.route({ + path: '/apps/annotations/{annotation_id}', + method: 'DELETE', + operationId: 'deleteAnnotation', + summary: 'Delete Annotation', + description: 'Deletes an annotation.', + tags: ['Annotations'], +}).input(zDeleteAnnotationData) + +/** + * Update Annotation + * + * Updates an existing annotation. + */ +export const updateAnnotationContract = base.route({ + path: '/apps/annotations/{annotation_id}', + method: 'PUT', + operationId: 'updateAnnotation', + summary: 'Update Annotation', + description: 'Updates an existing annotation.', + tags: ['Annotations'], +}).input(zUpdateAnnotationData).output(z.object({ body: zUpdateAnnotationResponse, status: z.literal(200) })) + +/** + * Initial Annotation Reply Settings + * + * Enable or disable annotation reply settings and configure embedding models. This interface is executed asynchronously. + */ +export const initialAnnotationReplySettingsContract = base.route({ + path: '/apps/annotation-reply/{action}', + method: 'POST', + operationId: 'initialAnnotationReplySettings', + summary: 'Initial Annotation Reply Settings', + description: 'Enable or disable annotation reply settings and configure embedding models. This interface is executed asynchronously.', + tags: ['Annotations'], +}).input(zInitialAnnotationReplySettingsData).output(z.object({ body: zInitialAnnotationReplySettingsResponse, status: z.literal(200) })) + +/** + * Query Initial Annotation Reply Settings Task Status + * + * Queries the status of an asynchronously executed annotation reply settings task. + */ +export const getInitialAnnotationReplySettingsStatusContract = base.route({ + path: '/apps/annotation-reply/{action}/status/{job_id}', + method: 'GET', + operationId: 'getInitialAnnotationReplySettingsStatus', + summary: 'Query Initial Annotation Reply Settings Task Status', + description: 'Queries the status of an asynchronously executed annotation reply settings task.', + tags: ['Annotations'], +}).input(zGetInitialAnnotationReplySettingsStatusData).output(z.object({ body: zGetInitialAnnotationReplySettingsStatusResponse, status: z.literal(200) })) diff --git a/web/gen/orpc/application.gen.ts b/web/gen/orpc/application.gen.ts new file mode 100644 index 0000000000..4c767af3a9 --- /dev/null +++ b/web/gen/orpc/application.gen.ts @@ -0,0 +1,62 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zGetChatAppInfoResponse, zGetChatAppMetaResponse, zGetChatAppParametersData, zGetChatAppParametersResponse, zGetChatWebAppSettingsResponse } from '../zod/application.gen' + +/** + * Get Application Basic Information + * + * Used to get basic information about this application. + */ +export const getChatAppInfoContract = base.route({ + path: '/info', + method: 'GET', + operationId: 'getChatAppInfo', + summary: 'Get Application Basic Information', + description: 'Used to get basic information about this application.', + tags: ['Application'], +}).output(z.object({ body: zGetChatAppInfoResponse, status: z.literal(200) })) + +/** + * Get Application Parameters Information + * + * Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values. + */ +export const getChatAppParametersContract = base.route({ + path: '/parameters', + method: 'GET', + operationId: 'getChatAppParameters', + summary: 'Get Application Parameters Information', + description: 'Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.', + tags: ['Application'], +}).input(zGetChatAppParametersData).output(z.object({ body: zGetChatAppParametersResponse, status: z.literal(200) })) + +/** + * Get Application Meta Information + * + * Used to get icons of tools in this application. + */ +export const getChatAppMetaContract = base.route({ + path: '/meta', + method: 'GET', + operationId: 'getChatAppMeta', + summary: 'Get Application Meta Information', + description: 'Used to get icons of tools in this application.', + tags: ['Application'], +}).output(z.object({ body: zGetChatAppMetaResponse, status: z.literal(200) })) + +/** + * Get Application WebApp Settings + * + * Used to get the WebApp settings of the application. + */ +export const getChatWebAppSettingsContract = base.route({ + path: '/site', + method: 'GET', + operationId: 'getChatWebAppSettings', + summary: 'Get Application WebApp Settings', + description: 'Used to get the WebApp settings of the application.', + tags: ['Application'], +}).output(z.object({ body: zGetChatWebAppSettingsResponse, status: z.literal(200) })) diff --git a/web/gen/orpc/chat.gen.ts b/web/gen/orpc/chat.gen.ts new file mode 100644 index 0000000000..3357d4a9fb --- /dev/null +++ b/web/gen/orpc/chat.gen.ts @@ -0,0 +1,48 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zGetSuggestedQuestionsData, zGetSuggestedQuestionsResponse, zSendChatMessageData, zSendChatMessageResponse, zStopChatMessageGenerationData, zStopChatMessageGenerationResponse } from '../zod/chat.gen' + +/** + * Send Chat Message + * + * Send a request to the chat application. + */ +export const sendChatMessageContract = base.route({ + path: '/chat-messages', + method: 'POST', + operationId: 'sendChatMessage', + summary: 'Send Chat Message', + description: 'Send a request to the chat application.', + tags: ['Chat'], +}).input(zSendChatMessageData).output(z.object({ body: zSendChatMessageResponse, status: z.literal(200) })) + +/** + * Stop Chat Message Generation + * + * Stops a chat message generation task. Only supported in streaming mode. + */ +export const stopChatMessageGenerationContract = base.route({ + path: '/chat-messages/{task_id}/stop', + method: 'POST', + operationId: 'stopChatMessageGeneration', + summary: 'Stop Chat Message Generation', + description: 'Stops a chat message generation task. Only supported in streaming mode.', + tags: ['Chat'], +}).input(zStopChatMessageGenerationData).output(z.object({ body: zStopChatMessageGenerationResponse, status: z.literal(200) })) + +/** + * Next Suggested Questions + * + * Get next questions suggestions for the current message. + */ +export const getSuggestedQuestionsContract = base.route({ + path: '/messages/{message_id}/suggested', + method: 'GET', + operationId: 'getSuggestedQuestions', + summary: 'Next Suggested Questions', + description: 'Get next questions suggestions for the current message.', + tags: ['Chat'], +}).input(zGetSuggestedQuestionsData).output(z.object({ body: zGetSuggestedQuestionsResponse, status: z.literal(200) })) diff --git a/web/gen/orpc/conversations.gen.ts b/web/gen/orpc/conversations.gen.ts new file mode 100644 index 0000000000..7772e6434d --- /dev/null +++ b/web/gen/orpc/conversations.gen.ts @@ -0,0 +1,76 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zDeleteConversationData, zGetConversationHistoryData, zGetConversationHistoryResponse, zGetConversationsListData, zGetConversationsListResponse, zGetConversationVariablesData, zGetConversationVariablesResponse, zRenameConversationData, zRenameConversationResponse } from '../zod/conversations.gen' + +/** + * Get Conversation History Messages + * + * 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 getConversationHistoryContract = base.route({ + path: '/messages', + method: 'GET', + operationId: 'getConversationHistory', + summary: 'Get Conversation History Messages', + description: 'Returns historical chat records in a scrolling load format, with the first page returning the latest `{limit}` messages, i.e., in reverse order.', + tags: ['Conversations'], +}).input(zGetConversationHistoryData).output(z.object({ body: zGetConversationHistoryResponse, status: z.literal(200) })) + +/** + * Get Conversations + * + * Retrieve the conversation list for the current user, defaulting to the most recent 20 entries. + */ +export const getConversationsListContract = base.route({ + path: '/conversations', + method: 'GET', + operationId: 'getConversationsList', + summary: 'Get Conversations', + description: 'Retrieve the conversation list for the current user, defaulting to the most recent 20 entries.', + tags: ['Conversations'], +}).input(zGetConversationsListData).output(z.object({ body: zGetConversationsListResponse, status: z.literal(200) })) + +/** + * Delete Conversation + * + * Delete a conversation. + */ +export const deleteConversationContract = base.route({ + path: '/conversations/{conversation_id}', + method: 'DELETE', + operationId: 'deleteConversation', + summary: 'Delete Conversation', + description: 'Delete a conversation.', + tags: ['Conversations'], +}).input(zDeleteConversationData) + +/** + * Conversation Rename + * + * Rename the session. The session name is used for display on clients that support multiple sessions. + */ +export const renameConversationContract = base.route({ + path: '/conversations/{conversation_id}/name', + method: 'POST', + operationId: 'renameConversation', + summary: 'Conversation Rename', + description: 'Rename the session. The session name is used for display on clients that support multiple sessions.', + tags: ['Conversations'], +}).input(zRenameConversationData).output(z.object({ body: zRenameConversationResponse, status: z.literal(200) })) + +/** + * Get Conversation Variables + * + * Retrieve variables from a specific conversation. + */ +export const getConversationVariablesContract = base.route({ + path: '/conversations/{conversation_id}/variables', + method: 'GET', + operationId: 'getConversationVariables', + summary: 'Get Conversation Variables', + description: 'Retrieve variables from a specific conversation.', + tags: ['Conversations'], +}).input(zGetConversationVariablesData).output(z.object({ body: zGetConversationVariablesResponse, status: z.literal(200) })) diff --git a/web/gen/orpc/feedback.gen.ts b/web/gen/orpc/feedback.gen.ts new file mode 100644 index 0000000000..04c8be5e39 --- /dev/null +++ b/web/gen/orpc/feedback.gen.ts @@ -0,0 +1,34 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zGetChatAppFeedbacksData, zGetChatAppFeedbacksResponse, zPostChatMessageFeedbackData, zPostChatMessageFeedbackResponse } from '../zod/feedback.gen' + +/** + * Message Feedback + * + * End-users can provide feedback messages, facilitating application developers to optimize expected outputs. + */ +export const postChatMessageFeedbackContract = base.route({ + path: '/messages/{message_id}/feedbacks', + method: 'POST', + operationId: 'postChatMessageFeedback', + summary: 'Message Feedback', + description: 'End-users can provide feedback messages, facilitating application developers to optimize expected outputs.', + tags: ['Feedback'], +}).input(zPostChatMessageFeedbackData).output(z.object({ body: zPostChatMessageFeedbackResponse, status: z.literal(200) })) + +/** + * Get feedbacks of application + * + * Get application's feedbacks. + */ +export const getChatAppFeedbacksContract = base.route({ + path: '/app/feedbacks', + method: 'GET', + operationId: 'getChatAppFeedbacks', + summary: 'Get feedbacks of application', + description: 'Get application\'s feedbacks.', + tags: ['Feedback'], +}).input(zGetChatAppFeedbacksData).output(z.object({ body: zGetChatAppFeedbacksResponse, status: z.literal(200) })) diff --git a/web/gen/orpc/files.gen.ts b/web/gen/orpc/files.gen.ts new file mode 100644 index 0000000000..f06f4d28cd --- /dev/null +++ b/web/gen/orpc/files.gen.ts @@ -0,0 +1,34 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zPreviewChatFileData, zPreviewChatFileResponse, zUploadChatFileData, zUploadChatFileResponse } from '../zod/files.gen' + +/** + * File Upload + * + * 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 uploadChatFileContract = base.route({ + path: '/files/upload', + method: 'POST', + operationId: 'uploadChatFile', + summary: 'File Upload', + description: '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.', + tags: ['Files'], +}).input(zUploadChatFileData).output(z.object({ body: zUploadChatFileResponse, status: z.literal(200) })) + +/** + * File Preview + * + * 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 previewChatFileContract = base.route({ + path: '/files/{file_id}/preview', + method: 'GET', + operationId: 'previewChatFile', + summary: 'File Preview', + description: '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.', + tags: ['Files'], +}).input(zPreviewChatFileData).output(z.object({ body: zPreviewChatFileResponse, status: z.literal(200) })) diff --git a/web/gen/orpc/tts.gen.ts b/web/gen/orpc/tts.gen.ts new file mode 100644 index 0000000000..2803ed41a9 --- /dev/null +++ b/web/gen/orpc/tts.gen.ts @@ -0,0 +1,34 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { base } from '../orpc.gen' +import { zAudioToTextData, zAudioToTextResponse, zTextToAudioChatData, zTextToAudioChatResponse } from '../zod/tts.gen' + +/** + * Speech to Text + * + * Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB. + */ +export const audioToTextContract = base.route({ + path: '/audio-to-text', + method: 'POST', + operationId: 'audioToText', + summary: 'Speech to Text', + description: 'Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB.', + tags: ['TTS'], +}).input(zAudioToTextData).output(z.object({ body: zAudioToTextResponse, status: z.literal(200) })) + +/** + * Text to Audio + * + * Convert text to speech. + */ +export const textToAudioChatContract = base.route({ + path: '/text-to-audio', + method: 'POST', + operationId: 'textToAudioChat', + summary: 'Text to Audio', + description: 'Convert text to speech.', + tags: ['TTS'], +}).input(zTextToAudioChatData).output(z.object({ body: zTextToAudioChatResponse, status: z.literal(200) })) diff --git a/web/gen/zod.gen.ts b/web/gen/zod.gen.ts index c88c85c305..cbd3b65406 100644 --- a/web/gen/zod.gen.ts +++ b/web/gen/zod.gen.ts @@ -587,431 +587,3 @@ export const zErrorResponse = z.object({ }) export type ErrorResponseZodType = z.infer - -export const zSendChatMessageData = z.object({ - body: zChatRequest, - path: z.never().optional(), - query: z.never().optional(), -}) - -export type SendChatMessageDataZodType = z.infer - -/** - * Successful response. The content type and structure depend on the `response_mode` parameter in the request. - * - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - * - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkChatEvent` objects. - */ -export const zSendChatMessageResponse = zChatCompletionResponse - -export type SendChatMessageResponseZodType = z.infer - -export const zUploadChatFileData = z.object({ - body: z.object({ - file: z.string().describe('The file to be uploaded. Supported image types: png, jpg, jpeg, webp, gif.'), - user: z.string().describe('User identifier, defined by the developer\'s rules, must be unique within the application. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), - }).describe('File upload request. Requires multipart/form-data.'), - path: z.never().optional(), - query: z.never().optional(), -}) - -export type UploadChatFileDataZodType = z.infer - -/** - * File uploaded successfully. - */ -export const zUploadChatFileResponse = zFileUploadResponse - -export type UploadChatFileResponseZodType = z.infer - -export const zPreviewChatFileData = z.object({ - body: z.never().optional(), - path: z.object({ - file_id: z.string().uuid().describe('The unique identifier of the file to preview, obtained from the File Upload API response.'), - }), - query: z.object({ - as_attachment: z.boolean().describe('Whether to force download the file as an attachment. Default is `false` (preview in browser).').optional().default(false), - }).optional(), -}) - -export type PreviewChatFileDataZodType = z.infer - -/** - * File content returned successfully. Headers set based on file type and request parameters. - */ -export const zPreviewChatFileResponse = z.string().describe('File content returned successfully. Headers set based on file type and request parameters.') - -export type PreviewChatFileResponseZodType = z.infer - -export const zStopChatMessageGenerationData = z.object({ - body: z.object({ - user: z.string().describe('User identifier, must be consistent with the user passed in the send message interface. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), - }), - path: z.object({ - task_id: z.string().describe('Task ID, can be obtained from the streaming chunk return of a `/chat-messages` request.'), - }), - query: z.never().optional(), -}) - -export type StopChatMessageGenerationDataZodType = z.infer - -/** - * Operation successful. - */ -export const zStopChatMessageGenerationResponse = z.object({ - result: z.string().optional(), -}).describe('Operation successful.') - -export type StopChatMessageGenerationResponseZodType = z.infer - -export const zPostChatMessageFeedbackData = z.object({ - body: zMessageFeedbackRequest, - path: z.object({ - message_id: z.string().describe('Message ID for which feedback is being provided.'), - }), - query: z.never().optional(), -}) - -export type PostChatMessageFeedbackDataZodType = z.infer - -/** - * Operation successful. - */ -export const zPostChatMessageFeedbackResponse = z.object({ - result: z.string().optional(), -}).describe('Operation successful.') - -export type PostChatMessageFeedbackResponseZodType = z.infer - -export const zGetChatAppFeedbacksData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - page: z.number().int().describe('(optional) Pagination page number. Default: 1').optional().default(1), - limit: z.number().int().describe('(optional) Records per page. Default: 20').optional().default(20), - }).optional(), -}) - -export type GetChatAppFeedbacksDataZodType = z.infer - -/** - * A list of application feedbacks. - */ -export const zGetChatAppFeedbacksResponse = zAppFeedbacksResponse - -export type GetChatAppFeedbacksResponseZodType = z.infer - -export const zGetSuggestedQuestionsData = z.object({ - body: z.never().optional(), - path: z.object({ - message_id: z.string().describe('Message ID.'), - }), - query: z.object({ - user: z.string().describe('User identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), - }), -}) - -export type GetSuggestedQuestionsDataZodType = z.infer - -/** - * Successfully retrieved suggested questions. - */ -export const zGetSuggestedQuestionsResponse = zSuggestedQuestionsResponse - -export type GetSuggestedQuestionsResponseZodType = z.infer - -export const zGetConversationHistoryData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - conversation_id: z.string().describe('Conversation ID.'), - user: z.string().describe('User identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), - first_id: z.string().describe('The ID of the first chat record on the current page, default is null (for fetching the latest). For subsequent pages, use the ID of the first message from the current list to get older messages.').optional(), - limit: z.number().int().describe('How many chat history messages to return in one request, default is 20.').optional().default(20), - }), -}) - -export type GetConversationHistoryDataZodType = z.infer - -/** - * Successfully retrieved conversation history. - */ -export const zGetConversationHistoryResponse = zConversationHistoryResponse - -export type GetConversationHistoryResponseZodType = z.infer - -export const zGetConversationsListData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - user: z.string().describe('User identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), - last_id: z.string().describe('(Optional) The ID of the last record on the current page (for pagination).').optional(), - limit: z.number().int().gte(1).lte(100).describe('(Optional) How many records to return. Default 20, Min 1, Max 100.').optional().default(20), - sort_by: z.enum([ - 'created_at', - '-created_at', - 'updated_at', - '-updated_at', - ]).describe('Sorting Field. Default: -updated_at. \'-\' prefix for descending.').optional(), - }), -}) - -export type GetConversationsListDataZodType = z.infer - -/** - * Successfully retrieved conversations list. - */ -export const zGetConversationsListResponse = zConversationsListResponse - -export type GetConversationsListResponseZodType = z.infer - -export const zDeleteConversationData = z.object({ - body: z.object({ - user: z.string().describe('The user identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), - }), - path: z.object({ - conversation_id: z.string().describe('Conversation ID.'), - }), - query: z.never().optional(), -}) - -export type DeleteConversationDataZodType = z.infer - -/** - * Conversation deleted successfully. No Content. - */ -export const zDeleteConversationResponse = z.void().describe('Conversation deleted successfully. No Content.') - -export type DeleteConversationResponseZodType = z.infer - -export const zRenameConversationData = z.object({ - body: zConversationRenameRequest, - path: z.object({ - conversation_id: z.string().describe('Conversation ID.'), - }), - query: z.never().optional(), -}) - -export type RenameConversationDataZodType = z.infer - -/** - * Conversation renamed successfully. - */ -export const zRenameConversationResponse = zConversationListItem - -export type RenameConversationResponseZodType = z.infer - -export const zGetConversationVariablesData = z.object({ - body: z.never().optional(), - path: z.object({ - conversation_id: z.string().describe('The ID of the conversation to retrieve variables from.'), - }), - query: z.object({ - user: z.string().describe('The user identifier.'), - last_id: z.string().describe('(Optional) The ID of the last record on the current page (for pagination).').optional(), - limit: z.number().int().gte(1).lte(100).describe('(Optional) How many records to return. Default 20, Min 1, Max 100.').optional().default(20), - variable_name: z.string().describe('(Optional) Filter variables by a specific name.').optional(), - }), -}) - -export type GetConversationVariablesDataZodType = z.infer - -/** - * Successfully retrieved conversation variables. - */ -export const zGetConversationVariablesResponse = zConversationVariablesResponse - -export type GetConversationVariablesResponseZodType = z.infer - -export const zAudioToTextData = z.object({ - body: zAudioToTextRequest, - path: z.never().optional(), - query: z.never().optional(), -}) - -export type AudioToTextDataZodType = z.infer - -/** - * Successfully converted audio to text. - */ -export const zAudioToTextResponse2 = zAudioToTextResponse - -export type AudioToTextResponseZodType2 = z.infer - -export const zTextToAudioChatData = z.object({ - body: zTextToAudioFormRequest, - path: z.never().optional(), - query: z.never().optional(), -}) - -export type TextToAudioChatDataZodType = z.infer - -/** - * The generated audio file. - */ -export const zTextToAudioChatResponse = z.string().describe('The generated audio file.') - -export type TextToAudioChatResponseZodType = z.infer - -export const zGetChatAppInfoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional(), -}) - -export type GetChatAppInfoDataZodType = z.infer - -/** - * Basic information of the application. - */ -export const zGetChatAppInfoResponse = zAppInfoResponse - -export type GetChatAppInfoResponseZodType = z.infer - -export const zGetChatAppParametersData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - user: z.string().describe('User identifier, defined by the developer\'s rules, must be unique within the application.'), - }), -}) - -export type GetChatAppParametersDataZodType = z.infer - -/** - * Application parameters information. - */ -export const zGetChatAppParametersResponse = zChatAppParametersResponse - -export type GetChatAppParametersResponseZodType = z.infer - -export const zGetChatAppMetaData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional(), -}) - -export type GetChatAppMetaDataZodType = z.infer - -/** - * Successfully retrieved application meta information. - */ -export const zGetChatAppMetaResponse = zAppMetaResponse - -export type GetChatAppMetaResponseZodType = z.infer - -export const zGetChatWebAppSettingsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional(), -}) - -export type GetChatWebAppSettingsDataZodType = z.infer - -/** - * WebApp settings of the application. - */ -export const zGetChatWebAppSettingsResponse = zWebAppSettingsResponse - -export type GetChatWebAppSettingsResponseZodType = z.infer - -export const zGetAnnotationListData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - page: z.number().int().describe('Page number.').optional().default(1), - limit: z.number().int().gte(1).lte(100).describe('Number of items returned, default 20, range 1-100.').optional().default(20), - }).optional(), -}) - -export type GetAnnotationListDataZodType = z.infer - -/** - * Successfully retrieved annotation list. - */ -export const zGetAnnotationListResponse = zAnnotationListResponse - -export type GetAnnotationListResponseZodType = z.infer - -export const zCreateAnnotationData = z.object({ - body: zCreateAnnotationRequest, - path: z.never().optional(), - query: z.never().optional(), -}) - -export type CreateAnnotationDataZodType = z.infer - -/** - * Annotation created successfully. - */ -export const zCreateAnnotationResponse = zAnnotationItem - -export type CreateAnnotationResponseZodType = z.infer - -export const zDeleteAnnotationData = z.object({ - body: z.never().optional(), - path: z.object({ - annotation_id: z.string().describe('Annotation ID.'), - }), - query: z.never().optional(), -}) - -export type DeleteAnnotationDataZodType = z.infer - -/** - * Annotation deleted successfully. No Content. - */ -export const zDeleteAnnotationResponse = z.void().describe('Annotation deleted successfully. No Content.') - -export type DeleteAnnotationResponseZodType = z.infer - -export const zUpdateAnnotationData = z.object({ - body: zUpdateAnnotationRequest, - path: z.object({ - annotation_id: z.string().describe('Annotation ID.'), - }), - query: z.never().optional(), -}) - -export type UpdateAnnotationDataZodType = z.infer - -/** - * Annotation updated successfully. - */ -export const zUpdateAnnotationResponse = zAnnotationItem - -export type UpdateAnnotationResponseZodType = z.infer - -export const zInitialAnnotationReplySettingsData = z.object({ - body: zInitialAnnotationReplySettingsRequest, - path: z.object({ - action: z.enum(['enable', 'disable']).describe('Action, can only be \'enable\' or \'disable\'.'), - }), - query: z.never().optional(), -}) - -export type InitialAnnotationReplySettingsDataZodType = z.infer - -/** - * Annotation reply settings task initiated. - */ -export const zInitialAnnotationReplySettingsResponse2 = zInitialAnnotationReplySettingsResponse - -export type InitialAnnotationReplySettingsResponseZodType2 = z.infer - -export const zGetInitialAnnotationReplySettingsStatusData = z.object({ - body: z.never().optional(), - path: z.object({ - action: z.enum(['enable', 'disable']).describe('Action, must be the same as in the initial settings call (\'enable\' or \'disable\').'), - job_id: z.string().describe('Job ID obtained from the initial settings call.'), - }), - query: z.never().optional(), -}) - -export type GetInitialAnnotationReplySettingsStatusDataZodType = z.infer - -/** - * Successfully retrieved task status. - */ -export const zGetInitialAnnotationReplySettingsStatusResponse = zInitialAnnotationReplySettingsStatusResponse - -export type GetInitialAnnotationReplySettingsStatusResponseZodType = z.infer diff --git a/web/gen/zod/annotations.gen.ts b/web/gen/zod/annotations.gen.ts new file mode 100644 index 0000000000..3b88d200ee --- /dev/null +++ b/web/gen/zod/annotations.gen.ts @@ -0,0 +1,107 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAnnotationItem, zAnnotationListResponse, zCreateAnnotationRequest, zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse, zUpdateAnnotationRequest } from '../zod.gen' + +export const zGetAnnotationListData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + page: z.number().int().describe('Page number.').optional().default(1), + limit: z.number().int().gte(1).lte(100).describe('Number of items returned, default 20, range 1-100.').optional().default(20), + }).optional(), +}) + +export type GetAnnotationListDataZodType = z.infer + +/** + * Successfully retrieved annotation list. + */ +export const zGetAnnotationListResponse = zAnnotationListResponse + +export type GetAnnotationListResponseZodType = z.infer + +export const zCreateAnnotationData = z.object({ + body: zCreateAnnotationRequest, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type CreateAnnotationDataZodType = z.infer + +/** + * Annotation created successfully. + */ +export const zCreateAnnotationResponse = zAnnotationItem + +export type CreateAnnotationResponseZodType = z.infer + +export const zDeleteAnnotationData = z.object({ + body: z.never().optional(), + path: z.object({ + annotation_id: z.string().describe('Annotation ID.'), + }), + query: z.never().optional(), +}) + +export type DeleteAnnotationDataZodType = z.infer + +/** + * Annotation deleted successfully. No Content. + */ +export const zDeleteAnnotationResponse = z.void().describe('Annotation deleted successfully. No Content.') + +export type DeleteAnnotationResponseZodType = z.infer + +export const zUpdateAnnotationData = z.object({ + body: zUpdateAnnotationRequest, + path: z.object({ + annotation_id: z.string().describe('Annotation ID.'), + }), + query: z.never().optional(), +}) + +export type UpdateAnnotationDataZodType = z.infer + +/** + * Annotation updated successfully. + */ +export const zUpdateAnnotationResponse = zAnnotationItem + +export type UpdateAnnotationResponseZodType = z.infer + +export const zInitialAnnotationReplySettingsData = z.object({ + body: zInitialAnnotationReplySettingsRequest, + path: z.object({ + action: z.enum(['enable', 'disable']).describe('Action, can only be \'enable\' or \'disable\'.'), + }), + query: z.never().optional(), +}) + +export type InitialAnnotationReplySettingsDataZodType = z.infer + +/** + * Annotation reply settings task initiated. + */ +export const zInitialAnnotationReplySettingsResponse = zInitialAnnotationReplySettingsResponse2 + +export type InitialAnnotationReplySettingsResponseZodType = z.infer + +export const zGetInitialAnnotationReplySettingsStatusData = z.object({ + body: z.never().optional(), + path: z.object({ + action: z.enum(['enable', 'disable']).describe('Action, must be the same as in the initial settings call (\'enable\' or \'disable\').'), + job_id: z.string().describe('Job ID obtained from the initial settings call.'), + }), + query: z.never().optional(), +}) + +export type GetInitialAnnotationReplySettingsStatusDataZodType = z.infer + +/** + * Successfully retrieved task status. + */ +export const zGetInitialAnnotationReplySettingsStatusResponse = zInitialAnnotationReplySettingsStatusResponse + +export type GetInitialAnnotationReplySettingsStatusResponseZodType = z.infer diff --git a/web/gen/zod/application.gen.ts b/web/gen/zod/application.gen.ts new file mode 100644 index 0000000000..14b0b1aa59 --- /dev/null +++ b/web/gen/zod/application.gen.ts @@ -0,0 +1,67 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAppInfoResponse, zAppMetaResponse, zChatAppParametersResponse, zWebAppSettingsResponse } from '../zod.gen' + +export const zGetChatAppInfoData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetChatAppInfoDataZodType = z.infer + +/** + * Basic information of the application. + */ +export const zGetChatAppInfoResponse = zAppInfoResponse + +export type GetChatAppInfoResponseZodType = z.infer + +export const zGetChatAppParametersData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + user: z.string().describe('User identifier, defined by the developer\'s rules, must be unique within the application.'), + }), +}) + +export type GetChatAppParametersDataZodType = z.infer + +/** + * Application parameters information. + */ +export const zGetChatAppParametersResponse = zChatAppParametersResponse + +export type GetChatAppParametersResponseZodType = z.infer + +export const zGetChatAppMetaData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetChatAppMetaDataZodType = z.infer + +/** + * Successfully retrieved application meta information. + */ +export const zGetChatAppMetaResponse = zAppMetaResponse + +export type GetChatAppMetaResponseZodType = z.infer + +export const zGetChatWebAppSettingsData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetChatWebAppSettingsDataZodType = z.infer + +/** + * WebApp settings of the application. + */ +export const zGetChatWebAppSettingsResponse = zWebAppSettingsResponse + +export type GetChatWebAppSettingsResponseZodType = z.infer diff --git a/web/gen/zod/chat.gen.ts b/web/gen/zod/chat.gen.ts new file mode 100644 index 0000000000..f0fc216e58 --- /dev/null +++ b/web/gen/zod/chat.gen.ts @@ -0,0 +1,62 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zChatCompletionResponse, zChatRequest, zSuggestedQuestionsResponse } from '../zod.gen' + +export const zSendChatMessageData = z.object({ + body: zChatRequest, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type SendChatMessageDataZodType = z.infer + +/** + * Successful response. The content type and structure depend on the `response_mode` parameter in the request. + * - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. + * - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkChatEvent` objects. + */ +export const zSendChatMessageResponse = zChatCompletionResponse + +export type SendChatMessageResponseZodType = z.infer + +export const zStopChatMessageGenerationData = z.object({ + body: z.object({ + user: z.string().describe('User identifier, must be consistent with the user passed in the send message interface. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), + }), + path: z.object({ + task_id: z.string().describe('Task ID, can be obtained from the streaming chunk return of a `/chat-messages` request.'), + }), + query: z.never().optional(), +}) + +export type StopChatMessageGenerationDataZodType = z.infer + +/** + * Operation successful. + */ +export const zStopChatMessageGenerationResponse = z.object({ + result: z.string().optional(), +}).describe('Operation successful.') + +export type StopChatMessageGenerationResponseZodType = z.infer + +export const zGetSuggestedQuestionsData = z.object({ + body: z.never().optional(), + path: z.object({ + message_id: z.string().describe('Message ID.'), + }), + query: z.object({ + user: z.string().describe('User identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), + }), +}) + +export type GetSuggestedQuestionsDataZodType = z.infer + +/** + * Successfully retrieved suggested questions. + */ +export const zGetSuggestedQuestionsResponse = zSuggestedQuestionsResponse + +export type GetSuggestedQuestionsResponseZodType = z.infer diff --git a/web/gen/zod/conversations.gen.ts b/web/gen/zod/conversations.gen.ts new file mode 100644 index 0000000000..de50a28055 --- /dev/null +++ b/web/gen/zod/conversations.gen.ts @@ -0,0 +1,108 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zConversationHistoryResponse, zConversationListItem, zConversationRenameRequest, zConversationsListResponse, zConversationVariablesResponse } from '../zod.gen' + +export const zGetConversationHistoryData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + conversation_id: z.string().describe('Conversation ID.'), + user: z.string().describe('User identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), + first_id: z.string().describe('The ID of the first chat record on the current page, default is null (for fetching the latest). For subsequent pages, use the ID of the first message from the current list to get older messages.').optional(), + limit: z.number().int().describe('How many chat history messages to return in one request, default is 20.').optional().default(20), + }), +}) + +export type GetConversationHistoryDataZodType = z.infer + +/** + * Successfully retrieved conversation history. + */ +export const zGetConversationHistoryResponse = zConversationHistoryResponse + +export type GetConversationHistoryResponseZodType = z.infer + +export const zGetConversationsListData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + user: z.string().describe('User identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), + last_id: z.string().describe('(Optional) The ID of the last record on the current page (for pagination).').optional(), + limit: z.number().int().gte(1).lte(100).describe('(Optional) How many records to return. Default 20, Min 1, Max 100.').optional().default(20), + sort_by: z.enum([ + 'created_at', + '-created_at', + 'updated_at', + '-updated_at', + ]).describe('Sorting Field. Default: -updated_at. \'-\' prefix for descending.').optional(), + }), +}) + +export type GetConversationsListDataZodType = z.infer + +/** + * Successfully retrieved conversations list. + */ +export const zGetConversationsListResponse = zConversationsListResponse + +export type GetConversationsListResponseZodType = z.infer + +export const zDeleteConversationData = z.object({ + body: z.object({ + user: z.string().describe('The user identifier. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), + }), + path: z.object({ + conversation_id: z.string().describe('Conversation ID.'), + }), + query: z.never().optional(), +}) + +export type DeleteConversationDataZodType = z.infer + +/** + * Conversation deleted successfully. No Content. + */ +export const zDeleteConversationResponse = z.void().describe('Conversation deleted successfully. No Content.') + +export type DeleteConversationResponseZodType = z.infer + +export const zRenameConversationData = z.object({ + body: zConversationRenameRequest, + path: z.object({ + conversation_id: z.string().describe('Conversation ID.'), + }), + query: z.never().optional(), +}) + +export type RenameConversationDataZodType = z.infer + +/** + * Conversation renamed successfully. + */ +export const zRenameConversationResponse = zConversationListItem + +export type RenameConversationResponseZodType = z.infer + +export const zGetConversationVariablesData = z.object({ + body: z.never().optional(), + path: z.object({ + conversation_id: z.string().describe('The ID of the conversation to retrieve variables from.'), + }), + query: z.object({ + user: z.string().describe('The user identifier.'), + last_id: z.string().describe('(Optional) The ID of the last record on the current page (for pagination).').optional(), + limit: z.number().int().gte(1).lte(100).describe('(Optional) How many records to return. Default 20, Min 1, Max 100.').optional().default(20), + variable_name: z.string().describe('(Optional) Filter variables by a specific name.').optional(), + }), +}) + +export type GetConversationVariablesDataZodType = z.infer + +/** + * Successfully retrieved conversation variables. + */ +export const zGetConversationVariablesResponse = zConversationVariablesResponse + +export type GetConversationVariablesResponseZodType = z.infer diff --git a/web/gen/zod/feedback.gen.ts b/web/gen/zod/feedback.gen.ts new file mode 100644 index 0000000000..2fb2556497 --- /dev/null +++ b/web/gen/zod/feedback.gen.ts @@ -0,0 +1,42 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAppFeedbacksResponse, zMessageFeedbackRequest } from '../zod.gen' + +export const zPostChatMessageFeedbackData = z.object({ + body: zMessageFeedbackRequest, + path: z.object({ + message_id: z.string().describe('Message ID for which feedback is being provided.'), + }), + query: z.never().optional(), +}) + +export type PostChatMessageFeedbackDataZodType = z.infer + +/** + * Operation successful. + */ +export const zPostChatMessageFeedbackResponse = z.object({ + result: z.string().optional(), +}).describe('Operation successful.') + +export type PostChatMessageFeedbackResponseZodType = z.infer + +export const zGetChatAppFeedbacksData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + page: z.number().int().describe('(optional) Pagination page number. Default: 1').optional().default(1), + limit: z.number().int().describe('(optional) Records per page. Default: 20').optional().default(20), + }).optional(), +}) + +export type GetChatAppFeedbacksDataZodType = z.infer + +/** + * A list of application feedbacks. + */ +export const zGetChatAppFeedbacksResponse = zAppFeedbacksResponse + +export type GetChatAppFeedbacksResponseZodType = z.infer diff --git a/web/gen/zod/files.gen.ts b/web/gen/zod/files.gen.ts new file mode 100644 index 0000000000..40dd093999 --- /dev/null +++ b/web/gen/zod/files.gen.ts @@ -0,0 +1,42 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zFileUploadResponse } from '../zod.gen' + +export const zUploadChatFileData = z.object({ + body: z.object({ + file: z.string().describe('The file to be uploaded. Supported image types: png, jpg, jpeg, webp, gif.'), + user: z.string().describe('User identifier, defined by the developer\'s rules, must be unique within the application. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'), + }).describe('File upload request. Requires multipart/form-data.'), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type UploadChatFileDataZodType = z.infer + +/** + * File uploaded successfully. + */ +export const zUploadChatFileResponse = zFileUploadResponse + +export type UploadChatFileResponseZodType = z.infer + +export const zPreviewChatFileData = z.object({ + body: z.never().optional(), + path: z.object({ + file_id: z.string().uuid().describe('The unique identifier of the file to preview, obtained from the File Upload API response.'), + }), + query: z.object({ + as_attachment: z.boolean().describe('Whether to force download the file as an attachment. Default is `false` (preview in browser).').optional().default(false), + }).optional(), +}) + +export type PreviewChatFileDataZodType = z.infer + +/** + * File content returned successfully. Headers set based on file type and request parameters. + */ +export const zPreviewChatFileResponse = z.string().describe('File content returned successfully. Headers set based on file type and request parameters.') + +export type PreviewChatFileResponseZodType = z.infer diff --git a/web/gen/zod/tts.gen.ts b/web/gen/zod/tts.gen.ts new file mode 100644 index 0000000000..70ab6c32b1 --- /dev/null +++ b/web/gen/zod/tts.gen.ts @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAudioToTextRequest, zAudioToTextResponse as zAudioToTextResponse2, zTextToAudioFormRequest } from '../zod.gen' + +export const zAudioToTextData = z.object({ + body: zAudioToTextRequest, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type AudioToTextDataZodType = z.infer + +/** + * Successfully converted audio to text. + */ +export const zAudioToTextResponse = zAudioToTextResponse2 + +export type AudioToTextResponseZodType = z.infer + +export const zTextToAudioChatData = z.object({ + body: zTextToAudioFormRequest, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type TextToAudioChatDataZodType = z.infer + +/** + * The generated audio file. + */ +export const zTextToAudioChatResponse = z.string().describe('The generated audio file.') + +export type TextToAudioChatResponseZodType = z.infer diff --git a/web/openapi-ts.config.ts b/web/openapi-ts.config.ts index a8fc3e3ac2..40882d4e31 100644 --- a/web/openapi-ts.config.ts +++ b/web/openapi-ts.config.ts @@ -2,6 +2,47 @@ import { defineConfig } from '@hey-api/openapi-ts' import { defineConfig as defineOrpcConfig } from './plugins/hey-api-orpc/config' +// Whether to split generated files by tag +const splitByTags = true + +// Symbol type for the getFilePath hook (not publicly exported by hey-api) +type SymbolMeta = { + tags?: readonly string[] + tool?: string + resource?: string + pluginName?: string +} + +// Get file path based on symbol metadata +function getFilePathByTag(symbol: { meta?: SymbolMeta }): string | undefined { + const meta = symbol.meta + if (!meta) + return undefined + + // Get the first tag from symbol metadata + const tag = meta.tags?.[0]?.toLowerCase() + + if (!tag) + return undefined + + // Handle zod plugin symbols + if (meta.tool === 'zod') { + // Only split operation-related schemas (requests/responses), not definitions + if (meta.resource === 'operation') { + return `zod/${tag}` + } + // Keep definitions in the main zod file + return undefined + } + + // Handle orpc plugin symbols + if (meta.pluginName === 'orpc') { + return `orpc/${tag}` + } + + return undefined +} + export default defineConfig({ input: './openapi_chat.json', output: { @@ -22,7 +63,15 @@ export default defineConfig({ }, defineOrpcConfig({ output: 'orpc', - // fileStrategy: 'byTags', // Uncomment to split files by tag }), ], + parser: splitByTags + ? { + hooks: { + symbols: { + getFilePath: getFilePathByTag, + }, + }, + } + : undefined, }) diff --git a/web/plugins/hey-api-orpc/config.ts b/web/plugins/hey-api-orpc/config.ts index 347ee6eeb6..46d05e598a 100644 --- a/web/plugins/hey-api-orpc/config.ts +++ b/web/plugins/hey-api-orpc/config.ts @@ -14,12 +14,8 @@ export const defaultConfig: OrpcPlugin['Config'] = { resolveConfig: (plugin) => { plugin.config.output = plugin.config.output ?? 'orpc' plugin.config.exportFromIndex = plugin.config.exportFromIndex ?? false - plugin.config.groupBy = plugin.config.groupBy ?? 'tag' plugin.config.contractNameBuilder = plugin.config.contractNameBuilder ?? ((id: string) => `${id}Contract`) - plugin.config.fileStrategy = plugin.config.fileStrategy ?? 'single' - plugin.config.filePathBuilder = plugin.config.filePathBuilder - ?? ((tag: string) => `orpc/${tag.toLowerCase()}`) plugin.config.defaultTag = plugin.config.defaultTag ?? 'default' }, } diff --git a/web/plugins/hey-api-orpc/plugin.ts b/web/plugins/hey-api-orpc/plugin.ts index 459b08e4c1..3c2e25704d 100644 --- a/web/plugins/hey-api-orpc/plugin.ts +++ b/web/plugins/hey-api-orpc/plugin.ts @@ -73,10 +73,6 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { const { contractNameBuilder, defaultTag, - filePathBuilder, - fileStrategy, - groupBy, - output, } = plugin.config const operations: OperationInfo[] = [] @@ -87,22 +83,6 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { operations.push(info) }) - // Helper to get file path for a tag - const getFilePathForTag = (tag: string) => { - if (fileStrategy === 'single') { - return output - } - return filePathBuilder(tag) - } - - // Get all unique tags - const allTags = new Set() - for (const op of operations) { - for (const tag of op.tags) { - allTags.add(tag) - } - } - // Register external symbols for imports const symbolOc = plugin.symbol('oc', { exported: false, @@ -110,59 +90,26 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { }) const symbolZ = plugin.external('zod.z') - // Create base contract symbol - one per file when using byTags - const baseSymbols: Record> = {} + // Create base contract symbol + const baseSymbol = plugin.symbol('base', { + exported: true, + meta: { + pluginName: 'orpc', + }, + }) - if (fileStrategy === 'byTags') { - // Create base symbol for each tag file - for (const tag of allTags) { - const filePath = getFilePathForTag(tag) - baseSymbols[tag] = plugin.symbol('base', { - exported: true, - getFilePath: () => filePath, - meta: { - category: 'schema', - tag, - }, - }) - - const baseNode = $.const(baseSymbols[tag]) - .export() - .assign( - $(symbolOc) - .attr('$route') - .call( - $.object() - .prop('inputStructure', $.literal('detailed')) - .prop('outputStructure', $.literal('detailed')), - ), - ) - plugin.node(baseNode) - } - } - else { - // Single base symbol for all operations - const baseSymbol = plugin.symbol('base', { - exported: true, - meta: { - category: 'schema', - }, - }) - baseSymbols.__default__ = baseSymbol - - const baseNode = $.const(baseSymbol) - .export() - .assign( - $(symbolOc) - .attr('$route') - .call( - $.object() - .prop('inputStructure', $.literal('detailed')) - .prop('outputStructure', $.literal('detailed')), - ), - ) - plugin.node(baseNode) - } + const baseNode = $.const(baseSymbol) + .export() + .assign( + $(symbolOc) + .attr('$route') + .call( + $.object() + .prop('inputStructure', $.literal('detailed')) + .prop('outputStructure', $.literal('detailed')), + ), + ) + plugin.node(baseNode) // Create contract for each operation // Store symbols for later use in contracts object @@ -170,26 +117,18 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { for (const op of operations) { const contractName = contractNameBuilder(op.id) - const primaryTag = op.tags[0] - const filePath = getFilePathForTag(primaryTag) const contractSymbol = plugin.symbol(contractName, { exported: true, - getFilePath: fileStrategy === 'byTags' ? () => filePath : undefined, meta: { - category: 'schema', + pluginName: 'orpc', resource: 'operation', resourceId: op.id, - tag: primaryTag, + tags: op.tags, }, }) contractSymbols[op.id] = contractSymbol - // Get the appropriate base symbol - const baseSymbol = fileStrategy === 'byTags' - ? baseSymbols[primaryTag] - : baseSymbols.__default__ - // Build the route config object with all available properties const routeConfig = $.object() .prop('path', $.literal(op.path)) @@ -235,7 +174,7 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { .call($(zodDataSymbol)) } - // .output(z.object({ status: z.literal(200), body: zodResponseSchema })) if has output (detailed outputStructure) + // .output(z.object({ body: zodResponseSchema, status: z.literal(200) })) if has output (detailed outputStructure) if (op.hasOutput) { // Reference zod response schema symbol dynamically from zod plugin const zodResponseSymbol = plugin.referenceSymbol({ @@ -285,120 +224,38 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { plugin.node(contractNode) } - // Create contracts object export (only for single file strategy) - // For byTags, each file has its own exports - if (fileStrategy === 'single') { - const contractsSymbol = plugin.symbol('contracts', { - exported: true, - meta: { - category: 'schema', - }, - }) + // Create contracts object export + const contractsSymbol = plugin.symbol('contracts', { + exported: true, + meta: { + pluginName: 'orpc', + }, + }) - if (groupBy === 'tag') { - // Group operations by tag - const operationsByTag = new Map() - for (const op of operations) { - const tag = op.tags[0] - if (!operationsByTag.has(tag)) { - operationsByTag.set(tag, []) - } - operationsByTag.get(tag)!.push(op) - } - - // Build contracts object grouped by tag - const contractsObject = $.object() - for (const [tag, tagOps] of operationsByTag) { - const tagKey = tag.charAt(0).toLowerCase() + tag.slice(1) - const tagObject = $.object() - for (const op of tagOps) { - const contractSymbol = contractSymbols[op.id] - if (contractSymbol) { - const contractName = contractNameBuilder(op.id) - tagObject.prop(contractName, $(contractSymbol)) - } - } - contractsObject.prop(tagKey, tagObject) - } - - const contractsNode = $.const(contractsSymbol) - .export() - .assign(contractsObject) - plugin.node(contractsNode) - } - else { - // Flat structure without grouping - const contractsObject = $.object() - for (const op of operations) { - const contractSymbol = contractSymbols[op.id] - if (contractSymbol) { - const contractName = contractNameBuilder(op.id) - contractsObject.prop(contractName, $(contractSymbol)) - } - } - - const contractsNode = $.const(contractsSymbol) - .export() - .assign(contractsObject) - plugin.node(contractsNode) - } - - // Create type export: export type Contracts = typeof contracts - const contractsTypeSymbol = plugin.symbol('Contracts', { - exported: true, - meta: { - category: 'type', - }, - }) - - const contractsTypeNode = $.type.alias(contractsTypeSymbol) - .export() - .type($.type.query($(contractsSymbol))) - plugin.node(contractsTypeNode) - } - else { - // For byTags strategy, create contracts object per file - for (const tag of allTags) { - const filePath = getFilePathForTag(tag) - const tagOps = operations.filter(op => op.tags[0] === tag) - - const contractsSymbol = plugin.symbol('contracts', { - exported: true, - getFilePath: () => filePath, - meta: { - category: 'schema', - tag, - }, - }) - - const contractsObject = $.object() - for (const op of tagOps) { - const contractSymbol = contractSymbols[op.id] - if (contractSymbol) { - const contractName = contractNameBuilder(op.id) - contractsObject.prop(contractName, $(contractSymbol)) - } - } - - const contractsNode = $.const(contractsSymbol) - .export() - .assign(contractsObject) - plugin.node(contractsNode) - - // Create type export per file - const contractsTypeSymbol = plugin.symbol('Contracts', { - exported: true, - getFilePath: () => filePath, - meta: { - category: 'type', - tag, - }, - }) - - const contractsTypeNode = $.type.alias(contractsTypeSymbol) - .export() - .type($.type.query($(contractsSymbol))) - plugin.node(contractsTypeNode) + const contractsObject = $.object() + for (const op of operations) { + const contractSymbol = contractSymbols[op.id] + if (contractSymbol) { + const contractName = contractNameBuilder(op.id) + contractsObject.prop(contractName, $(contractSymbol)) } } + + const contractsNode = $.const(contractsSymbol) + .export() + .assign(contractsObject) + plugin.node(contractsNode) + + // Create type export: export type Contracts = typeof contracts + const contractsTypeSymbol = plugin.symbol('Contracts', { + exported: true, + meta: { + pluginName: 'orpc', + }, + }) + + const contractsTypeNode = $.type.alias(contractsTypeSymbol) + .export() + .type($.type.query($(contractsSymbol))) + plugin.node(contractsTypeNode) } diff --git a/web/plugins/hey-api-orpc/types.ts b/web/plugins/hey-api-orpc/types.ts index 5afdd9ba65..9cf3ac69a6 100644 --- a/web/plugins/hey-api-orpc/types.ts +++ b/web/plugins/hey-api-orpc/types.ts @@ -1,10 +1,8 @@ import type { DefinePlugin } from '@hey-api/openapi-ts' -export type FileStrategy = 'single' | 'byTags' - export type Config = { name: 'orpc' } & { /** - * Name of the generated file (when fileStrategy is 'single'). + * Name of the generated file. * @default 'orpc' */ output?: string @@ -18,25 +16,6 @@ export type Config = { name: 'orpc' } & { * @default (id) => `${id}Contract` */ contractNameBuilder?: (operationId: string) => string - /** - * How to group contracts in the exported object. - * - 'tag': Group by OpenAPI tags (default) - * - 'none': Flat structure without grouping - * @default 'tag' - */ - groupBy?: 'tag' | 'none' - /** - * File generation strategy. - * - 'single': All contracts in one file (default) - * - 'byTags': One file per tag (e.g., orpc/chat.ts, orpc/files.ts) - * @default 'single' - */ - fileStrategy?: FileStrategy - /** - * Custom file path builder when fileStrategy is 'byTags'. - * @default (tag) => `orpc/${tag}` - */ - filePathBuilder?: (tag: string) => string /** * Default tag name for operations without tags. * @default 'default' @@ -49,9 +28,6 @@ export type ResolvedConfig = { output: string exportFromIndex: boolean contractNameBuilder: (operationId: string) => string - groupBy: 'tag' | 'none' - fileStrategy: FileStrategy - filePathBuilder: (tag: string) => string defaultTag: string }