diff --git a/web/gen/types.gen.ts b/web/gen/types.gen.ts index bd15f98fab..bed1cfa417 100644 --- a/web/gen/types.gen.ts +++ b/web/gen/types.gen.ts @@ -719,649 +719,3 @@ export type ErrorResponse = { code?: string message?: string } - -export type SendChatMessageData = { - /** - * Request body to send a chat message. - */ - body: ChatRequest - path?: never - query?: never - url: '/chat-messages' -} - -export type SendChatMessageErrors = { - /** - * Bad Request. Possible error codes: - * - `invalid_param`: Abnormal parameter input. - * - `app_unavailable`: App configuration unavailable. - * - `provider_not_initialize`: No available model credential configuration. - * - `provider_quota_exceeded`: Model invocation quota insufficient. - * - `model_currently_not_support`: Current model unavailable. - * - `completion_request_error`: Text generation failed. - */ - 400: ErrorResponse - /** - * Conversation does not exist. - */ - 404: ErrorResponse - /** - * Internal server error. - */ - 500: ErrorResponse -} - -export type SendChatMessageError = SendChatMessageErrors[keyof SendChatMessageErrors] - -export type SendChatMessageResponses = { - /** - * 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. - */ - 200: ChatCompletionResponse -} - -export type SendChatMessageResponse = SendChatMessageResponses[keyof SendChatMessageResponses] - -export type UploadChatFileData = { - /** - * File upload request. Requires multipart/form-data. - */ - body: { - /** - * The file to be uploaded. Supported image types: png, jpg, jpeg, webp, gif. - */ - file: Blob | File - /** - * 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. - */ - user: string - } - path?: never - query?: never - url: '/files/upload' -} - -export type UploadChatFileErrors = { - /** - * Bad Request for file operations. Possible error codes: - * - `no_file_uploaded`: A file must be provided. - * - `too_many_files`: Currently only one file is accepted. - * - `unsupported_preview`: The file does not support preview. - * - `unsupported_estimate`: The file does not support estimation. - */ - 400: ErrorResponse - /** - * `file_too_large`: The file is too large. - */ - 413: ErrorResponse - /** - * `unsupported_file_type`: Unsupported extension. (Note: The description for `/files/upload` lists image types, while this generic error mentions document files. This might indicate a context-specific message from the backend). - */ - 415: ErrorResponse - /** - * Internal server error. - */ - 500: ErrorResponse - /** - * Service Unavailable for S3 operations. Possible error codes: - * - `s3_connection_failed`: Unable to connect to S3 service. - * - `s3_permission_denied`: No permission to upload files to S3. - * - `s3_file_too_large`: File exceeds S3 size limit. - */ - 503: ErrorResponse -} - -export type UploadChatFileError = UploadChatFileErrors[keyof UploadChatFileErrors] - -export type UploadChatFileResponses = { - /** - * File uploaded successfully. - */ - 200: FileUploadResponse -} - -export type UploadChatFileResponse = UploadChatFileResponses[keyof UploadChatFileResponses] - -export type PreviewChatFileData = { - body?: never - path: { - /** - * The unique identifier of the file to preview, obtained from the File Upload API response. - */ - file_id: string - } - query?: { - /** - * Whether to force download the file as an attachment. Default is `false` (preview in browser). - */ - as_attachment?: boolean - } - url: '/files/{file_id}/preview' -} - -export type PreviewChatFileErrors = { - /** - * Bad Request. Possible error codes: - * - `invalid_param`: Abnormal parameter input. - */ - 400: ErrorResponse - /** - * Forbidden. Possible error codes: - * - `file_access_denied`: File access denied or file does not belong to current application. - */ - 403: ErrorResponse - /** - * Not Found. Possible error codes: - * - `file_not_found`: File not found or has been deleted. - */ - 404: ErrorResponse - /** - * Internal server error. - */ - 500: ErrorResponse -} - -export type PreviewChatFileError = PreviewChatFileErrors[keyof PreviewChatFileErrors] - -export type PreviewChatFileResponses = { - /** - * File content returned successfully. Headers set based on file type and request parameters. - */ - 200: Blob | File -} - -export type PreviewChatFileResponse = PreviewChatFileResponses[keyof PreviewChatFileResponses] - -export type StopChatMessageGenerationData = { - body: { - /** - * 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. - */ - user: string - } - path: { - /** - * Task ID, can be obtained from the streaming chunk return of a `/chat-messages` request. - */ - task_id: string - } - query?: never - url: '/chat-messages/{task_id}/stop' -} - -export type StopChatMessageGenerationResponses = { - /** - * Operation successful. - */ - 200: { - result?: string - } -} - -export type StopChatMessageGenerationResponse = StopChatMessageGenerationResponses[keyof StopChatMessageGenerationResponses] - -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 GetChatAppFeedbacksData = { - body?: never - path?: never - query?: { - /** - * (optional) Pagination page number. Default: 1 - */ - page?: number - /** - * (optional) Records per page. Default: 20 - */ - limit?: number - } - url: '/app/feedbacks' -} - -export type GetChatAppFeedbacksResponses = { - /** - * A list of application feedbacks. - */ - 200: AppFeedbacksResponse -} - -export type GetChatAppFeedbacksResponse = GetChatAppFeedbacksResponses[keyof GetChatAppFeedbacksResponses] - -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] - -export type GetConversationsListData = { - body?: never - path?: never - 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 - /** - * (Optional) The ID of the last record on the current page (for pagination). - */ - last_id?: string - /** - * (Optional) How many records to return. Default 20, Min 1, Max 100. - */ - limit?: number - /** - * Sorting Field. Default: -updated_at. '-' prefix for descending. - */ - sort_by?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at' - } - url: '/conversations' -} - -export type GetConversationsListResponses = { - /** - * Successfully retrieved conversations list. - */ - 200: ConversationsListResponse -} - -export type GetConversationsListResponse = GetConversationsListResponses[keyof GetConversationsListResponses] - -export type DeleteConversationData = { - body: { - /** - * 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. - */ - user: string - } - path: { - /** - * Conversation ID. - */ - conversation_id: string - } - query?: never - url: '/conversations/{conversation_id}' -} - -export type DeleteConversationResponses = { - /** - * Conversation deleted successfully. No Content. - */ - 204: void -} - -export type DeleteConversationResponse = DeleteConversationResponses[keyof DeleteConversationResponses] - -export type RenameConversationData = { - body: ConversationRenameRequest - path: { - /** - * Conversation ID. - */ - conversation_id: string - } - query?: never - url: '/conversations/{conversation_id}/name' -} - -export type RenameConversationResponses = { - /** - * Conversation renamed successfully. - */ - 200: ConversationListItem -} - -export type RenameConversationResponse = RenameConversationResponses[keyof RenameConversationResponses] - -export type GetConversationVariablesData = { - body?: never - path: { - /** - * The ID of the conversation to retrieve variables from. - */ - conversation_id: string - } - query: { - /** - * The user identifier. - */ - user: string - /** - * (Optional) The ID of the last record on the current page (for pagination). - */ - last_id?: string - /** - * (Optional) How many records to return. Default 20, Min 1, Max 100. - */ - limit?: number - /** - * (Optional) Filter variables by a specific name. - */ - variable_name?: string - } - url: '/conversations/{conversation_id}/variables' -} - -export type GetConversationVariablesErrors = { - /** - * Conversation not found. Error code: `conversation_not_exists` - */ - 404: ErrorResponse -} - -export type GetConversationVariablesError = GetConversationVariablesErrors[keyof GetConversationVariablesErrors] - -export type GetConversationVariablesResponses = { - /** - * Successfully retrieved conversation variables. - */ - 200: ConversationVariablesResponse -} - -export type GetConversationVariablesResponse = GetConversationVariablesResponses[keyof GetConversationVariablesResponses] - -export type AudioToTextData = { - body: AudioToTextRequest - path?: never - query?: never - url: '/audio-to-text' -} - -export type AudioToTextResponses = { - /** - * Successfully converted audio to text. - */ - 200: AudioToTextResponse -} - -export type AudioToTextResponse2 = 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] - -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] - -export type GetAnnotationListData = { - body?: never - path?: never - query?: { - /** - * Page number. - */ - page?: number - /** - * Number of items returned, default 20, range 1-100. - */ - limit?: number - } - url: '/apps/annotations' -} - -export type GetAnnotationListResponses = { - /** - * Successfully retrieved annotation list. - */ - 200: AnnotationListResponse -} - -export type GetAnnotationListResponse = GetAnnotationListResponses[keyof GetAnnotationListResponses] - -export type CreateAnnotationData = { - body: CreateAnnotationRequest - path?: never - query?: never - url: '/apps/annotations' -} - -export type CreateAnnotationResponses = { - /** - * Annotation created successfully. - */ - 200: AnnotationItem -} - -export type CreateAnnotationResponse = CreateAnnotationResponses[keyof CreateAnnotationResponses] - -export type DeleteAnnotationData = { - body?: never - path: { - /** - * Annotation ID. - */ - annotation_id: string - } - query?: never - url: '/apps/annotations/{annotation_id}' -} - -export type DeleteAnnotationResponses = { - /** - * Annotation deleted successfully. No Content. - */ - 204: void -} - -export type DeleteAnnotationResponse = DeleteAnnotationResponses[keyof DeleteAnnotationResponses] - -export type UpdateAnnotationData = { - body: UpdateAnnotationRequest - path: { - /** - * Annotation ID. - */ - annotation_id: string - } - query?: never - url: '/apps/annotations/{annotation_id}' -} - -export type UpdateAnnotationResponses = { - /** - * Annotation updated successfully. - */ - 200: AnnotationItem -} - -export type UpdateAnnotationResponse = UpdateAnnotationResponses[keyof UpdateAnnotationResponses] - -export type InitialAnnotationReplySettingsData = { - body: InitialAnnotationReplySettingsRequest - path: { - /** - * Action, can only be 'enable' or 'disable'. - */ - action: 'enable' | 'disable' - } - query?: never - url: '/apps/annotation-reply/{action}' -} - -export type InitialAnnotationReplySettingsResponses = { - /** - * Annotation reply settings task initiated. - */ - 200: InitialAnnotationReplySettingsResponse -} - -export type InitialAnnotationReplySettingsResponse2 = InitialAnnotationReplySettingsResponses[keyof InitialAnnotationReplySettingsResponses] - -export type GetInitialAnnotationReplySettingsStatusData = { - body?: never - path: { - /** - * Action, must be the same as in the initial settings call ('enable' or 'disable'). - */ - action: 'enable' | 'disable' - /** - * Job ID obtained from the initial settings call. - */ - job_id: string - } - query?: never - url: '/apps/annotation-reply/{action}/status/{job_id}' -} - -export type GetInitialAnnotationReplySettingsStatusResponses = { - /** - * Successfully retrieved task status. - */ - 200: InitialAnnotationReplySettingsStatusResponse -} - -export type GetInitialAnnotationReplySettingsStatusResponse = GetInitialAnnotationReplySettingsStatusResponses[keyof GetInitialAnnotationReplySettingsStatusResponses] diff --git a/web/gen/types/annotations.gen.ts b/web/gen/types/annotations.gen.ts new file mode 100644 index 0000000000..2e30b1c739 --- /dev/null +++ b/web/gen/types/annotations.gen.ts @@ -0,0 +1,132 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AnnotationItem, AnnotationListResponse, CreateAnnotationRequest, InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse, UpdateAnnotationRequest } from '../types.gen' + +export type GetAnnotationListData = { + body?: never + path?: never + query?: { + /** + * Page number. + */ + page?: number + /** + * Number of items returned, default 20, range 1-100. + */ + limit?: number + } + url: '/apps/annotations' +} + +export type GetAnnotationListResponses = { + /** + * Successfully retrieved annotation list. + */ + 200: AnnotationListResponse +} + +export type GetAnnotationListResponse = GetAnnotationListResponses[keyof GetAnnotationListResponses] + +export type CreateAnnotationData = { + body: CreateAnnotationRequest + path?: never + query?: never + url: '/apps/annotations' +} + +export type CreateAnnotationResponses = { + /** + * Annotation created successfully. + */ + 200: AnnotationItem +} + +export type CreateAnnotationResponse = CreateAnnotationResponses[keyof CreateAnnotationResponses] + +export type DeleteAnnotationData = { + body?: never + path: { + /** + * Annotation ID. + */ + annotation_id: string + } + query?: never + url: '/apps/annotations/{annotation_id}' +} + +export type DeleteAnnotationResponses = { + /** + * Annotation deleted successfully. No Content. + */ + 204: void +} + +export type DeleteAnnotationResponse = DeleteAnnotationResponses[keyof DeleteAnnotationResponses] + +export type UpdateAnnotationData = { + body: UpdateAnnotationRequest + path: { + /** + * Annotation ID. + */ + annotation_id: string + } + query?: never + url: '/apps/annotations/{annotation_id}' +} + +export type UpdateAnnotationResponses = { + /** + * Annotation updated successfully. + */ + 200: AnnotationItem +} + +export type UpdateAnnotationResponse = UpdateAnnotationResponses[keyof UpdateAnnotationResponses] + +export type InitialAnnotationReplySettingsData = { + body: InitialAnnotationReplySettingsRequest + path: { + /** + * Action, can only be 'enable' or 'disable'. + */ + action: 'enable' | 'disable' + } + query?: never + url: '/apps/annotation-reply/{action}' +} + +export type InitialAnnotationReplySettingsResponses = { + /** + * Annotation reply settings task initiated. + */ + 200: InitialAnnotationReplySettingsResponse2 +} + +export type InitialAnnotationReplySettingsResponse = InitialAnnotationReplySettingsResponses[keyof InitialAnnotationReplySettingsResponses] + +export type GetInitialAnnotationReplySettingsStatusData = { + body?: never + path: { + /** + * Action, must be the same as in the initial settings call ('enable' or 'disable'). + */ + action: 'enable' | 'disable' + /** + * Job ID obtained from the initial settings call. + */ + job_id: string + } + query?: never + url: '/apps/annotation-reply/{action}/status/{job_id}' +} + +export type GetInitialAnnotationReplySettingsStatusResponses = { + /** + * Successfully retrieved task status. + */ + 200: InitialAnnotationReplySettingsStatusResponse +} + +export type GetInitialAnnotationReplySettingsStatusResponse = GetInitialAnnotationReplySettingsStatusResponses[keyof GetInitialAnnotationReplySettingsStatusResponses] diff --git a/web/gen/types/application.gen.ts b/web/gen/types/application.gen.ts new file mode 100644 index 0000000000..0a1ea2e2ad --- /dev/null +++ b/web/gen/types/application.gen.ts @@ -0,0 +1,72 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AppInfoResponse, AppMetaResponse, ChatAppParametersResponse, WebAppSettingsResponse } from '../types.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/chat.gen.ts b/web/gen/types/chat.gen.ts new file mode 100644 index 0000000000..7ebe33640e --- /dev/null +++ b/web/gen/types/chat.gen.ts @@ -0,0 +1,101 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ChatCompletionResponse, ChatRequest, ErrorResponse, SuggestedQuestionsResponse } from '../types.gen' + +export type SendChatMessageData = { + /** + * Request body to send a chat message. + */ + body: ChatRequest + path?: never + query?: never + url: '/chat-messages' +} + +export type SendChatMessageErrors = { + /** + * Bad Request. Possible error codes: + * - `invalid_param`: Abnormal parameter input. + * - `app_unavailable`: App configuration unavailable. + * - `provider_not_initialize`: No available model credential configuration. + * - `provider_quota_exceeded`: Model invocation quota insufficient. + * - `model_currently_not_support`: Current model unavailable. + * - `completion_request_error`: Text generation failed. + */ + 400: ErrorResponse + /** + * Conversation does not exist. + */ + 404: ErrorResponse + /** + * Internal server error. + */ + 500: ErrorResponse +} + +export type SendChatMessageError = SendChatMessageErrors[keyof SendChatMessageErrors] + +export type SendChatMessageResponses = { + /** + * 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. + */ + 200: ChatCompletionResponse +} + +export type SendChatMessageResponse = SendChatMessageResponses[keyof SendChatMessageResponses] + +export type StopChatMessageGenerationData = { + body: { + /** + * 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. + */ + user: string + } + path: { + /** + * Task ID, can be obtained from the streaming chunk return of a `/chat-messages` request. + */ + task_id: string + } + query?: never + url: '/chat-messages/{task_id}/stop' +} + +export type StopChatMessageGenerationResponses = { + /** + * Operation successful. + */ + 200: { + result?: string + } +} + +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/conversations.gen.ts new file mode 100644 index 0000000000..1772822ba3 --- /dev/null +++ b/web/gen/types/conversations.gen.ts @@ -0,0 +1,163 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ConversationHistoryResponse, ConversationListItem, ConversationRenameRequest, ConversationsListResponse, ConversationVariablesResponse, ErrorResponse } from '../types.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] + +export type GetConversationsListData = { + body?: never + path?: never + 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 + /** + * (Optional) The ID of the last record on the current page (for pagination). + */ + last_id?: string + /** + * (Optional) How many records to return. Default 20, Min 1, Max 100. + */ + limit?: number + /** + * Sorting Field. Default: -updated_at. '-' prefix for descending. + */ + sort_by?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at' + } + url: '/conversations' +} + +export type GetConversationsListResponses = { + /** + * Successfully retrieved conversations list. + */ + 200: ConversationsListResponse +} + +export type GetConversationsListResponse = GetConversationsListResponses[keyof GetConversationsListResponses] + +export type DeleteConversationData = { + body: { + /** + * 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. + */ + user: string + } + path: { + /** + * Conversation ID. + */ + conversation_id: string + } + query?: never + url: '/conversations/{conversation_id}' +} + +export type DeleteConversationResponses = { + /** + * Conversation deleted successfully. No Content. + */ + 204: void +} + +export type DeleteConversationResponse = DeleteConversationResponses[keyof DeleteConversationResponses] + +export type RenameConversationData = { + body: ConversationRenameRequest + path: { + /** + * Conversation ID. + */ + conversation_id: string + } + query?: never + url: '/conversations/{conversation_id}/name' +} + +export type RenameConversationResponses = { + /** + * Conversation renamed successfully. + */ + 200: ConversationListItem +} + +export type RenameConversationResponse = RenameConversationResponses[keyof RenameConversationResponses] + +export type GetConversationVariablesData = { + body?: never + path: { + /** + * The ID of the conversation to retrieve variables from. + */ + conversation_id: string + } + query: { + /** + * The user identifier. + */ + user: string + /** + * (Optional) The ID of the last record on the current page (for pagination). + */ + last_id?: string + /** + * (Optional) How many records to return. Default 20, Min 1, Max 100. + */ + limit?: number + /** + * (Optional) Filter variables by a specific name. + */ + variable_name?: string + } + url: '/conversations/{conversation_id}/variables' +} + +export type GetConversationVariablesErrors = { + /** + * Conversation not found. Error code: `conversation_not_exists` + */ + 404: ErrorResponse +} + +export type GetConversationVariablesError = GetConversationVariablesErrors[keyof GetConversationVariablesErrors] + +export type GetConversationVariablesResponses = { + /** + * Successfully retrieved conversation variables. + */ + 200: ConversationVariablesResponse +} + +export type GetConversationVariablesResponse = GetConversationVariablesResponses[keyof GetConversationVariablesResponses] diff --git a/web/gen/types/feedback.gen.ts b/web/gen/types/feedback.gen.ts new file mode 100644 index 0000000000..bd5877c914 --- /dev/null +++ b/web/gen/types/feedback.gen.ts @@ -0,0 +1,51 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AppFeedbacksResponse, MessageFeedbackRequest } from '../types.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 GetChatAppFeedbacksData = { + body?: never + path?: never + query?: { + /** + * (optional) Pagination page number. Default: 1 + */ + page?: number + /** + * (optional) Records per page. Default: 20 + */ + limit?: number + } + url: '/app/feedbacks' +} + +export type GetChatAppFeedbacksResponses = { + /** + * A list of application feedbacks. + */ + 200: AppFeedbacksResponse +} + +export type GetChatAppFeedbacksResponse = GetChatAppFeedbacksResponses[keyof GetChatAppFeedbacksResponses] diff --git a/web/gen/types/files.gen.ts b/web/gen/types/files.gen.ts new file mode 100644 index 0000000000..17581c0c08 --- /dev/null +++ b/web/gen/types/files.gen.ts @@ -0,0 +1,113 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ErrorResponse, FileUploadResponse } from '../types.gen' + +export type UploadChatFileData = { + /** + * File upload request. Requires multipart/form-data. + */ + body: { + /** + * The file to be uploaded. Supported image types: png, jpg, jpeg, webp, gif. + */ + file: Blob | File + /** + * 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. + */ + user: string + } + path?: never + query?: never + url: '/files/upload' +} + +export type UploadChatFileErrors = { + /** + * Bad Request for file operations. Possible error codes: + * - `no_file_uploaded`: A file must be provided. + * - `too_many_files`: Currently only one file is accepted. + * - `unsupported_preview`: The file does not support preview. + * - `unsupported_estimate`: The file does not support estimation. + */ + 400: ErrorResponse + /** + * `file_too_large`: The file is too large. + */ + 413: ErrorResponse + /** + * `unsupported_file_type`: Unsupported extension. (Note: The description for `/files/upload` lists image types, while this generic error mentions document files. This might indicate a context-specific message from the backend). + */ + 415: ErrorResponse + /** + * Internal server error. + */ + 500: ErrorResponse + /** + * Service Unavailable for S3 operations. Possible error codes: + * - `s3_connection_failed`: Unable to connect to S3 service. + * - `s3_permission_denied`: No permission to upload files to S3. + * - `s3_file_too_large`: File exceeds S3 size limit. + */ + 503: ErrorResponse +} + +export type UploadChatFileError = UploadChatFileErrors[keyof UploadChatFileErrors] + +export type UploadChatFileResponses = { + /** + * File uploaded successfully. + */ + 200: FileUploadResponse +} + +export type UploadChatFileResponse = UploadChatFileResponses[keyof UploadChatFileResponses] + +export type PreviewChatFileData = { + body?: never + path: { + /** + * The unique identifier of the file to preview, obtained from the File Upload API response. + */ + file_id: string + } + query?: { + /** + * Whether to force download the file as an attachment. Default is `false` (preview in browser). + */ + as_attachment?: boolean + } + url: '/files/{file_id}/preview' +} + +export type PreviewChatFileErrors = { + /** + * Bad Request. Possible error codes: + * - `invalid_param`: Abnormal parameter input. + */ + 400: ErrorResponse + /** + * Forbidden. Possible error codes: + * - `file_access_denied`: File access denied or file does not belong to current application. + */ + 403: ErrorResponse + /** + * Not Found. Possible error codes: + * - `file_not_found`: File not found or has been deleted. + */ + 404: ErrorResponse + /** + * Internal server error. + */ + 500: ErrorResponse +} + +export type PreviewChatFileError = PreviewChatFileErrors[keyof PreviewChatFileErrors] + +export type PreviewChatFileResponses = { + /** + * File content returned successfully. Headers set based on file type and request parameters. + */ + 200: Blob | File +} + +export type PreviewChatFileResponse = PreviewChatFileResponses[keyof PreviewChatFileResponses] diff --git a/web/gen/types/tts.gen.ts b/web/gen/types/tts.gen.ts new file mode 100644 index 0000000000..d8d21a0442 --- /dev/null +++ b/web/gen/types/tts.gen.ts @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AudioToTextRequest, AudioToTextResponse as AudioToTextResponse2, TextToAudioFormRequest } from '../types.gen' + +export type AudioToTextData = { + body: AudioToTextRequest + path?: never + query?: never + url: '/audio-to-text' +} + +export type AudioToTextResponses = { + /** + * Successfully converted audio to text. + */ + 200: AudioToTextResponse2 +} + +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/openapi-ts.config.ts b/web/openapi-ts.config.ts index 40882d4e31..fe31348cc1 100644 --- a/web/openapi-ts.config.ts +++ b/web/openapi-ts.config.ts @@ -25,6 +25,16 @@ function getFilePathByTag(symbol: { meta?: SymbolMeta }): string | undefined { if (!tag) return undefined + // Handle typescript plugin symbols + if (meta.tool === 'typescript') { + // Only split operation-related types (data/responses), not definitions + if (meta.resource === 'operation') { + return `types/${tag}` + } + // Keep definitions in the main types file + return undefined + } + // Handle zod plugin symbols if (meta.tool === 'zod') { // Only split operation-related schemas (requests/responses), not definitions