diff --git a/web/gen/orpc/api/app.gen.ts b/web/gen/orpc/api/app.gen.ts new file mode 100644 index 0000000000..456b9c030a --- /dev/null +++ b/web/gen/orpc/api/app.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zGetChatAppFeedbacksData, zGetChatAppFeedbacksResponse } from '../../zod/api/app.gen' +import { base } from '../common.gen' + +/** + * 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/annotations.gen.ts b/web/gen/orpc/api/apps.gen.ts similarity index 97% rename from web/gen/orpc/annotations.gen.ts rename to web/gen/orpc/api/apps.gen.ts index 332b2513f6..8a625e134f 100644 --- a/web/gen/orpc/annotations.gen.ts +++ b/web/gen/orpc/api/apps.gen.ts @@ -2,8 +2,8 @@ import { z } from 'zod' -import { zCreateAnnotationData, zCreateAnnotationResponse, zDeleteAnnotationData, zGetAnnotationListData, zGetAnnotationListResponse, zGetInitialAnnotationReplySettingsStatusData, zGetInitialAnnotationReplySettingsStatusResponse, zInitialAnnotationReplySettingsData, zInitialAnnotationReplySettingsResponse, zUpdateAnnotationData, zUpdateAnnotationResponse } from '../zod/annotations.gen' -import { base } from './common.gen' +import { zCreateAnnotationData, zCreateAnnotationResponse, zDeleteAnnotationData, zGetAnnotationListData, zGetAnnotationListResponse, zGetInitialAnnotationReplySettingsStatusData, zGetInitialAnnotationReplySettingsStatusResponse, zInitialAnnotationReplySettingsData, zInitialAnnotationReplySettingsResponse, zUpdateAnnotationData, zUpdateAnnotationResponse } from '../../zod/api/apps.gen' +import { base } from '../common.gen' /** * Get Annotation List diff --git a/web/gen/orpc/tts.gen.ts b/web/gen/orpc/api/audio-to-text.gen.ts similarity index 53% rename from web/gen/orpc/tts.gen.ts rename to web/gen/orpc/api/audio-to-text.gen.ts index ebfa8b0c89..bb4cc2f974 100644 --- a/web/gen/orpc/tts.gen.ts +++ b/web/gen/orpc/api/audio-to-text.gen.ts @@ -2,8 +2,8 @@ import { z } from 'zod' -import { zAudioToTextData, zAudioToTextResponse, zTextToAudioChatData, zTextToAudioChatResponse } from '../zod/tts.gen' -import { base } from './common.gen' +import { zAudioToTextData, zAudioToTextResponse } from '../../zod/api/audio-to-text.gen' +import { base } from '../common.gen' /** * Speech to Text @@ -18,17 +18,3 @@ export const audioToTextContract = base.route({ 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/orpc/chat.gen.ts b/web/gen/orpc/api/chat-messages.gen.ts similarity index 58% rename from web/gen/orpc/chat.gen.ts rename to web/gen/orpc/api/chat-messages.gen.ts index a5ac0da669..91ad61ad48 100644 --- a/web/gen/orpc/chat.gen.ts +++ b/web/gen/orpc/api/chat-messages.gen.ts @@ -2,8 +2,8 @@ import { z } from 'zod' -import { zGetSuggestedQuestionsData, zGetSuggestedQuestionsResponse, zSendChatMessageData, zSendChatMessageResponse, zStopChatMessageGenerationData, zStopChatMessageGenerationResponse } from '../zod/chat.gen' -import { base } from './common.gen' +import { zSendChatMessageData, zSendChatMessageResponse, zStopChatMessageGenerationData, zStopChatMessageGenerationResponse } from '../../zod/api/chat-messages.gen' +import { base } from '../common.gen' /** * Send Chat Message @@ -32,17 +32,3 @@ export const stopChatMessageGenerationContract = base.route({ 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/api/conversations.gen.ts similarity index 67% rename from web/gen/orpc/conversations.gen.ts rename to web/gen/orpc/api/conversations.gen.ts index 61afad9fe2..c7d6d9c565 100644 --- a/web/gen/orpc/conversations.gen.ts +++ b/web/gen/orpc/api/conversations.gen.ts @@ -2,22 +2,8 @@ import { z } from 'zod' -import { zDeleteConversationData, zGetConversationHistoryData, zGetConversationHistoryResponse, zGetConversationsListData, zGetConversationsListResponse, zGetConversationVariablesData, zGetConversationVariablesResponse, zRenameConversationData, zRenameConversationResponse } from '../zod/conversations.gen' -import { base } from './common.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) })) +import { zDeleteConversationData, zGetConversationsListData, zGetConversationsListResponse, zGetConversationVariablesData, zGetConversationVariablesResponse, zRenameConversationData, zRenameConversationResponse } from '../../zod/api/conversations.gen' +import { base } from '../common.gen' /** * Get Conversations diff --git a/web/gen/orpc/files.gen.ts b/web/gen/orpc/api/files.gen.ts similarity index 94% rename from web/gen/orpc/files.gen.ts rename to web/gen/orpc/api/files.gen.ts index f37118d3b9..45f6c2453c 100644 --- a/web/gen/orpc/files.gen.ts +++ b/web/gen/orpc/api/files.gen.ts @@ -2,8 +2,8 @@ import { z } from 'zod' -import { zPreviewChatFileData, zPreviewChatFileResponse, zUploadChatFileData, zUploadChatFileResponse } from '../zod/files.gen' -import { base } from './common.gen' +import { zPreviewChatFileData, zPreviewChatFileResponse, zUploadChatFileData, zUploadChatFileResponse } from '../../zod/api/files.gen' +import { base } from '../common.gen' /** * File Upload diff --git a/web/gen/orpc/api/info.gen.ts b/web/gen/orpc/api/info.gen.ts new file mode 100644 index 0000000000..a99bf4c91a --- /dev/null +++ b/web/gen/orpc/api/info.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zGetChatAppInfoResponse } from '../../zod/api/info.gen' +import { base } from '../common.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) })) diff --git a/web/gen/orpc/api/messages.gen.ts b/web/gen/orpc/api/messages.gen.ts new file mode 100644 index 0000000000..cf70b44f7e --- /dev/null +++ b/web/gen/orpc/api/messages.gen.ts @@ -0,0 +1,48 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zGetConversationHistoryData, zGetConversationHistoryResponse, zGetSuggestedQuestionsData, zGetSuggestedQuestionsResponse, zPostChatMessageFeedbackData, zPostChatMessageFeedbackResponse } from '../../zod/api/messages.gen' +import { base } from '../common.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) })) + +/** + * 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) })) diff --git a/web/gen/orpc/api/meta.gen.ts b/web/gen/orpc/api/meta.gen.ts new file mode 100644 index 0000000000..91fc6fe1da --- /dev/null +++ b/web/gen/orpc/api/meta.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zGetChatAppMetaResponse } from '../../zod/api/meta.gen' +import { base } from '../common.gen' + +/** + * 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) })) diff --git a/web/gen/orpc/api/parameters.gen.ts b/web/gen/orpc/api/parameters.gen.ts new file mode 100644 index 0000000000..2a951b0674 --- /dev/null +++ b/web/gen/orpc/api/parameters.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zGetChatAppParametersData, zGetChatAppParametersResponse } from '../../zod/api/parameters.gen' +import { base } from '../common.gen' + +/** + * 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) })) diff --git a/web/gen/orpc/api/site.gen.ts b/web/gen/orpc/api/site.gen.ts new file mode 100644 index 0000000000..01b990146b --- /dev/null +++ b/web/gen/orpc/api/site.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zGetChatWebAppSettingsResponse } from '../../zod/api/site.gen' +import { base } from '../common.gen' + +/** + * 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/api/text-to-audio.gen.ts b/web/gen/orpc/api/text-to-audio.gen.ts new file mode 100644 index 0000000000..a8f16a60db --- /dev/null +++ b/web/gen/orpc/api/text-to-audio.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zTextToAudioChatData, zTextToAudioChatResponse } from '../../zod/api/text-to-audio.gen' +import { base } from '../common.gen' + +/** + * 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/orpc/application.gen.ts b/web/gen/orpc/application.gen.ts deleted file mode 100644 index 01cec39142..0000000000 --- a/web/gen/orpc/application.gen.ts +++ /dev/null @@ -1,62 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { z } from 'zod' - -import { zGetChatAppInfoResponse, zGetChatAppMetaResponse, zGetChatAppParametersData, zGetChatAppParametersResponse, zGetChatWebAppSettingsResponse } from '../zod/application.gen' -import { base } from './common.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/common.gen.ts b/web/gen/orpc/common.gen.ts index c54bbddad6..d26eae0d18 100644 --- a/web/gen/orpc/common.gen.ts +++ b/web/gen/orpc/common.gen.ts @@ -2,13 +2,18 @@ import { oc } from '@orpc/contract' -import { createAnnotationContract, deleteAnnotationContract, getAnnotationListContract, getInitialAnnotationReplySettingsStatusContract, initialAnnotationReplySettingsContract, updateAnnotationContract } from './annotations.gen' -import { getChatAppInfoContract, getChatAppMetaContract, getChatAppParametersContract, getChatWebAppSettingsContract } from './application.gen' -import { getSuggestedQuestionsContract, sendChatMessageContract, stopChatMessageGenerationContract } from './chat.gen' -import { deleteConversationContract, getConversationHistoryContract, getConversationsListContract, getConversationVariablesContract, renameConversationContract } from './conversations.gen' -import { getChatAppFeedbacksContract, postChatMessageFeedbackContract } from './feedback.gen' -import { previewChatFileContract, uploadChatFileContract } from './files.gen' -import { audioToTextContract, textToAudioChatContract } from './tts.gen' +import { getChatAppFeedbacksContract } from './api/app.gen' +import { createAnnotationContract, deleteAnnotationContract, getAnnotationListContract, getInitialAnnotationReplySettingsStatusContract, initialAnnotationReplySettingsContract, updateAnnotationContract } from './api/apps.gen' +import { audioToTextContract } from './api/audio-to-text.gen' +import { sendChatMessageContract, stopChatMessageGenerationContract } from './api/chat-messages.gen' +import { deleteConversationContract, getConversationsListContract, getConversationVariablesContract, renameConversationContract } from './api/conversations.gen' +import { previewChatFileContract, uploadChatFileContract } from './api/files.gen' +import { getChatAppInfoContract } from './api/info.gen' +import { getConversationHistoryContract, getSuggestedQuestionsContract, postChatMessageFeedbackContract } from './api/messages.gen' +import { getChatAppMetaContract } from './api/meta.gen' +import { getChatAppParametersContract } from './api/parameters.gen' +import { getChatWebAppSettingsContract } from './api/site.gen' +import { textToAudioChatContract } from './api/text-to-audio.gen' export const base = oc.$route({ inputStructure: 'detailed', outputStructure: 'detailed' }) diff --git a/web/gen/orpc/feedback.gen.ts b/web/gen/orpc/feedback.gen.ts deleted file mode 100644 index 92299b7586..0000000000 --- a/web/gen/orpc/feedback.gen.ts +++ /dev/null @@ -1,34 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { z } from 'zod' - -import { zGetChatAppFeedbacksData, zGetChatAppFeedbacksResponse, zPostChatMessageFeedbackData, zPostChatMessageFeedbackResponse } from '../zod/feedback.gen' -import { base } from './common.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/types/feedback.gen.ts b/web/gen/types/api/app.gen.ts similarity index 50% rename from web/gen/types/feedback.gen.ts rename to web/gen/types/api/app.gen.ts index 48b90d3a21..3cfe95f2ae 100644 --- a/web/gen/types/feedback.gen.ts +++ b/web/gen/types/api/app.gen.ts @@ -1,29 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AppFeedbacksResponse, MessageFeedbackRequest } from './schemas.gen' - -export type PostChatMessageFeedbackData = { - body: MessageFeedbackRequest - path: { - /** - * Message ID for which feedback is being provided. - */ - message_id: string - } - query?: never - url: '/messages/{message_id}/feedbacks' -} - -export type PostChatMessageFeedbackResponses = { - /** - * Operation successful. - */ - 200: { - result?: string - } -} - -export type PostChatMessageFeedbackResponse = PostChatMessageFeedbackResponses[keyof PostChatMessageFeedbackResponses] +import type { AppFeedbacksResponse } from '../models.gen' export type GetChatAppFeedbacksData = { body?: never diff --git a/web/gen/types/annotations.gen.ts b/web/gen/types/api/apps.gen.ts similarity index 98% rename from web/gen/types/annotations.gen.ts rename to web/gen/types/api/apps.gen.ts index 99c9a724ec..c6b54e3a11 100644 --- a/web/gen/types/annotations.gen.ts +++ b/web/gen/types/api/apps.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AnnotationItem, AnnotationListResponse, CreateAnnotationRequest, InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse, UpdateAnnotationRequest } from './schemas.gen' +import type { AnnotationItem, AnnotationListResponse, CreateAnnotationRequest, InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse, UpdateAnnotationRequest } from '../models.gen' export type GetAnnotationListData = { body?: never diff --git a/web/gen/types/tts.gen.ts b/web/gen/types/api/audio-to-text.gen.ts similarity index 53% rename from web/gen/types/tts.gen.ts rename to web/gen/types/api/audio-to-text.gen.ts index 2973ea1ccf..954e531d6c 100644 --- a/web/gen/types/tts.gen.ts +++ b/web/gen/types/api/audio-to-text.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AudioToTextRequest, AudioToTextResponse as AudioToTextResponse2, TextToAudioFormRequest } from './schemas.gen' +import type { AudioToTextRequest, AudioToTextResponse as AudioToTextResponse2 } from '../models.gen' export type AudioToTextData = { body: AudioToTextRequest @@ -17,19 +17,3 @@ export type AudioToTextResponses = { } export type AudioToTextResponse = AudioToTextResponses[keyof AudioToTextResponses] - -export type TextToAudioChatData = { - body: TextToAudioFormRequest - path?: never - query?: never - url: '/text-to-audio' -} - -export type TextToAudioChatResponses = { - /** - * The generated audio file. - */ - 200: Blob | File -} - -export type TextToAudioChatResponse = TextToAudioChatResponses[keyof TextToAudioChatResponses] diff --git a/web/gen/types/chat.gen.ts b/web/gen/types/api/chat-messages.gen.ts similarity index 76% rename from web/gen/types/chat.gen.ts rename to web/gen/types/api/chat-messages.gen.ts index f026323dca..c6492ac188 100644 --- a/web/gen/types/chat.gen.ts +++ b/web/gen/types/api/chat-messages.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ChatCompletionResponse, ChatRequest, ErrorResponse, SuggestedQuestionsResponse } from './schemas.gen' +import type { ChatCompletionResponse, ChatRequest, ErrorResponse } from '../models.gen' export type SendChatMessageData = { /** @@ -73,29 +73,3 @@ export type StopChatMessageGenerationResponses = { } export type StopChatMessageGenerationResponse = StopChatMessageGenerationResponses[keyof StopChatMessageGenerationResponses] - -export type GetSuggestedQuestionsData = { - body?: never - path: { - /** - * Message ID. - */ - message_id: string - } - query: { - /** - * 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. - */ - user: string - } - url: '/messages/{message_id}/suggested' -} - -export type GetSuggestedQuestionsResponses = { - /** - * Successfully retrieved suggested questions. - */ - 200: SuggestedQuestionsResponse -} - -export type GetSuggestedQuestionsResponse = GetSuggestedQuestionsResponses[keyof GetSuggestedQuestionsResponses] diff --git a/web/gen/types/conversations.gen.ts b/web/gen/types/api/conversations.gen.ts similarity index 73% rename from web/gen/types/conversations.gen.ts rename to web/gen/types/api/conversations.gen.ts index bbc3133ef5..f3e4321851 100644 --- a/web/gen/types/conversations.gen.ts +++ b/web/gen/types/api/conversations.gen.ts @@ -1,39 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ConversationHistoryResponse, ConversationListItem, ConversationRenameRequest, ConversationsListResponse, ConversationVariablesResponse, ErrorResponse } from './schemas.gen' - -export type GetConversationHistoryData = { - body?: never - path?: never - query: { - /** - * Conversation ID. - */ - conversation_id: string - /** - * 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. - */ - user: string - /** - * 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. - */ - first_id?: string - /** - * How many chat history messages to return in one request, default is 20. - */ - limit?: number - } - url: '/messages' -} - -export type GetConversationHistoryResponses = { - /** - * Successfully retrieved conversation history. - */ - 200: ConversationHistoryResponse -} - -export type GetConversationHistoryResponse = GetConversationHistoryResponses[keyof GetConversationHistoryResponses] +import type { ConversationListItem, ConversationRenameRequest, ConversationsListResponse, ConversationVariablesResponse, ErrorResponse } from '../models.gen' export type GetConversationsListData = { body?: never diff --git a/web/gen/types/files.gen.ts b/web/gen/types/api/files.gen.ts similarity index 98% rename from web/gen/types/files.gen.ts rename to web/gen/types/api/files.gen.ts index 61fc445a00..cbca255f57 100644 --- a/web/gen/types/files.gen.ts +++ b/web/gen/types/api/files.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ErrorResponse, FileUploadResponse } from './schemas.gen' +import type { ErrorResponse, FileUploadResponse } from '../models.gen' export type UploadChatFileData = { /** diff --git a/web/gen/types/api/info.gen.ts b/web/gen/types/api/info.gen.ts new file mode 100644 index 0000000000..65c2b2a6a0 --- /dev/null +++ b/web/gen/types/api/info.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AppInfoResponse } from '../models.gen' + +export type GetChatAppInfoData = { + body?: never + path?: never + query?: never + url: '/info' +} + +export type GetChatAppInfoResponses = { + /** + * Basic information of the application. + */ + 200: AppInfoResponse +} + +export type GetChatAppInfoResponse = GetChatAppInfoResponses[keyof GetChatAppInfoResponses] diff --git a/web/gen/types/api/messages.gen.ts b/web/gen/types/api/messages.gen.ts new file mode 100644 index 0000000000..39428a38bf --- /dev/null +++ b/web/gen/types/api/messages.gen.ts @@ -0,0 +1,85 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ConversationHistoryResponse, MessageFeedbackRequest, SuggestedQuestionsResponse } from '../models.gen' + +export type PostChatMessageFeedbackData = { + body: MessageFeedbackRequest + path: { + /** + * Message ID for which feedback is being provided. + */ + message_id: string + } + query?: never + url: '/messages/{message_id}/feedbacks' +} + +export type PostChatMessageFeedbackResponses = { + /** + * Operation successful. + */ + 200: { + result?: string + } +} + +export type PostChatMessageFeedbackResponse = PostChatMessageFeedbackResponses[keyof PostChatMessageFeedbackResponses] + +export type GetSuggestedQuestionsData = { + body?: never + path: { + /** + * Message ID. + */ + message_id: string + } + query: { + /** + * 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. + */ + user: string + } + url: '/messages/{message_id}/suggested' +} + +export type GetSuggestedQuestionsResponses = { + /** + * Successfully retrieved suggested questions. + */ + 200: SuggestedQuestionsResponse +} + +export type GetSuggestedQuestionsResponse = GetSuggestedQuestionsResponses[keyof GetSuggestedQuestionsResponses] + +export type GetConversationHistoryData = { + body?: never + path?: never + query: { + /** + * Conversation ID. + */ + conversation_id: string + /** + * 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. + */ + user: string + /** + * 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. + */ + first_id?: string + /** + * How many chat history messages to return in one request, default is 20. + */ + limit?: number + } + url: '/messages' +} + +export type GetConversationHistoryResponses = { + /** + * Successfully retrieved conversation history. + */ + 200: ConversationHistoryResponse +} + +export type GetConversationHistoryResponse = GetConversationHistoryResponses[keyof GetConversationHistoryResponses] diff --git a/web/gen/types/api/meta.gen.ts b/web/gen/types/api/meta.gen.ts new file mode 100644 index 0000000000..f4850a84ef --- /dev/null +++ b/web/gen/types/api/meta.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AppMetaResponse } from '../models.gen' + +export type GetChatAppMetaData = { + body?: never + path?: never + query?: never + url: '/meta' +} + +export type GetChatAppMetaResponses = { + /** + * Successfully retrieved application meta information. + */ + 200: AppMetaResponse +} + +export type GetChatAppMetaResponse = GetChatAppMetaResponses[keyof GetChatAppMetaResponses] diff --git a/web/gen/types/api/parameters.gen.ts b/web/gen/types/api/parameters.gen.ts new file mode 100644 index 0000000000..aee56e69b1 --- /dev/null +++ b/web/gen/types/api/parameters.gen.ts @@ -0,0 +1,24 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ChatAppParametersResponse } from '../models.gen' + +export type GetChatAppParametersData = { + body?: never + path?: never + query: { + /** + * User identifier, defined by the developer's rules, must be unique within the application. + */ + user: string + } + url: '/parameters' +} + +export type GetChatAppParametersResponses = { + /** + * Application parameters information. + */ + 200: ChatAppParametersResponse +} + +export type GetChatAppParametersResponse = GetChatAppParametersResponses[keyof GetChatAppParametersResponses] diff --git a/web/gen/types/api/site.gen.ts b/web/gen/types/api/site.gen.ts new file mode 100644 index 0000000000..e20fe87e28 --- /dev/null +++ b/web/gen/types/api/site.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { WebAppSettingsResponse } from '../models.gen' + +export type GetChatWebAppSettingsData = { + body?: never + path?: never + query?: never + url: '/site' +} + +export type GetChatWebAppSettingsResponses = { + /** + * WebApp settings of the application. + */ + 200: WebAppSettingsResponse +} + +export type GetChatWebAppSettingsResponse = GetChatWebAppSettingsResponses[keyof GetChatWebAppSettingsResponses] diff --git a/web/gen/types/api/text-to-audio.gen.ts b/web/gen/types/api/text-to-audio.gen.ts new file mode 100644 index 0000000000..13b4fcb820 --- /dev/null +++ b/web/gen/types/api/text-to-audio.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { TextToAudioFormRequest } from '../models.gen' + +export type TextToAudioChatData = { + body: TextToAudioFormRequest + path?: never + query?: never + url: '/text-to-audio' +} + +export type TextToAudioChatResponses = { + /** + * The generated audio file. + */ + 200: Blob | File +} + +export type TextToAudioChatResponse = TextToAudioChatResponses[keyof TextToAudioChatResponses] diff --git a/web/gen/types/application.gen.ts b/web/gen/types/application.gen.ts deleted file mode 100644 index 00ffaf0feb..0000000000 --- a/web/gen/types/application.gen.ts +++ /dev/null @@ -1,72 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { AppInfoResponse, AppMetaResponse, ChatAppParametersResponse, WebAppSettingsResponse } from './schemas.gen' - -export type GetChatAppInfoData = { - body?: never - path?: never - query?: never - url: '/info' -} - -export type GetChatAppInfoResponses = { - /** - * Basic information of the application. - */ - 200: AppInfoResponse -} - -export type GetChatAppInfoResponse = GetChatAppInfoResponses[keyof GetChatAppInfoResponses] - -export type GetChatAppParametersData = { - body?: never - path?: never - query: { - /** - * User identifier, defined by the developer's rules, must be unique within the application. - */ - user: string - } - url: '/parameters' -} - -export type GetChatAppParametersResponses = { - /** - * Application parameters information. - */ - 200: ChatAppParametersResponse -} - -export type GetChatAppParametersResponse = GetChatAppParametersResponses[keyof GetChatAppParametersResponses] - -export type GetChatAppMetaData = { - body?: never - path?: never - query?: never - url: '/meta' -} - -export type GetChatAppMetaResponses = { - /** - * Successfully retrieved application meta information. - */ - 200: AppMetaResponse -} - -export type GetChatAppMetaResponse = GetChatAppMetaResponses[keyof GetChatAppMetaResponses] - -export type GetChatWebAppSettingsData = { - body?: never - path?: never - query?: never - url: '/site' -} - -export type GetChatWebAppSettingsResponses = { - /** - * WebApp settings of the application. - */ - 200: WebAppSettingsResponse -} - -export type GetChatWebAppSettingsResponse = GetChatWebAppSettingsResponses[keyof GetChatWebAppSettingsResponses] diff --git a/web/gen/types/common.gen.ts b/web/gen/types/common.gen.ts new file mode 100644 index 0000000000..b2ac310eb6 --- /dev/null +++ b/web/gen/types/common.gen.ts @@ -0,0 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: `${string}://{api_base_url}` | (string & {}) +} diff --git a/web/gen/types/schemas.gen.ts b/web/gen/types/models.gen.ts similarity index 99% rename from web/gen/types/schemas.gen.ts rename to web/gen/types/models.gen.ts index bed1cfa417..05bbc5281c 100644 --- a/web/gen/types/schemas.gen.ts +++ b/web/gen/types/models.gen.ts @@ -1,9 +1,5 @@ // This file is auto-generated by @hey-api/openapi-ts -export type ClientOptions = { - baseUrl: `${string}://{api_base_url}` | (string & {}) -} - export type ChatRequest = { /** * User Input/Question content. diff --git a/web/gen/zod/feedback.gen.ts b/web/gen/zod/api/app.gen.ts similarity index 52% rename from web/gen/zod/feedback.gen.ts rename to web/gen/zod/api/app.gen.ts index fe15d430e3..0e9cd08451 100644 --- a/web/gen/zod/feedback.gen.ts +++ b/web/gen/zod/api/app.gen.ts @@ -2,26 +2,7 @@ import { z } from 'zod' -import { zAppFeedbacksResponse, zMessageFeedbackRequest } from './schemas.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 +import { zAppFeedbacksResponse } from '../models.gen' export const zGetChatAppFeedbacksData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/annotations.gen.ts b/web/gen/zod/api/apps.gen.ts similarity index 98% rename from web/gen/zod/annotations.gen.ts rename to web/gen/zod/api/apps.gen.ts index 2f65b34fbf..120e4afc62 100644 --- a/web/gen/zod/annotations.gen.ts +++ b/web/gen/zod/api/apps.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zAnnotationItem, zAnnotationListResponse, zCreateAnnotationRequest, zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse, zUpdateAnnotationRequest } from './schemas.gen' +import { zAnnotationItem, zAnnotationListResponse, zCreateAnnotationRequest, zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse, zUpdateAnnotationRequest } from '../models.gen' export const zGetAnnotationListData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/tts.gen.ts b/web/gen/zod/api/audio-to-text.gen.ts similarity index 51% rename from web/gen/zod/tts.gen.ts rename to web/gen/zod/api/audio-to-text.gen.ts index 6b467981a4..8b2ea2f994 100644 --- a/web/gen/zod/tts.gen.ts +++ b/web/gen/zod/api/audio-to-text.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zAudioToTextRequest, zAudioToTextResponse as zAudioToTextResponse2, zTextToAudioFormRequest } from './schemas.gen' +import { zAudioToTextRequest, zAudioToTextResponse as zAudioToTextResponse2 } from '../models.gen' export const zAudioToTextData = z.object({ body: zAudioToTextRequest, @@ -18,18 +18,3 @@ export type AudioToTextDataZodType = z.infer 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/gen/zod/chat.gen.ts b/web/gen/zod/api/chat-messages.gen.ts similarity index 67% rename from web/gen/zod/chat.gen.ts rename to web/gen/zod/api/chat-messages.gen.ts index 4c8bd1f1d7..25516c963e 100644 --- a/web/gen/zod/chat.gen.ts +++ b/web/gen/zod/api/chat-messages.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zChatCompletionResponse, zChatRequest, zSuggestedQuestionsResponse } from './schemas.gen' +import { zChatCompletionResponse, zChatRequest } from '../models.gen' export const zSendChatMessageData = z.object({ body: zChatRequest, @@ -41,22 +41,3 @@ export const zStopChatMessageGenerationResponse = z.object({ }).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/api/conversations.gen.ts similarity index 72% rename from web/gen/zod/conversations.gen.ts rename to web/gen/zod/api/conversations.gen.ts index 7af8c08c34..65e6cf19ba 100644 --- a/web/gen/zod/conversations.gen.ts +++ b/web/gen/zod/api/conversations.gen.ts @@ -2,27 +2,7 @@ import { z } from 'zod' -import { zConversationHistoryResponse, zConversationListItem, zConversationRenameRequest, zConversationsListResponse, zConversationVariablesResponse } from './schemas.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 +import { zConversationListItem, zConversationRenameRequest, zConversationsListResponse, zConversationVariablesResponse } from '../models.gen' export const zGetConversationsListData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/files.gen.ts b/web/gen/zod/api/files.gen.ts similarity index 97% rename from web/gen/zod/files.gen.ts rename to web/gen/zod/api/files.gen.ts index 1521085fff..d4eec4ece0 100644 --- a/web/gen/zod/files.gen.ts +++ b/web/gen/zod/api/files.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zFileUploadResponse } from './schemas.gen' +import { zFileUploadResponse } from '../models.gen' export const zUploadChatFileData = z.object({ body: z.object({ diff --git a/web/gen/zod/api/info.gen.ts b/web/gen/zod/api/info.gen.ts new file mode 100644 index 0000000000..52563fd1e9 --- /dev/null +++ b/web/gen/zod/api/info.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAppInfoResponse } from '../models.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 diff --git a/web/gen/zod/api/messages.gen.ts b/web/gen/zod/api/messages.gen.ts new file mode 100644 index 0000000000..f381399c4c --- /dev/null +++ b/web/gen/zod/api/messages.gen.ts @@ -0,0 +1,63 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zConversationHistoryResponse, zMessageFeedbackRequest, zSuggestedQuestionsResponse } from '../models.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 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 diff --git a/web/gen/zod/api/meta.gen.ts b/web/gen/zod/api/meta.gen.ts new file mode 100644 index 0000000000..31db10d90a --- /dev/null +++ b/web/gen/zod/api/meta.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAppMetaResponse } from '../models.gen' + +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 diff --git a/web/gen/zod/api/parameters.gen.ts b/web/gen/zod/api/parameters.gen.ts new file mode 100644 index 0000000000..3e4d26319c --- /dev/null +++ b/web/gen/zod/api/parameters.gen.ts @@ -0,0 +1,22 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zChatAppParametersResponse } from '../models.gen' + +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 diff --git a/web/gen/zod/api/site.gen.ts b/web/gen/zod/api/site.gen.ts new file mode 100644 index 0000000000..11e2cff3d8 --- /dev/null +++ b/web/gen/zod/api/site.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zWebAppSettingsResponse } from '../models.gen' + +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/api/text-to-audio.gen.ts b/web/gen/zod/api/text-to-audio.gen.ts new file mode 100644 index 0000000000..e4a2d1c4cf --- /dev/null +++ b/web/gen/zod/api/text-to-audio.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zTextToAudioFormRequest } from '../models.gen' + +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/gen/zod/application.gen.ts b/web/gen/zod/application.gen.ts deleted file mode 100644 index 2a666081a5..0000000000 --- a/web/gen/zod/application.gen.ts +++ /dev/null @@ -1,67 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { z } from 'zod' - -import { zAppInfoResponse, zAppMetaResponse, zChatAppParametersResponse, zWebAppSettingsResponse } from './schemas.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/schemas.gen.ts b/web/gen/zod/models.gen.ts similarity index 100% rename from web/gen/zod/schemas.gen.ts rename to web/gen/zod/models.gen.ts diff --git a/web/openapi-ts.config.ts b/web/openapi-ts.config.ts index 3deefe9c76..e3c0605a97 100644 --- a/web/openapi-ts.config.ts +++ b/web/openapi-ts.config.ts @@ -2,39 +2,65 @@ 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 = { +type SymbolMeta = Record & { tags?: readonly string[] tool?: string resource?: string pluginName?: string + path?: readonly (string | number)[] } -// Get file path based on symbol metadata -function getFilePathByTag(symbol: { meta?: SymbolMeta }): string | undefined { +// Extract API path segment from OpenAPI path array +// e.g., ["paths", "/chat-messages", "post"] → "chat-messages" +// e.g., ["paths", "/files/upload", "post"] → "files" +function getApiSegment(path: readonly (string | number)[] | undefined): string | undefined { + if (!path || path[0] !== 'paths') + return undefined + const apiPath = path[1] // e.g., "/chat-messages" or "/files/upload" + if (typeof apiPath !== 'string') + return undefined + // Get first segment after leading slash + return apiPath.split('/').filter(Boolean)[0] +} + +// Get file path based on symbol metadata (mixed strategy) +function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined { const meta = symbol.meta if (!meta) return undefined - // Get the first tag from symbol metadata, fallback to 'schemas' for definitions - const tag = meta.tags?.[0]?.toLowerCase() - // Handle typescript plugin symbols if (meta.tool === 'typescript') { - return `types/${tag ?? 'schemas'}` + if (meta.resource === 'definition') { + return 'types/models' + } + if (meta.resource === 'operation') { + const segment = getApiSegment(meta.path) + return `types/api/${segment ?? 'common'}` + } + return 'types/common' } // Handle zod plugin symbols if (meta.tool === 'zod') { - return `zod/${tag ?? 'schemas'}` + if (meta.resource === 'definition') { + return 'zod/models' + } + if (meta.resource === 'operation') { + const segment = getApiSegment(meta.path) + return `zod/api/${segment ?? 'common'}` + } + return 'zod/common' } // Handle orpc plugin symbols if (meta.pluginName === 'orpc') { - return `orpc/${tag ?? 'common'}` + if (meta.resource === 'operation') { + const segment = getApiSegment(meta.path) + return `orpc/api/${segment ?? 'common'}` + } + return 'orpc/common' } return undefined @@ -62,13 +88,11 @@ export default defineConfig({ output: 'orpc', }), ], - parser: splitByTags - ? { - hooks: { - symbols: { - getFilePath: getFilePathByTag, - }, - }, - } - : undefined, + parser: { + hooks: { + symbols: { + getFilePath, + }, + }, + }, }) diff --git a/web/plugins/hey-api-orpc/plugin.ts b/web/plugins/hey-api-orpc/plugin.ts index 3c2e25704d..9d45c865ed 100644 --- a/web/plugins/hey-api-orpc/plugin.ts +++ b/web/plugins/hey-api-orpc/plugin.ts @@ -121,6 +121,7 @@ export const handler: OrpcPlugin['Handler'] = ({ plugin }) => { const contractSymbol = plugin.symbol(contractName, { exported: true, meta: { + path: ['paths', op.path, op.method.toLowerCase()], pluginName: 'orpc', resource: 'operation', resourceId: op.id,