From bc451416d143dc778d953e1617c803cf4580519e Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Sun, 25 Jan 2026 16:03:31 +0800 Subject: [PATCH] split more --- web/gen/types/api/app.gen.ts | 2 +- web/gen/types/api/apps.gen.ts | 5 +- web/gen/types/api/audio-to-text.gen.ts | 2 +- web/gen/types/api/chat-messages.gen.ts | 3 +- web/gen/types/api/conversations.gen.ts | 4 +- web/gen/types/api/files.gen.ts | 3 +- web/gen/types/api/info.gen.ts | 2 +- web/gen/types/api/messages.gen.ts | 4 +- web/gen/types/api/meta.gen.ts | 2 +- web/gen/types/api/parameters.gen.ts | 2 +- web/gen/types/api/site.gen.ts | 2 +- web/gen/types/api/text-to-audio.gen.ts | 2 +- web/gen/types/models.gen.ts | 717 ---------------------- web/gen/types/models/agent.gen.ts | 40 ++ web/gen/types/models/annotation.gen.ts | 17 + web/gen/types/models/app.gen.ts | 23 + web/gen/types/models/audio.gen.ts | 19 + web/gen/types/models/chat.gen.ts | 119 ++++ web/gen/types/models/chunk.gen.ts | 11 + web/gen/types/models/conversation.gen.ts | 100 +++ web/gen/types/models/conversations.gen.ts | 9 + web/gen/types/models/create.gen.ts | 6 + web/gen/types/models/error.gen.ts | 7 + web/gen/types/models/feedback.gen.ts | 15 + web/gen/types/models/file.gen.ts | 11 + web/gen/types/models/initial.gen.ts | 27 + web/gen/types/models/input.gen.ts | 26 + web/gen/types/models/message.gen.ts | 23 + web/gen/types/models/paragraph.gen.ts | 12 + web/gen/types/models/retriever.gen.ts | 39 ++ web/gen/types/models/select.gen.ts | 13 + web/gen/types/models/stream.gen.ts | 149 +++++ web/gen/types/models/suggested.gen.ts | 6 + web/gen/types/models/text.gen.ts | 30 + web/gen/types/models/tool.gen.ts | 12 + web/gen/types/models/update.gen.ts | 6 + web/gen/types/models/usage.gen.ts | 19 + web/gen/types/models/user.gen.ts | 7 + web/gen/types/models/web.gen.ts | 18 + web/gen/zod/api/app.gen.ts | 2 +- web/gen/zod/api/apps.gen.ts | 5 +- web/gen/zod/api/audio-to-text.gen.ts | 2 +- web/gen/zod/api/chat-messages.gen.ts | 2 +- web/gen/zod/api/conversations.gen.ts | 3 +- web/gen/zod/api/files.gen.ts | 2 +- web/gen/zod/api/info.gen.ts | 2 +- web/gen/zod/api/messages.gen.ts | 4 +- web/gen/zod/api/meta.gen.ts | 2 +- web/gen/zod/api/parameters.gen.ts | 2 +- web/gen/zod/api/site.gen.ts | 2 +- web/gen/zod/api/text-to-audio.gen.ts | 2 +- web/gen/zod/models.gen.ts | 589 ------------------ web/gen/zod/models/agent.gen.ts | 17 + web/gen/zod/models/annotation.gen.ts | 23 + web/gen/zod/models/app.gen.ts | 29 + web/gen/zod/models/audio.gen.ts | 16 + web/gen/zod/models/chat.gen.ts | 80 +++ web/gen/zod/models/chunk.gen.ts | 23 + web/gen/zod/models/conversation.gen.ts | 79 +++ web/gen/zod/models/conversations.gen.ts | 13 + web/gen/zod/models/create.gen.ts | 10 + web/gen/zod/models/error.gen.ts | 11 + web/gen/zod/models/feedback.gen.ts | 22 + web/gen/zod/models/file.gen.ts | 15 + web/gen/zod/models/initial.gen.ts | 29 + web/gen/zod/models/input.gen.ts | 21 + web/gen/zod/models/message.gen.ts | 20 + web/gen/zod/models/paragraph.gen.ts | 18 + web/gen/zod/models/retriever.gen.ts | 19 + web/gen/zod/models/select.gen.ts | 19 + web/gen/zod/models/stream.gen.ts | 100 +++ web/gen/zod/models/suggested.gen.ts | 10 + web/gen/zod/models/text.gen.ts | 29 + web/gen/zod/models/tool.gen.ts | 10 + web/gen/zod/models/update.gen.ts | 10 + web/gen/zod/models/usage.gen.ts | 23 + web/gen/zod/models/user.gen.ts | 15 + web/gen/zod/models/web.gen.ts | 25 + web/openapi-ts.config.ts | 22 +- 79 files changed, 1509 insertions(+), 1332 deletions(-) delete mode 100644 web/gen/types/models.gen.ts create mode 100644 web/gen/types/models/agent.gen.ts create mode 100644 web/gen/types/models/annotation.gen.ts create mode 100644 web/gen/types/models/app.gen.ts create mode 100644 web/gen/types/models/audio.gen.ts create mode 100644 web/gen/types/models/chat.gen.ts create mode 100644 web/gen/types/models/chunk.gen.ts create mode 100644 web/gen/types/models/conversation.gen.ts create mode 100644 web/gen/types/models/conversations.gen.ts create mode 100644 web/gen/types/models/create.gen.ts create mode 100644 web/gen/types/models/error.gen.ts create mode 100644 web/gen/types/models/feedback.gen.ts create mode 100644 web/gen/types/models/file.gen.ts create mode 100644 web/gen/types/models/initial.gen.ts create mode 100644 web/gen/types/models/input.gen.ts create mode 100644 web/gen/types/models/message.gen.ts create mode 100644 web/gen/types/models/paragraph.gen.ts create mode 100644 web/gen/types/models/retriever.gen.ts create mode 100644 web/gen/types/models/select.gen.ts create mode 100644 web/gen/types/models/stream.gen.ts create mode 100644 web/gen/types/models/suggested.gen.ts create mode 100644 web/gen/types/models/text.gen.ts create mode 100644 web/gen/types/models/tool.gen.ts create mode 100644 web/gen/types/models/update.gen.ts create mode 100644 web/gen/types/models/usage.gen.ts create mode 100644 web/gen/types/models/user.gen.ts create mode 100644 web/gen/types/models/web.gen.ts delete mode 100644 web/gen/zod/models.gen.ts create mode 100644 web/gen/zod/models/agent.gen.ts create mode 100644 web/gen/zod/models/annotation.gen.ts create mode 100644 web/gen/zod/models/app.gen.ts create mode 100644 web/gen/zod/models/audio.gen.ts create mode 100644 web/gen/zod/models/chat.gen.ts create mode 100644 web/gen/zod/models/chunk.gen.ts create mode 100644 web/gen/zod/models/conversation.gen.ts create mode 100644 web/gen/zod/models/conversations.gen.ts create mode 100644 web/gen/zod/models/create.gen.ts create mode 100644 web/gen/zod/models/error.gen.ts create mode 100644 web/gen/zod/models/feedback.gen.ts create mode 100644 web/gen/zod/models/file.gen.ts create mode 100644 web/gen/zod/models/initial.gen.ts create mode 100644 web/gen/zod/models/input.gen.ts create mode 100644 web/gen/zod/models/message.gen.ts create mode 100644 web/gen/zod/models/paragraph.gen.ts create mode 100644 web/gen/zod/models/retriever.gen.ts create mode 100644 web/gen/zod/models/select.gen.ts create mode 100644 web/gen/zod/models/stream.gen.ts create mode 100644 web/gen/zod/models/suggested.gen.ts create mode 100644 web/gen/zod/models/text.gen.ts create mode 100644 web/gen/zod/models/tool.gen.ts create mode 100644 web/gen/zod/models/update.gen.ts create mode 100644 web/gen/zod/models/usage.gen.ts create mode 100644 web/gen/zod/models/user.gen.ts create mode 100644 web/gen/zod/models/web.gen.ts diff --git a/web/gen/types/api/app.gen.ts b/web/gen/types/api/app.gen.ts index 3cfe95f2ae..44d4ec336c 100644 --- a/web/gen/types/api/app.gen.ts +++ b/web/gen/types/api/app.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AppFeedbacksResponse } from '../models.gen' +import type { AppFeedbacksResponse } from '../models/app.gen' export type GetChatAppFeedbacksData = { body?: never diff --git a/web/gen/types/api/apps.gen.ts b/web/gen/types/api/apps.gen.ts index c6b54e3a11..14f792b333 100644 --- a/web/gen/types/api/apps.gen.ts +++ b/web/gen/types/api/apps.gen.ts @@ -1,6 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AnnotationItem, AnnotationListResponse, CreateAnnotationRequest, InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse, UpdateAnnotationRequest } from '../models.gen' +import type { AnnotationItem, AnnotationListResponse } from '../models/annotation.gen' +import type { CreateAnnotationRequest } from '../models/create.gen' +import type { InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse } from '../models/initial.gen' +import type { UpdateAnnotationRequest } from '../models/update.gen' export type GetAnnotationListData = { body?: never diff --git a/web/gen/types/api/audio-to-text.gen.ts b/web/gen/types/api/audio-to-text.gen.ts index 954e531d6c..3288d08ce9 100644 --- a/web/gen/types/api/audio-to-text.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 } from '../models.gen' +import type { AudioToTextRequest, AudioToTextResponse as AudioToTextResponse2 } from '../models/audio.gen' export type AudioToTextData = { body: AudioToTextRequest diff --git a/web/gen/types/api/chat-messages.gen.ts b/web/gen/types/api/chat-messages.gen.ts index c6492ac188..b5139768aa 100644 --- a/web/gen/types/api/chat-messages.gen.ts +++ b/web/gen/types/api/chat-messages.gen.ts @@ -1,6 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ChatCompletionResponse, ChatRequest, ErrorResponse } from '../models.gen' +import type { ChatCompletionResponse, ChatRequest } from '../models/chat.gen' +import type { ErrorResponse } from '../models/error.gen' export type SendChatMessageData = { /** diff --git a/web/gen/types/api/conversations.gen.ts b/web/gen/types/api/conversations.gen.ts index f3e4321851..da1a404258 100644 --- a/web/gen/types/api/conversations.gen.ts +++ b/web/gen/types/api/conversations.gen.ts @@ -1,6 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ConversationListItem, ConversationRenameRequest, ConversationsListResponse, ConversationVariablesResponse, ErrorResponse } from '../models.gen' +import type { ConversationListItem, ConversationRenameRequest, ConversationVariablesResponse } from '../models/conversation.gen' +import type { ConversationsListResponse } from '../models/conversations.gen' +import type { ErrorResponse } from '../models/error.gen' export type GetConversationsListData = { body?: never diff --git a/web/gen/types/api/files.gen.ts b/web/gen/types/api/files.gen.ts index cbca255f57..b47fcbb2af 100644 --- a/web/gen/types/api/files.gen.ts +++ b/web/gen/types/api/files.gen.ts @@ -1,6 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ErrorResponse, FileUploadResponse } from '../models.gen' +import type { ErrorResponse } from '../models/error.gen' +import type { FileUploadResponse } from '../models/file.gen' export type UploadChatFileData = { /** diff --git a/web/gen/types/api/info.gen.ts b/web/gen/types/api/info.gen.ts index 65c2b2a6a0..0a7ea6b4ac 100644 --- a/web/gen/types/api/info.gen.ts +++ b/web/gen/types/api/info.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AppInfoResponse } from '../models.gen' +import type { AppInfoResponse } from '../models/app.gen' export type GetChatAppInfoData = { body?: never diff --git a/web/gen/types/api/messages.gen.ts b/web/gen/types/api/messages.gen.ts index 39428a38bf..34b7992449 100644 --- a/web/gen/types/api/messages.gen.ts +++ b/web/gen/types/api/messages.gen.ts @@ -1,6 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ConversationHistoryResponse, MessageFeedbackRequest, SuggestedQuestionsResponse } from '../models.gen' +import type { ConversationHistoryResponse } from '../models/conversation.gen' +import type { MessageFeedbackRequest } from '../models/message.gen' +import type { SuggestedQuestionsResponse } from '../models/suggested.gen' export type PostChatMessageFeedbackData = { body: MessageFeedbackRequest diff --git a/web/gen/types/api/meta.gen.ts b/web/gen/types/api/meta.gen.ts index f4850a84ef..1d37a5fa77 100644 --- a/web/gen/types/api/meta.gen.ts +++ b/web/gen/types/api/meta.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { AppMetaResponse } from '../models.gen' +import type { AppMetaResponse } from '../models/app.gen' export type GetChatAppMetaData = { body?: never diff --git a/web/gen/types/api/parameters.gen.ts b/web/gen/types/api/parameters.gen.ts index aee56e69b1..84c81107ff 100644 --- a/web/gen/types/api/parameters.gen.ts +++ b/web/gen/types/api/parameters.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ChatAppParametersResponse } from '../models.gen' +import type { ChatAppParametersResponse } from '../models/chat.gen' export type GetChatAppParametersData = { body?: never diff --git a/web/gen/types/api/site.gen.ts b/web/gen/types/api/site.gen.ts index e20fe87e28..7ccb300616 100644 --- a/web/gen/types/api/site.gen.ts +++ b/web/gen/types/api/site.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { WebAppSettingsResponse } from '../models.gen' +import type { WebAppSettingsResponse } from '../models/web.gen' export type GetChatWebAppSettingsData = { body?: never diff --git a/web/gen/types/api/text-to-audio.gen.ts b/web/gen/types/api/text-to-audio.gen.ts index 13b4fcb820..429e60a353 100644 --- a/web/gen/types/api/text-to-audio.gen.ts +++ b/web/gen/types/api/text-to-audio.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { TextToAudioFormRequest } from '../models.gen' +import type { TextToAudioFormRequest } from '../models/text.gen' export type TextToAudioChatData = { body: TextToAudioFormRequest diff --git a/web/gen/types/models.gen.ts b/web/gen/types/models.gen.ts deleted file mode 100644 index 05bbc5281c..0000000000 --- a/web/gen/types/models.gen.ts +++ /dev/null @@ -1,717 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -export type ChatRequest = { - /** - * User Input/Question content. - */ - query: string - /** - * Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}. - */ - inputs?: { - [key: string]: unknown - } - /** - * Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s. - */ - response_mode?: 'streaming' | 'blocking' - /** - * User identifier, 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 - /** - * Conversation ID to continue a conversation. Pass the previous message's conversation_id. - */ - conversation_id?: string - /** - * File list (images) for Vision-capable models. - */ - files?: Array - /** - * Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation. - */ - auto_generate_name?: boolean -} - -export type InputFileObject = ({ - transfer_method?: 'remote_url' - url: string -} | { - transfer_method?: 'local_file' - upload_file_id: string -}) & { - /** - * Supported type: `image`. - */ - type: 'image' - /** - * Transfer method, `remote_url` for image URL / `local_file` for file upload - */ - transfer_method: 'remote_url' | 'local_file' - /** - * Image URL (when the transfer method is `remote_url`) - */ - url?: string - /** - * Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`) - */ - upload_file_id?: string -} - -/** - * Response object for blocking mode chat completion. - */ -export type ChatCompletionResponse = { - /** - * Event type, fixed as `message`. - */ - event?: string - /** - * Task ID for request tracking and stop response API. - */ - task_id?: string - /** - * Unique ID of this response/message event. - */ - id?: string - /** - * Unique message ID. - */ - message_id?: string - /** - * Conversation ID. - */ - conversation_id?: string - /** - * App mode, fixed as `chat`. - */ - mode?: string - /** - * Complete response content. - */ - answer?: string - metadata?: { - usage?: Usage - retriever_resources?: Array - } - /** - * Message creation timestamp (Unix epoch seconds). - */ - created_at?: number -} - -/** - * Base schema for Server-Sent Event chunks in streaming mode. - */ -export type ChunkChatEvent = { - /** - * The type of event. - */ - event: 'message' | 'agent_message' | 'tts_message' | 'tts_message_end' | 'agent_thought' | 'message_file' | 'message_end' | 'message_replace' | 'error' | 'ping' -} - -export type StreamEventBase = { - /** - * Task ID. - */ - task_id?: string - /** - * Unique message ID. - */ - message_id?: string - /** - * Conversation ID. - */ - conversation_id?: string - /** - * Creation timestamp. - */ - created_at?: number -} - -export type StreamEventChatMessage = Omit & StreamEventBase & { - /** - * LLM returned text chunk. - */ - answer: string - event: 'message' -} - -export type StreamEventChatAgentMessage = Omit & StreamEventBase & { - /** - * LLM returned text chunk (Agent mode). - */ - answer: string - event: 'agent_message' -} - -export type StreamEventChatTtsMessage = Omit & StreamEventBase & { - /** - * Base64 encoded audio chunk. - */ - audio: string - event: 'tts_message' -} - -export type StreamEventChatTtsMessageEnd = Omit & StreamEventBase & { - /** - * Empty string for end event. - */ - audio: string - event: 'tts_message_end' -} - -export type StreamEventChatAgentThought = Omit & StreamEventBase & { - /** - * Agent thought ID. - */ - id: string - /** - * Position of this thought in the sequence for the message. - */ - position: number - /** - * What LLM is thinking. - */ - thought?: string - /** - * Response from tool calls. - */ - observation?: string - /** - * List of tools called, split by ';'. - */ - tool?: string - /** - * Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}. - */ - tool_input?: string - /** - * File IDs of files related to this thought (e.g., generated by a tool). - */ - message_files?: Array - event: 'agent_thought' -} - -export type StreamEventChatMessageFile = Omit & { - /** - * File unique ID. - */ - id: string - /** - * File type, currently only 'image'. - */ - type: 'image' - /** - * Who this file belongs to, always 'assistant' here. - */ - belongs_to: 'assistant' - /** - * Remote URL of the file. - */ - url: string - /** - * Conversation ID. - */ - conversation_id: string - event: 'message_file' -} - -export type StreamEventChatMessageEnd = Omit & StreamEventBase & { - metadata: { - usage?: Usage - retriever_resources?: Array - } - event: 'message_end' -} - -export type StreamEventChatMessageReplace = Omit & StreamEventBase & { - /** - * Replacement content. - */ - answer: string - event: 'message_replace' -} - -export type StreamEventChatError = Omit & StreamEventBase & { - /** - * HTTP status code. - */ - status: number - /** - * Error code. - */ - code: string - /** - * Error message. - */ - message: string - event: 'error' -} - -export type StreamEventChatPing = Omit & { - event: 'ping' - [key: string]: unknown | 'ping' -} - -/** - * Model usage information. - */ -export type Usage = { - prompt_tokens?: number - prompt_unit_price?: string - prompt_price_unit?: string - prompt_price?: string - completion_tokens?: number - completion_unit_price?: string - completion_price_unit?: string - completion_price?: string - total_tokens?: number - total_price?: string - currency?: string - latency?: number -} - -/** - * Citation and Attribution information for a resource. - */ -export type RetrieverResource = { - /** - * Position of the resource in the list. - */ - position?: number - /** - * ID of the dataset. - */ - dataset_id?: string - /** - * Name of the dataset. - */ - dataset_name?: string - /** - * ID of the document. - */ - document_id?: string - /** - * Name of the document. - */ - document_name?: string - /** - * ID of the specific segment within the document. - */ - segment_id?: string - /** - * Relevance score of the resource. - */ - score?: number - /** - * Content snippet from the resource. - */ - content?: string -} - -export type FileUploadResponse = { - id?: string - name?: string - size?: number - extension?: string - mime_type?: string - created_by?: string - created_at?: number -} - -export type MessageFeedbackRequest = { - rating?: 'like' | 'dislike' | null - user: string - content?: string -} - -export type AppFeedbacksResponse = { - data?: Array -} - -export type FeedbackItem = { - id?: string - app_id?: string - conversation_id?: string - message_id?: string - rating?: 'like' | 'dislike' | null - content?: string - from_source?: string - from_end_user_id?: string - from_account_id?: string | null - created_at?: string - updated_at?: string -} - -export type SuggestedQuestionsResponse = { - result?: string - data?: Array -} - -export type ConversationHistoryResponse = { - limit?: number - has_more?: boolean - data?: Array -} - -export type ConversationMessageItem = { - id?: string - conversation_id?: string - inputs?: { - [key: string]: unknown - } - query?: string - answer?: string - message_files?: Array - feedback?: { - rating?: 'like' | 'dislike' - } | null - retriever_resources?: Array - agent_thoughts?: Array - created_at?: number -} - -export type MessageFileItem = { - id?: string - /** - * File type, e.g., 'image'. - */ - type?: string - /** - * Preview image URL. - */ - url?: string - /** - * Who this file belongs to. - */ - belongs_to?: 'user' | 'assistant' -} - -export type AgentThoughtItem = { - /** - * Agent thought ID. - */ - id?: string - /** - * Unique message ID this thought belongs to. - */ - message_id?: string - /** - * Position of this thought. - */ - position?: number - /** - * What LLM is thinking. - */ - thought?: string - /** - * Tools called, split by ';'. - */ - tool?: string - /** - * Input of tools in JSON format. - */ - tool_input?: string - /** - * Response from tool calls. - */ - observation?: string - /** - * File IDs related to this thought (from example, Markdown text says 'message_files'). - */ - files?: Array - /** - * Creation timestamp. - */ - created_at?: number -} - -export type ConversationsListResponse = { - limit?: number - has_more?: boolean - data?: Array -} - -export type ConversationListItem = { - id?: string - name?: string - inputs?: { - [key: string]: unknown - } - status?: string - introduction?: string - created_at?: number - updated_at?: number -} - -export type ConversationRenameRequest = { - /** - * (Optional) The name of the conversation. Omit if auto_generate is true. - */ - name?: string - /** - * (Optional) Automatically generate the title. Default false. - */ - auto_generate?: boolean - /** - * The user identifier. - */ - user: string -} - -export type ConversationRenameResponse = ConversationListItem - -export type ConversationVariablesResponse = { - /** - * Number of items per page. - */ - limit?: number - /** - * Whether there is a next page. - */ - has_more?: boolean - data?: Array -} - -export type ConversationVariableItem = { - /** - * Variable ID. - */ - id?: string - /** - * Variable name. - */ - name?: string - /** - * Variable type (string, number, object, json, etc.). - */ - value_type?: string - /** - * Variable value (can be a JSON string for complex types). - */ - value?: string - /** - * Variable description. - */ - description?: string - /** - * Creation timestamp. - */ - created_at?: number - /** - * Last update timestamp. - */ - updated_at?: number -} - -export type AudioToTextRequest = { - /** - * Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB. - */ - file: Blob | File - /** - * User identifier. - */ - user: string -} - -export type AudioToTextResponse = { - /** - * Output text from speech recognition. - */ - text?: string -} - -/** - * Requires `user`. Provide either `message_id` or `text`. - */ -export type TextToAudioFormRequest = { - /** - * Message ID (priority if both text and message_id provided). - */ - message_id?: string - /** - * Speech content. - */ - text?: string - /** - * User identifier. - */ - user: string -} - -export type AppInfoResponse = { - name?: string - description?: string - tags?: Array -} - -export type ChatAppParametersResponse = { - opening_statement?: string - suggested_questions?: Array - suggested_questions_after_answer?: { - enabled?: boolean - } - speech_to_text?: { - enabled?: boolean - } - text_to_speech?: { - enabled?: boolean - voice?: string - language?: string - autoPlay?: 'enabled' | 'disabled' - } - retriever_resource?: { - enabled?: boolean - } - annotation_reply?: { - enabled?: boolean - } - user_input_form?: Array - file_upload?: { - image?: { - enabled?: boolean - number_limits?: number - detail?: string - transfer_methods?: Array<'remote_url' | 'local_file'> - } - } - system_parameters?: { - file_size_limit?: number - image_file_size_limit?: number - audio_file_size_limit?: number - video_file_size_limit?: number - } -} - -export type UserInputFormItem = TextInputControlWrapper | ParagraphControlWrapper | SelectControlWrapper - -export type TextInputControlWrapper = { - 'text-input': TextInputControl -} - -export type ParagraphControlWrapper = { - paragraph: ParagraphControl -} - -export type SelectControlWrapper = { - select: SelectControl -} - -export type TextInputControl = { - label: string - variable: string - required: boolean - default?: string -} - -export type ParagraphControl = { - label: string - variable: string - required: boolean - default?: string -} - -export type SelectControl = { - label: string - variable: string - required: boolean - default?: string - options: Array -} - -export type AppMetaResponse = { - /** - * Tool icons. Keys are tool names. - */ - tool_icons?: { - [key: string]: string | ToolIconDetail - } -} - -export type ToolIconDetail = { - /** - * Background color in hex format. - */ - background?: string - /** - * Emoji content. - */ - content?: string -} - -export type WebAppSettingsResponse = { - title?: string - chat_color_theme?: string - chat_color_theme_inverted?: boolean - icon_type?: 'emoji' | 'image' - icon?: string - icon_background?: string - icon_url?: string | null - description?: string - copyright?: string - privacy_policy?: string - custom_disclaimer?: string - default_language?: string - show_workflow_steps?: boolean - use_icon_as_answer_icon?: boolean -} - -export type AnnotationListResponse = { - data?: Array - has_more?: boolean - limit?: number - total?: number - page?: number -} - -export type AnnotationItem = { - id?: string - question?: string - answer?: string - hit_count?: number - created_at?: number -} - -export type CreateAnnotationRequest = { - question: string - answer: string -} - -export type UpdateAnnotationRequest = { - question: string - answer: string -} - -export type InitialAnnotationReplySettingsRequest = { - /** - * Specified embedding model provider name (Optional). - */ - embedding_provider_name?: string - /** - * Specified embedding model name (Optional). - */ - embedding_model_name?: string - /** - * Similarity threshold for matching annotated replies. - */ - score_threshold: number -} - -export type InitialAnnotationReplySettingsResponse = { - job_id?: string - job_status?: string -} - -export type InitialAnnotationReplySettingsStatusResponse = { - job_id?: string - job_status?: string - error_msg?: string | null -} - -export type ErrorResponse = { - status?: number - code?: string - message?: string -} diff --git a/web/gen/types/models/agent.gen.ts b/web/gen/types/models/agent.gen.ts new file mode 100644 index 0000000000..1656261b80 --- /dev/null +++ b/web/gen/types/models/agent.gen.ts @@ -0,0 +1,40 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AgentThoughtItem = { + /** + * Agent thought ID. + */ + id?: string + /** + * Unique message ID this thought belongs to. + */ + message_id?: string + /** + * Position of this thought. + */ + position?: number + /** + * What LLM is thinking. + */ + thought?: string + /** + * Tools called, split by ';'. + */ + tool?: string + /** + * Input of tools in JSON format. + */ + tool_input?: string + /** + * Response from tool calls. + */ + observation?: string + /** + * File IDs related to this thought (from example, Markdown text says 'message_files'). + */ + files?: Array + /** + * Creation timestamp. + */ + created_at?: number +} diff --git a/web/gen/types/models/annotation.gen.ts b/web/gen/types/models/annotation.gen.ts new file mode 100644 index 0000000000..cfec7dffe3 --- /dev/null +++ b/web/gen/types/models/annotation.gen.ts @@ -0,0 +1,17 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AnnotationListResponse = { + data?: Array + has_more?: boolean + limit?: number + total?: number + page?: number +} + +export type AnnotationItem = { + id?: string + question?: string + answer?: string + hit_count?: number + created_at?: number +} diff --git a/web/gen/types/models/app.gen.ts b/web/gen/types/models/app.gen.ts new file mode 100644 index 0000000000..acb9da832c --- /dev/null +++ b/web/gen/types/models/app.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { FeedbackItem } from './feedback.gen' +import type { ToolIconDetail } from './tool.gen' + +export type AppFeedbacksResponse = { + data?: Array +} + +export type AppInfoResponse = { + name?: string + description?: string + tags?: Array +} + +export type AppMetaResponse = { + /** + * Tool icons. Keys are tool names. + */ + tool_icons?: { + [key: string]: string | ToolIconDetail + } +} diff --git a/web/gen/types/models/audio.gen.ts b/web/gen/types/models/audio.gen.ts new file mode 100644 index 0000000000..26b3ae5012 --- /dev/null +++ b/web/gen/types/models/audio.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AudioToTextRequest = { + /** + * Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB. + */ + file: Blob | File + /** + * User identifier. + */ + user: string +} + +export type AudioToTextResponse = { + /** + * Output text from speech recognition. + */ + text?: string +} diff --git a/web/gen/types/models/chat.gen.ts b/web/gen/types/models/chat.gen.ts new file mode 100644 index 0000000000..a2621e1614 --- /dev/null +++ b/web/gen/types/models/chat.gen.ts @@ -0,0 +1,119 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { InputFileObject } from './input.gen' +import type { RetrieverResource } from './retriever.gen' +import type { Usage } from './usage.gen' +import type { UserInputFormItem } from './user.gen' + +export type ChatRequest = { + /** + * User Input/Question content. + */ + query: string + /** + * Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}. + */ + inputs?: { + [key: string]: unknown + } + /** + * Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s. + */ + response_mode?: 'streaming' | 'blocking' + /** + * User identifier, 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 + /** + * Conversation ID to continue a conversation. Pass the previous message's conversation_id. + */ + conversation_id?: string + /** + * File list (images) for Vision-capable models. + */ + files?: Array + /** + * Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation. + */ + auto_generate_name?: boolean +} + +/** + * Response object for blocking mode chat completion. + */ +export type ChatCompletionResponse = { + /** + * Event type, fixed as `message`. + */ + event?: string + /** + * Task ID for request tracking and stop response API. + */ + task_id?: string + /** + * Unique ID of this response/message event. + */ + id?: string + /** + * Unique message ID. + */ + message_id?: string + /** + * Conversation ID. + */ + conversation_id?: string + /** + * App mode, fixed as `chat`. + */ + mode?: string + /** + * Complete response content. + */ + answer?: string + metadata?: { + usage?: Usage + retriever_resources?: Array + } + /** + * Message creation timestamp (Unix epoch seconds). + */ + created_at?: number +} + +export type ChatAppParametersResponse = { + opening_statement?: string + suggested_questions?: Array + suggested_questions_after_answer?: { + enabled?: boolean + } + speech_to_text?: { + enabled?: boolean + } + text_to_speech?: { + enabled?: boolean + voice?: string + language?: string + autoPlay?: 'enabled' | 'disabled' + } + retriever_resource?: { + enabled?: boolean + } + annotation_reply?: { + enabled?: boolean + } + user_input_form?: Array + file_upload?: { + image?: { + enabled?: boolean + number_limits?: number + detail?: string + transfer_methods?: Array<'remote_url' | 'local_file'> + } + } + system_parameters?: { + file_size_limit?: number + image_file_size_limit?: number + audio_file_size_limit?: number + video_file_size_limit?: number + } +} diff --git a/web/gen/types/models/chunk.gen.ts b/web/gen/types/models/chunk.gen.ts new file mode 100644 index 0000000000..6e35f12f5d --- /dev/null +++ b/web/gen/types/models/chunk.gen.ts @@ -0,0 +1,11 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Base schema for Server-Sent Event chunks in streaming mode. + */ +export type ChunkChatEvent = { + /** + * The type of event. + */ + event: 'message' | 'agent_message' | 'tts_message' | 'tts_message_end' | 'agent_thought' | 'message_file' | 'message_end' | 'message_replace' | 'error' | 'ping' +} diff --git a/web/gen/types/models/conversation.gen.ts b/web/gen/types/models/conversation.gen.ts new file mode 100644 index 0000000000..d7a5f87e93 --- /dev/null +++ b/web/gen/types/models/conversation.gen.ts @@ -0,0 +1,100 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { AgentThoughtItem } from './agent.gen' +import type { MessageFileItem } from './message.gen' +import type { RetrieverResource } from './retriever.gen' + +export type ConversationHistoryResponse = { + limit?: number + has_more?: boolean + data?: Array +} + +export type ConversationMessageItem = { + id?: string + conversation_id?: string + inputs?: { + [key: string]: unknown + } + query?: string + answer?: string + message_files?: Array + feedback?: { + rating?: 'like' | 'dislike' + } | null + retriever_resources?: Array + agent_thoughts?: Array + created_at?: number +} + +export type ConversationListItem = { + id?: string + name?: string + inputs?: { + [key: string]: unknown + } + status?: string + introduction?: string + created_at?: number + updated_at?: number +} + +export type ConversationRenameRequest = { + /** + * (Optional) The name of the conversation. Omit if auto_generate is true. + */ + name?: string + /** + * (Optional) Automatically generate the title. Default false. + */ + auto_generate?: boolean + /** + * The user identifier. + */ + user: string +} + +export type ConversationRenameResponse = ConversationListItem + +export type ConversationVariablesResponse = { + /** + * Number of items per page. + */ + limit?: number + /** + * Whether there is a next page. + */ + has_more?: boolean + data?: Array +} + +export type ConversationVariableItem = { + /** + * Variable ID. + */ + id?: string + /** + * Variable name. + */ + name?: string + /** + * Variable type (string, number, object, json, etc.). + */ + value_type?: string + /** + * Variable value (can be a JSON string for complex types). + */ + value?: string + /** + * Variable description. + */ + description?: string + /** + * Creation timestamp. + */ + created_at?: number + /** + * Last update timestamp. + */ + updated_at?: number +} diff --git a/web/gen/types/models/conversations.gen.ts b/web/gen/types/models/conversations.gen.ts new file mode 100644 index 0000000000..153d43b05a --- /dev/null +++ b/web/gen/types/models/conversations.gen.ts @@ -0,0 +1,9 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ConversationListItem } from './conversation.gen' + +export type ConversationsListResponse = { + limit?: number + has_more?: boolean + data?: Array +} diff --git a/web/gen/types/models/create.gen.ts b/web/gen/types/models/create.gen.ts new file mode 100644 index 0000000000..bb1c0f0117 --- /dev/null +++ b/web/gen/types/models/create.gen.ts @@ -0,0 +1,6 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type CreateAnnotationRequest = { + question: string + answer: string +} diff --git a/web/gen/types/models/error.gen.ts b/web/gen/types/models/error.gen.ts new file mode 100644 index 0000000000..3a1803c456 --- /dev/null +++ b/web/gen/types/models/error.gen.ts @@ -0,0 +1,7 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ErrorResponse = { + status?: number + code?: string + message?: string +} diff --git a/web/gen/types/models/feedback.gen.ts b/web/gen/types/models/feedback.gen.ts new file mode 100644 index 0000000000..f6af6d8b49 --- /dev/null +++ b/web/gen/types/models/feedback.gen.ts @@ -0,0 +1,15 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type FeedbackItem = { + id?: string + app_id?: string + conversation_id?: string + message_id?: string + rating?: 'like' | 'dislike' | null + content?: string + from_source?: string + from_end_user_id?: string + from_account_id?: string | null + created_at?: string + updated_at?: string +} diff --git a/web/gen/types/models/file.gen.ts b/web/gen/types/models/file.gen.ts new file mode 100644 index 0000000000..15103064ca --- /dev/null +++ b/web/gen/types/models/file.gen.ts @@ -0,0 +1,11 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type FileUploadResponse = { + id?: string + name?: string + size?: number + extension?: string + mime_type?: string + created_by?: string + created_at?: number +} diff --git a/web/gen/types/models/initial.gen.ts b/web/gen/types/models/initial.gen.ts new file mode 100644 index 0000000000..06344b058d --- /dev/null +++ b/web/gen/types/models/initial.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type InitialAnnotationReplySettingsRequest = { + /** + * Specified embedding model provider name (Optional). + */ + embedding_provider_name?: string + /** + * Specified embedding model name (Optional). + */ + embedding_model_name?: string + /** + * Similarity threshold for matching annotated replies. + */ + score_threshold: number +} + +export type InitialAnnotationReplySettingsResponse = { + job_id?: string + job_status?: string +} + +export type InitialAnnotationReplySettingsStatusResponse = { + job_id?: string + job_status?: string + error_msg?: string | null +} diff --git a/web/gen/types/models/input.gen.ts b/web/gen/types/models/input.gen.ts new file mode 100644 index 0000000000..a33f5a59b8 --- /dev/null +++ b/web/gen/types/models/input.gen.ts @@ -0,0 +1,26 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type InputFileObject = ({ + transfer_method?: 'remote_url' + url: string +} | { + transfer_method?: 'local_file' + upload_file_id: string +}) & { + /** + * Supported type: `image`. + */ + type: 'image' + /** + * Transfer method, `remote_url` for image URL / `local_file` for file upload + */ + transfer_method: 'remote_url' | 'local_file' + /** + * Image URL (when the transfer method is `remote_url`) + */ + url?: string + /** + * Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`) + */ + upload_file_id?: string +} diff --git a/web/gen/types/models/message.gen.ts b/web/gen/types/models/message.gen.ts new file mode 100644 index 0000000000..a27a6ac2bc --- /dev/null +++ b/web/gen/types/models/message.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type MessageFeedbackRequest = { + rating?: 'like' | 'dislike' | null + user: string + content?: string +} + +export type MessageFileItem = { + id?: string + /** + * File type, e.g., 'image'. + */ + type?: string + /** + * Preview image URL. + */ + url?: string + /** + * Who this file belongs to. + */ + belongs_to?: 'user' | 'assistant' +} diff --git a/web/gen/types/models/paragraph.gen.ts b/web/gen/types/models/paragraph.gen.ts new file mode 100644 index 0000000000..021d77beec --- /dev/null +++ b/web/gen/types/models/paragraph.gen.ts @@ -0,0 +1,12 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ParagraphControlWrapper = { + paragraph: ParagraphControl +} + +export type ParagraphControl = { + label: string + variable: string + required: boolean + default?: string +} diff --git a/web/gen/types/models/retriever.gen.ts b/web/gen/types/models/retriever.gen.ts new file mode 100644 index 0000000000..5f124f02c8 --- /dev/null +++ b/web/gen/types/models/retriever.gen.ts @@ -0,0 +1,39 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Citation and Attribution information for a resource. + */ +export type RetrieverResource = { + /** + * Position of the resource in the list. + */ + position?: number + /** + * ID of the dataset. + */ + dataset_id?: string + /** + * Name of the dataset. + */ + dataset_name?: string + /** + * ID of the document. + */ + document_id?: string + /** + * Name of the document. + */ + document_name?: string + /** + * ID of the specific segment within the document. + */ + segment_id?: string + /** + * Relevance score of the resource. + */ + score?: number + /** + * Content snippet from the resource. + */ + content?: string +} diff --git a/web/gen/types/models/select.gen.ts b/web/gen/types/models/select.gen.ts new file mode 100644 index 0000000000..f25864115a --- /dev/null +++ b/web/gen/types/models/select.gen.ts @@ -0,0 +1,13 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type SelectControlWrapper = { + select: SelectControl +} + +export type SelectControl = { + label: string + variable: string + required: boolean + default?: string + options: Array +} diff --git a/web/gen/types/models/stream.gen.ts b/web/gen/types/models/stream.gen.ts new file mode 100644 index 0000000000..81e98cf331 --- /dev/null +++ b/web/gen/types/models/stream.gen.ts @@ -0,0 +1,149 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ChunkChatEvent } from './chunk.gen' +import type { RetrieverResource } from './retriever.gen' +import type { Usage } from './usage.gen' + +export type StreamEventBase = { + /** + * Task ID. + */ + task_id?: string + /** + * Unique message ID. + */ + message_id?: string + /** + * Conversation ID. + */ + conversation_id?: string + /** + * Creation timestamp. + */ + created_at?: number +} + +export type StreamEventChatMessage = Omit & StreamEventBase & { + /** + * LLM returned text chunk. + */ + answer: string + event: 'message' +} + +export type StreamEventChatAgentMessage = Omit & StreamEventBase & { + /** + * LLM returned text chunk (Agent mode). + */ + answer: string + event: 'agent_message' +} + +export type StreamEventChatTtsMessage = Omit & StreamEventBase & { + /** + * Base64 encoded audio chunk. + */ + audio: string + event: 'tts_message' +} + +export type StreamEventChatTtsMessageEnd = Omit & StreamEventBase & { + /** + * Empty string for end event. + */ + audio: string + event: 'tts_message_end' +} + +export type StreamEventChatAgentThought = Omit & StreamEventBase & { + /** + * Agent thought ID. + */ + id: string + /** + * Position of this thought in the sequence for the message. + */ + position: number + /** + * What LLM is thinking. + */ + thought?: string + /** + * Response from tool calls. + */ + observation?: string + /** + * List of tools called, split by ';'. + */ + tool?: string + /** + * Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}. + */ + tool_input?: string + /** + * File IDs of files related to this thought (e.g., generated by a tool). + */ + message_files?: Array + event: 'agent_thought' +} + +export type StreamEventChatMessageFile = Omit & { + /** + * File unique ID. + */ + id: string + /** + * File type, currently only 'image'. + */ + type: 'image' + /** + * Who this file belongs to, always 'assistant' here. + */ + belongs_to: 'assistant' + /** + * Remote URL of the file. + */ + url: string + /** + * Conversation ID. + */ + conversation_id: string + event: 'message_file' +} + +export type StreamEventChatMessageEnd = Omit & StreamEventBase & { + metadata: { + usage?: Usage + retriever_resources?: Array + } + event: 'message_end' +} + +export type StreamEventChatMessageReplace = Omit & StreamEventBase & { + /** + * Replacement content. + */ + answer: string + event: 'message_replace' +} + +export type StreamEventChatError = Omit & StreamEventBase & { + /** + * HTTP status code. + */ + status: number + /** + * Error code. + */ + code: string + /** + * Error message. + */ + message: string + event: 'error' +} + +export type StreamEventChatPing = Omit & { + event: 'ping' + [key: string]: unknown | 'ping' +} diff --git a/web/gen/types/models/suggested.gen.ts b/web/gen/types/models/suggested.gen.ts new file mode 100644 index 0000000000..d6ed1bf424 --- /dev/null +++ b/web/gen/types/models/suggested.gen.ts @@ -0,0 +1,6 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type SuggestedQuestionsResponse = { + result?: string + data?: Array +} diff --git a/web/gen/types/models/text.gen.ts b/web/gen/types/models/text.gen.ts new file mode 100644 index 0000000000..f62da444a8 --- /dev/null +++ b/web/gen/types/models/text.gen.ts @@ -0,0 +1,30 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Requires `user`. Provide either `message_id` or `text`. + */ +export type TextToAudioFormRequest = { + /** + * Message ID (priority if both text and message_id provided). + */ + message_id?: string + /** + * Speech content. + */ + text?: string + /** + * User identifier. + */ + user: string +} + +export type TextInputControlWrapper = { + 'text-input': TextInputControl +} + +export type TextInputControl = { + label: string + variable: string + required: boolean + default?: string +} diff --git a/web/gen/types/models/tool.gen.ts b/web/gen/types/models/tool.gen.ts new file mode 100644 index 0000000000..6bd58cd5de --- /dev/null +++ b/web/gen/types/models/tool.gen.ts @@ -0,0 +1,12 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ToolIconDetail = { + /** + * Background color in hex format. + */ + background?: string + /** + * Emoji content. + */ + content?: string +} diff --git a/web/gen/types/models/update.gen.ts b/web/gen/types/models/update.gen.ts new file mode 100644 index 0000000000..3031873c5e --- /dev/null +++ b/web/gen/types/models/update.gen.ts @@ -0,0 +1,6 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type UpdateAnnotationRequest = { + question: string + answer: string +} diff --git a/web/gen/types/models/usage.gen.ts b/web/gen/types/models/usage.gen.ts new file mode 100644 index 0000000000..1ebd9b17ca --- /dev/null +++ b/web/gen/types/models/usage.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model usage information. + */ +export type Usage = { + prompt_tokens?: number + prompt_unit_price?: string + prompt_price_unit?: string + prompt_price?: string + completion_tokens?: number + completion_unit_price?: string + completion_price_unit?: string + completion_price?: string + total_tokens?: number + total_price?: string + currency?: string + latency?: number +} diff --git a/web/gen/types/models/user.gen.ts b/web/gen/types/models/user.gen.ts new file mode 100644 index 0000000000..666dffb275 --- /dev/null +++ b/web/gen/types/models/user.gen.ts @@ -0,0 +1,7 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ParagraphControlWrapper } from './paragraph.gen' +import type { SelectControlWrapper } from './select.gen' +import type { TextInputControlWrapper } from './text.gen' + +export type UserInputFormItem = TextInputControlWrapper | ParagraphControlWrapper | SelectControlWrapper diff --git a/web/gen/types/models/web.gen.ts b/web/gen/types/models/web.gen.ts new file mode 100644 index 0000000000..705f348164 --- /dev/null +++ b/web/gen/types/models/web.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type WebAppSettingsResponse = { + title?: string + chat_color_theme?: string + chat_color_theme_inverted?: boolean + icon_type?: 'emoji' | 'image' + icon?: string + icon_background?: string + icon_url?: string | null + description?: string + copyright?: string + privacy_policy?: string + custom_disclaimer?: string + default_language?: string + show_workflow_steps?: boolean + use_icon_as_answer_icon?: boolean +} diff --git a/web/gen/zod/api/app.gen.ts b/web/gen/zod/api/app.gen.ts index 0e9cd08451..3d79caef85 100644 --- a/web/gen/zod/api/app.gen.ts +++ b/web/gen/zod/api/app.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zAppFeedbacksResponse } from '../models.gen' +import { zAppFeedbacksResponse } from '../models/app.gen' export const zGetChatAppFeedbacksData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/apps.gen.ts b/web/gen/zod/api/apps.gen.ts index 120e4afc62..9c2abb9ba4 100644 --- a/web/gen/zod/api/apps.gen.ts +++ b/web/gen/zod/api/apps.gen.ts @@ -2,7 +2,10 @@ import { z } from 'zod' -import { zAnnotationItem, zAnnotationListResponse, zCreateAnnotationRequest, zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse, zUpdateAnnotationRequest } from '../models.gen' +import { zAnnotationItem, zAnnotationListResponse } from '../models/annotation.gen' +import { zCreateAnnotationRequest } from '../models/create.gen' +import { zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse } from '../models/initial.gen' +import { zUpdateAnnotationRequest } from '../models/update.gen' export const zGetAnnotationListData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/audio-to-text.gen.ts b/web/gen/zod/api/audio-to-text.gen.ts index 8b2ea2f994..a3186d7297 100644 --- a/web/gen/zod/api/audio-to-text.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 } from '../models.gen' +import { zAudioToTextRequest, zAudioToTextResponse as zAudioToTextResponse2 } from '../models/audio.gen' export const zAudioToTextData = z.object({ body: zAudioToTextRequest, diff --git a/web/gen/zod/api/chat-messages.gen.ts b/web/gen/zod/api/chat-messages.gen.ts index 25516c963e..db8147435b 100644 --- a/web/gen/zod/api/chat-messages.gen.ts +++ b/web/gen/zod/api/chat-messages.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zChatCompletionResponse, zChatRequest } from '../models.gen' +import { zChatCompletionResponse, zChatRequest } from '../models/chat.gen' export const zSendChatMessageData = z.object({ body: zChatRequest, diff --git a/web/gen/zod/api/conversations.gen.ts b/web/gen/zod/api/conversations.gen.ts index 65e6cf19ba..7827a937ed 100644 --- a/web/gen/zod/api/conversations.gen.ts +++ b/web/gen/zod/api/conversations.gen.ts @@ -2,7 +2,8 @@ import { z } from 'zod' -import { zConversationListItem, zConversationRenameRequest, zConversationsListResponse, zConversationVariablesResponse } from '../models.gen' +import { zConversationListItem, zConversationRenameRequest, zConversationVariablesResponse } from '../models/conversation.gen' +import { zConversationsListResponse } from '../models/conversations.gen' export const zGetConversationsListData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/files.gen.ts b/web/gen/zod/api/files.gen.ts index d4eec4ece0..4eabcf1845 100644 --- a/web/gen/zod/api/files.gen.ts +++ b/web/gen/zod/api/files.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zFileUploadResponse } from '../models.gen' +import { zFileUploadResponse } from '../models/file.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 index 52563fd1e9..354bffb55a 100644 --- a/web/gen/zod/api/info.gen.ts +++ b/web/gen/zod/api/info.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zAppInfoResponse } from '../models.gen' +import { zAppInfoResponse } from '../models/app.gen' export const zGetChatAppInfoData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/messages.gen.ts b/web/gen/zod/api/messages.gen.ts index f381399c4c..19eec7edbc 100644 --- a/web/gen/zod/api/messages.gen.ts +++ b/web/gen/zod/api/messages.gen.ts @@ -2,7 +2,9 @@ import { z } from 'zod' -import { zConversationHistoryResponse, zMessageFeedbackRequest, zSuggestedQuestionsResponse } from '../models.gen' +import { zConversationHistoryResponse } from '../models/conversation.gen' +import { zMessageFeedbackRequest } from '../models/message.gen' +import { zSuggestedQuestionsResponse } from '../models/suggested.gen' export const zPostChatMessageFeedbackData = z.object({ body: zMessageFeedbackRequest, diff --git a/web/gen/zod/api/meta.gen.ts b/web/gen/zod/api/meta.gen.ts index 31db10d90a..247a44a541 100644 --- a/web/gen/zod/api/meta.gen.ts +++ b/web/gen/zod/api/meta.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zAppMetaResponse } from '../models.gen' +import { zAppMetaResponse } from '../models/app.gen' export const zGetChatAppMetaData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/parameters.gen.ts b/web/gen/zod/api/parameters.gen.ts index 3e4d26319c..5b0ed7902d 100644 --- a/web/gen/zod/api/parameters.gen.ts +++ b/web/gen/zod/api/parameters.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zChatAppParametersResponse } from '../models.gen' +import { zChatAppParametersResponse } from '../models/chat.gen' export const zGetChatAppParametersData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/site.gen.ts b/web/gen/zod/api/site.gen.ts index 11e2cff3d8..4cfeef5e30 100644 --- a/web/gen/zod/api/site.gen.ts +++ b/web/gen/zod/api/site.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zWebAppSettingsResponse } from '../models.gen' +import { zWebAppSettingsResponse } from '../models/web.gen' export const zGetChatWebAppSettingsData = z.object({ body: z.never().optional(), diff --git a/web/gen/zod/api/text-to-audio.gen.ts b/web/gen/zod/api/text-to-audio.gen.ts index e4a2d1c4cf..de1c28c558 100644 --- a/web/gen/zod/api/text-to-audio.gen.ts +++ b/web/gen/zod/api/text-to-audio.gen.ts @@ -2,7 +2,7 @@ import { z } from 'zod' -import { zTextToAudioFormRequest } from '../models.gen' +import { zTextToAudioFormRequest } from '../models/text.gen' export const zTextToAudioChatData = z.object({ body: zTextToAudioFormRequest, diff --git a/web/gen/zod/models.gen.ts b/web/gen/zod/models.gen.ts deleted file mode 100644 index cbd3b65406..0000000000 --- a/web/gen/zod/models.gen.ts +++ /dev/null @@ -1,589 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { z } from 'zod' - -export const zInputFileObject = z.intersection(z.union([ - z.object({ - transfer_method: z.enum(['remote_url']).optional(), - url: z.string(), - }), - z.object({ - transfer_method: z.enum(['local_file']).optional(), - upload_file_id: z.string(), - }), -]), z.object({ - type: z.enum(['image']).describe('Supported type: `image`.'), - transfer_method: z.enum(['remote_url', 'local_file']).describe('Transfer method, `remote_url` for image URL / `local_file` for file upload'), - url: z.string().describe('Image URL (when the transfer method is `remote_url`)').optional(), - upload_file_id: z.string().describe('Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)').optional(), -})) - -export type InputFileObjectZodType = z.infer - -export const zChatRequest = z.object({ - query: z.string().describe('User Input/Question content.'), - inputs: z.record(z.unknown()).describe('Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.').optional().default({}), - response_mode: z.enum(['streaming', 'blocking']).describe('Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.').optional(), - user: z.string().describe('User identifier, 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.'), - conversation_id: z.string().describe('Conversation ID to continue a conversation. Pass the previous message\'s conversation_id.').optional(), - files: z.array(zInputFileObject).describe('File list (images) for Vision-capable models.').optional(), - auto_generate_name: z.boolean().describe('Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.').optional().default(true), -}) - -export type ChatRequestZodType = z.infer - -/** - * Base schema for Server-Sent Event chunks in streaming mode. - */ -export const zChunkChatEvent = z.object({ - event: z.enum([ - 'message', - 'agent_message', - 'tts_message', - 'tts_message_end', - 'agent_thought', - 'message_file', - 'message_end', - 'message_replace', - 'error', - 'ping', - ]).describe('The type of event.'), -}).describe('Base schema for Server-Sent Event chunks in streaming mode.') - -export type ChunkChatEventZodType = z.infer - -export const zStreamEventBase = z.object({ - task_id: z.string().uuid().describe('Task ID.').optional(), - message_id: z.string().uuid().describe('Unique message ID.').optional(), - conversation_id: z.string().uuid().describe('Conversation ID.').optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(), -}) - -export type StreamEventBaseZodType = z.infer - -export const zStreamEventChatMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - answer: z.string().describe('LLM returned text chunk.'), - event: z.literal('message'), -})) - -export type StreamEventChatMessageZodType = z.infer - -export const zStreamEventChatAgentMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - answer: z.string().describe('LLM returned text chunk (Agent mode).'), - event: z.literal('agent_message'), -})) - -export type StreamEventChatAgentMessageZodType = z.infer - -export const zStreamEventChatTtsMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - audio: z.string().describe('Base64 encoded audio chunk.'), - event: z.literal('tts_message'), -}).describe('TTS audio stream event (base64 encoded Mp3). Available if auto-play enabled.')) - -export type StreamEventChatTtsMessageZodType = z.infer - -export const zStreamEventChatTtsMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - audio: z.string().describe('Empty string for end event.'), - event: z.literal('tts_message_end'), -}).describe('TTS audio stream end event.')) - -export type StreamEventChatTtsMessageEndZodType = z.infer - -export const zStreamEventChatAgentThought = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - id: z.string().uuid().describe('Agent thought ID.'), - position: z.number().int().describe('Position of this thought in the sequence for the message.'), - thought: z.string().describe('What LLM is thinking.').optional(), - observation: z.string().describe('Response from tool calls.').optional(), - tool: z.string().describe('List of tools called, split by \';\'.').optional(), - tool_input: z.string().describe('Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}.').optional(), - message_files: z.array(z.string().uuid()).describe('File IDs of files related to this thought (e.g., generated by a tool).').optional(), - event: z.literal('agent_thought'), -}).describe('Agent thought, LLM thinking, tool call details (Agent mode).')) - -export type StreamEventChatAgentThoughtZodType = z.infer - -export const zStreamEventChatMessageFile = zChunkChatEvent.and(z.object({ - id: z.string().uuid().describe('File unique ID.'), - type: z.enum(['image']).describe('File type, currently only \'image\'.'), - belongs_to: z.enum(['assistant']).describe('Who this file belongs to, always \'assistant\' here.'), - url: z.string().describe('Remote URL of the file.'), - conversation_id: z.string().uuid().describe('Conversation ID.'), - event: z.literal('message_file'), -}).describe('Message file event, a new file created by a tool.')) - -export type StreamEventChatMessageFileZodType = z.infer - -export const zStreamEventChatMessageReplace = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - answer: z.string().describe('Replacement content.'), - event: z.literal('message_replace'), -}).describe('Message content replacement event (e.g., due to content moderation).')) - -export type StreamEventChatMessageReplaceZodType = z.infer - -export const zStreamEventChatError = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - status: z.number().int().describe('HTTP status code.'), - code: z.string().describe('Error code.'), - message: z.string().describe('Error message.'), - event: z.literal('error'), -}).describe('Error event during streaming.')) - -export type StreamEventChatErrorZodType = z.infer - -export const zStreamEventChatPing = zChunkChatEvent.and(z.object({ - event: z.literal('ping'), -}).describe('Ping event to keep connection alive.')) - -export type StreamEventChatPingZodType = z.infer - -/** - * Model usage information. - */ -export const zUsage = z.object({ - prompt_tokens: z.number().int().optional(), - prompt_unit_price: z.string().optional(), - prompt_price_unit: z.string().optional(), - prompt_price: z.string().optional(), - completion_tokens: z.number().int().optional(), - completion_unit_price: z.string().optional(), - completion_price_unit: z.string().optional(), - completion_price: z.string().optional(), - total_tokens: z.number().int().optional(), - total_price: z.string().optional(), - currency: z.string().optional(), - latency: z.number().optional(), -}).describe('Model usage information.') - -export type UsageZodType = z.infer - -/** - * Citation and Attribution information for a resource. - */ -export const zRetrieverResource = z.object({ - position: z.number().int().describe('Position of the resource in the list.').optional(), - dataset_id: z.string().uuid().describe('ID of the dataset.').optional(), - dataset_name: z.string().describe('Name of the dataset.').optional(), - document_id: z.string().uuid().describe('ID of the document.').optional(), - document_name: z.string().describe('Name of the document.').optional(), - segment_id: z.string().uuid().describe('ID of the specific segment within the document.').optional(), - score: z.number().describe('Relevance score of the resource.').optional(), - content: z.string().describe('Content snippet from the resource.').optional(), -}).describe('Citation and Attribution information for a resource.') - -export type RetrieverResourceZodType = z.infer - -/** - * Response object for blocking mode chat completion. - */ -export const zChatCompletionResponse = z.object({ - event: z.string().describe('Event type, fixed as `message`.').optional(), - task_id: z.string().uuid().describe('Task ID for request tracking and stop response API.').optional(), - id: z.string().uuid().describe('Unique ID of this response/message event.').optional(), - message_id: z.string().uuid().describe('Unique message ID.').optional(), - conversation_id: z.string().uuid().describe('Conversation ID.').optional(), - mode: z.string().describe('App mode, fixed as `chat`.').optional(), - answer: z.string().describe('Complete response content.').optional(), - metadata: z.object({ - usage: zUsage.optional(), - retriever_resources: z.array(zRetrieverResource).optional(), - }).optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Message creation timestamp (Unix epoch seconds).').optional(), -}).describe('Response object for blocking mode chat completion.') - -export type ChatCompletionResponseZodType = z.infer - -export const zStreamEventChatMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({ - metadata: z.object({ - usage: zUsage.optional(), - retriever_resources: z.array(zRetrieverResource).optional(), - }), - event: z.literal('message_end'), -}).describe('Message end event, streaming has ended.')) - -export type StreamEventChatMessageEndZodType = z.infer - -export const zFileUploadResponse = z.object({ - id: z.string().uuid().optional(), - name: z.string().optional(), - size: z.number().int().optional(), - extension: z.string().optional(), - mime_type: z.string().optional(), - created_by: z.string().uuid().optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), -}) - -export type FileUploadResponseZodType = z.infer - -export const zMessageFeedbackRequest = z.object({ - rating: z.enum(['like', 'dislike']).nullable().optional(), - user: z.string(), - content: z.string().optional(), -}) - -export type MessageFeedbackRequestZodType = z.infer - -export const zFeedbackItem = z.object({ - id: z.string().uuid().optional(), - app_id: z.string().uuid().optional(), - conversation_id: z.string().uuid().optional(), - message_id: z.string().uuid().optional(), - rating: z.enum(['like', 'dislike']).nullable().optional(), - content: z.string().optional(), - from_source: z.string().optional(), - from_end_user_id: z.string().uuid().optional(), - from_account_id: z.union([ - z.string().uuid(), - z.null(), - ]).optional(), - created_at: z.string().datetime().optional(), - updated_at: z.string().datetime().optional(), -}) - -export type FeedbackItemZodType = z.infer - -export const zAppFeedbacksResponse = z.object({ - data: z.array(zFeedbackItem).optional(), -}) - -export type AppFeedbacksResponseZodType = z.infer - -export const zSuggestedQuestionsResponse = z.object({ - result: z.string().optional(), - data: z.array(z.string()).optional(), -}) - -export type SuggestedQuestionsResponseZodType = z.infer - -export const zMessageFileItem = z.object({ - id: z.string().uuid().optional(), - type: z.string().describe('File type, e.g., \'image\'.').optional(), - url: z.string().describe('Preview image URL.').optional(), - belongs_to: z.enum(['user', 'assistant']).describe('Who this file belongs to.').optional(), -}) - -export type MessageFileItemZodType = z.infer - -export const zAgentThoughtItem = z.object({ - id: z.string().uuid().describe('Agent thought ID.').optional(), - message_id: z.string().uuid().describe('Unique message ID this thought belongs to.').optional(), - position: z.number().int().describe('Position of this thought.').optional(), - thought: z.string().describe('What LLM is thinking.').optional(), - tool: z.string().describe('Tools called, split by \';\'.').optional(), - tool_input: z.string().describe('Input of tools in JSON format.').optional(), - observation: z.string().describe('Response from tool calls.').optional(), - files: z.array(z.string().uuid()).describe('File IDs related to this thought (from example, Markdown text says \'message_files\').').optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(), -}) - -export type AgentThoughtItemZodType = z.infer - -export const zConversationMessageItem = z.object({ - id: z.string().uuid().optional(), - conversation_id: z.string().uuid().optional(), - inputs: z.record(z.unknown()).optional(), - query: z.string().optional(), - answer: z.string().optional(), - message_files: z.array(zMessageFileItem).optional(), - feedback: z.union([ - z.object({ - rating: z.enum(['like', 'dislike']).optional(), - }), - z.null(), - ]).optional(), - retriever_resources: z.array(zRetrieverResource).optional(), - agent_thoughts: z.array(zAgentThoughtItem).optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), -}) - -export type ConversationMessageItemZodType = z.infer - -export const zConversationHistoryResponse = z.object({ - limit: z.number().int().optional(), - has_more: z.boolean().optional(), - data: z.array(zConversationMessageItem).optional(), -}) - -export type ConversationHistoryResponseZodType = z.infer - -export const zConversationListItem = z.object({ - id: z.string().uuid().optional(), - name: z.string().optional(), - inputs: z.record(z.unknown()).optional(), - status: z.string().optional(), - introduction: z.string().optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), - updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), -}) - -export type ConversationListItemZodType = z.infer - -export const zConversationsListResponse = z.object({ - limit: z.number().int().optional(), - has_more: z.boolean().optional(), - data: z.array(zConversationListItem).optional(), -}) - -export type ConversationsListResponseZodType = z.infer - -export const zConversationRenameRequest = z.object({ - name: z.string().describe('(Optional) The name of the conversation. Omit if auto_generate is true.').optional(), - auto_generate: z.boolean().describe('(Optional) Automatically generate the title. Default false.').optional().default(false), - user: z.string().describe('The user identifier.'), -}) - -export type ConversationRenameRequestZodType = z.infer - -export const zConversationRenameResponse = zConversationListItem - -export type ConversationRenameResponseZodType = z.infer - -export const zConversationVariableItem = z.object({ - id: z.string().uuid().describe('Variable ID.').optional(), - name: z.string().describe('Variable name.').optional(), - value_type: z.string().describe('Variable type (string, number, object, json, etc.).').optional(), - value: z.string().describe('Variable value (can be a JSON string for complex types).').optional(), - description: z.string().describe('Variable description.').optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(), - updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Last update timestamp.').optional(), -}) - -export type ConversationVariableItemZodType = z.infer - -export const zConversationVariablesResponse = z.object({ - limit: z.number().int().describe('Number of items per page.').optional(), - has_more: z.boolean().describe('Whether there is a next page.').optional(), - data: z.array(zConversationVariableItem).optional(), -}) - -export type ConversationVariablesResponseZodType = z.infer - -export const zAudioToTextRequest = z.object({ - file: z.string().describe('Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB.'), - user: z.string().describe('User identifier.'), -}) - -export type AudioToTextRequestZodType = z.infer - -export const zAudioToTextResponse = z.object({ - text: z.string().describe('Output text from speech recognition.').optional(), -}) - -export type AudioToTextResponseZodType = z.infer - -/** - * Requires `user`. Provide either `message_id` or `text`. - */ -export const zTextToAudioFormRequest = z.object({ - message_id: z.string().uuid().describe('Message ID (priority if both text and message_id provided).').optional(), - text: z.string().describe('Speech content.').optional(), - user: z.string().describe('User identifier.'), -}).describe('Requires `user`. Provide either `message_id` or `text`.') - -export type TextToAudioFormRequestZodType = z.infer - -export const zAppInfoResponse = z.object({ - name: z.string().optional(), - description: z.string().optional(), - tags: z.array(z.string()).optional(), -}) - -export type AppInfoResponseZodType = z.infer - -export const zTextInputControl = z.object({ - label: z.string(), - variable: z.string(), - required: z.boolean(), - default: z.string().optional(), -}) - -export type TextInputControlZodType = z.infer - -export const zTextInputControlWrapper = z.object({ - 'text-input': zTextInputControl, -}) - -export type TextInputControlWrapperZodType = z.infer - -export const zParagraphControl = z.object({ - label: z.string(), - variable: z.string(), - required: z.boolean(), - default: z.string().optional(), -}) - -export type ParagraphControlZodType = z.infer - -export const zParagraphControlWrapper = z.object({ - paragraph: zParagraphControl, -}) - -export type ParagraphControlWrapperZodType = z.infer - -export const zSelectControl = z.object({ - label: z.string(), - variable: z.string(), - required: z.boolean(), - default: z.string().optional(), - options: z.array(z.string()), -}) - -export type SelectControlZodType = z.infer - -export const zSelectControlWrapper = z.object({ - select: zSelectControl, -}) - -export type SelectControlWrapperZodType = z.infer - -export const zUserInputFormItem = z.union([ - zTextInputControlWrapper, - zParagraphControlWrapper, - zSelectControlWrapper, -]) - -export type UserInputFormItemZodType = z.infer - -export const zChatAppParametersResponse = z.object({ - opening_statement: z.string().optional(), - suggested_questions: z.array(z.string()).optional(), - suggested_questions_after_answer: z.object({ - enabled: z.boolean().optional(), - }).optional(), - speech_to_text: z.object({ - enabled: z.boolean().optional(), - }).optional(), - text_to_speech: z.object({ - enabled: z.boolean().optional(), - voice: z.string().optional(), - language: z.string().optional(), - autoPlay: z.enum(['enabled', 'disabled']).optional(), - }).optional(), - retriever_resource: z.object({ - enabled: z.boolean().optional(), - }).optional(), - annotation_reply: z.object({ - enabled: z.boolean().optional(), - }).optional(), - user_input_form: z.array(zUserInputFormItem).optional(), - file_upload: z.object({ - image: z.object({ - enabled: z.boolean().optional(), - number_limits: z.number().int().optional(), - detail: z.string().optional(), - transfer_methods: z.array(z.enum(['remote_url', 'local_file'])).optional(), - }).optional(), - }).optional(), - system_parameters: z.object({ - file_size_limit: z.number().int().optional(), - image_file_size_limit: z.number().int().optional(), - audio_file_size_limit: z.number().int().optional(), - video_file_size_limit: z.number().int().optional(), - }).optional(), -}) - -export type ChatAppParametersResponseZodType = z.infer - -export const zToolIconDetail = z.object({ - background: z.string().describe('Background color in hex format.').optional(), - content: z.string().describe('Emoji content.').optional(), -}) - -export type ToolIconDetailZodType = z.infer - -export const zAppMetaResponse = z.object({ - tool_icons: z.record(z.union([ - z.string().describe('URL of the icon.'), - zToolIconDetail, - ])).describe('Tool icons. Keys are tool names.').optional(), -}) - -export type AppMetaResponseZodType = z.infer - -export const zWebAppSettingsResponse = z.object({ - title: z.string().optional(), - chat_color_theme: z.string().optional(), - chat_color_theme_inverted: z.boolean().optional(), - icon_type: z.enum(['emoji', 'image']).optional(), - icon: z.string().optional(), - icon_background: z.string().optional(), - icon_url: z.union([ - z.string(), - z.null(), - ]).optional(), - description: z.string().optional(), - copyright: z.string().optional(), - privacy_policy: z.string().optional(), - custom_disclaimer: z.string().optional(), - default_language: z.string().optional(), - show_workflow_steps: z.boolean().optional(), - use_icon_as_answer_icon: z.boolean().optional(), -}) - -export type WebAppSettingsResponseZodType = z.infer - -export const zAnnotationItem = z.object({ - id: z.string().uuid().optional(), - question: z.string().optional(), - answer: z.string().optional(), - hit_count: z.number().int().optional(), - created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), -}) - -export type AnnotationItemZodType = z.infer - -export const zAnnotationListResponse = z.object({ - data: z.array(zAnnotationItem).optional(), - has_more: z.boolean().optional(), - limit: z.number().int().optional(), - total: z.number().int().optional(), - page: z.number().int().optional(), -}) - -export type AnnotationListResponseZodType = z.infer - -export const zCreateAnnotationRequest = z.object({ - question: z.string(), - answer: z.string(), -}) - -export type CreateAnnotationRequestZodType = z.infer - -export const zUpdateAnnotationRequest = z.object({ - question: z.string(), - answer: z.string(), -}) - -export type UpdateAnnotationRequestZodType = z.infer - -export const zInitialAnnotationReplySettingsRequest = z.object({ - embedding_provider_name: z.string().describe('Specified embedding model provider name (Optional).').optional(), - embedding_model_name: z.string().describe('Specified embedding model name (Optional).').optional(), - score_threshold: z.number().describe('Similarity threshold for matching annotated replies.'), -}) - -export type InitialAnnotationReplySettingsRequestZodType = z.infer - -export const zInitialAnnotationReplySettingsResponse = z.object({ - job_id: z.string().uuid().optional(), - job_status: z.string().optional(), -}) - -export type InitialAnnotationReplySettingsResponseZodType = z.infer - -export const zInitialAnnotationReplySettingsStatusResponse = z.object({ - job_id: z.string().uuid().optional(), - job_status: z.string().optional(), - error_msg: z.union([ - z.string(), - z.null(), - ]).optional(), -}) - -export type InitialAnnotationReplySettingsStatusResponseZodType = z.infer - -export const zErrorResponse = z.object({ - status: z.number().int().optional(), - code: z.string().optional(), - message: z.string().optional(), -}) - -export type ErrorResponseZodType = z.infer diff --git a/web/gen/zod/models/agent.gen.ts b/web/gen/zod/models/agent.gen.ts new file mode 100644 index 0000000000..121c6f85a4 --- /dev/null +++ b/web/gen/zod/models/agent.gen.ts @@ -0,0 +1,17 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zAgentThoughtItem = z.object({ + id: z.string().uuid().describe('Agent thought ID.').optional(), + message_id: z.string().uuid().describe('Unique message ID this thought belongs to.').optional(), + position: z.number().int().describe('Position of this thought.').optional(), + thought: z.string().describe('What LLM is thinking.').optional(), + tool: z.string().describe('Tools called, split by \';\'.').optional(), + tool_input: z.string().describe('Input of tools in JSON format.').optional(), + observation: z.string().describe('Response from tool calls.').optional(), + files: z.array(z.string().uuid()).describe('File IDs related to this thought (from example, Markdown text says \'message_files\').').optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(), +}) + +export type AgentThoughtItemZodType = z.infer diff --git a/web/gen/zod/models/annotation.gen.ts b/web/gen/zod/models/annotation.gen.ts new file mode 100644 index 0000000000..e2202f7de9 --- /dev/null +++ b/web/gen/zod/models/annotation.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zAnnotationItem = z.object({ + id: z.string().uuid().optional(), + question: z.string().optional(), + answer: z.string().optional(), + hit_count: z.number().int().optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), +}) + +export type AnnotationItemZodType = z.infer + +export const zAnnotationListResponse = z.object({ + data: z.array(zAnnotationItem).optional(), + has_more: z.boolean().optional(), + limit: z.number().int().optional(), + total: z.number().int().optional(), + page: z.number().int().optional(), +}) + +export type AnnotationListResponseZodType = z.infer diff --git a/web/gen/zod/models/app.gen.ts b/web/gen/zod/models/app.gen.ts new file mode 100644 index 0000000000..0d89d09286 --- /dev/null +++ b/web/gen/zod/models/app.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zFeedbackItem } from './feedback.gen' +import { zToolIconDetail } from './tool.gen' + +export const zAppFeedbacksResponse = z.object({ + data: z.array(zFeedbackItem).optional(), +}) + +export type AppFeedbacksResponseZodType = z.infer + +export const zAppInfoResponse = z.object({ + name: z.string().optional(), + description: z.string().optional(), + tags: z.array(z.string()).optional(), +}) + +export type AppInfoResponseZodType = z.infer + +export const zAppMetaResponse = z.object({ + tool_icons: z.record(z.union([ + z.string().describe('URL of the icon.'), + zToolIconDetail, + ])).describe('Tool icons. Keys are tool names.').optional(), +}) + +export type AppMetaResponseZodType = z.infer diff --git a/web/gen/zod/models/audio.gen.ts b/web/gen/zod/models/audio.gen.ts new file mode 100644 index 0000000000..5d71b9ae4f --- /dev/null +++ b/web/gen/zod/models/audio.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zAudioToTextRequest = z.object({ + file: z.string().describe('Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB.'), + user: z.string().describe('User identifier.'), +}) + +export type AudioToTextRequestZodType = z.infer + +export const zAudioToTextResponse = z.object({ + text: z.string().describe('Output text from speech recognition.').optional(), +}) + +export type AudioToTextResponseZodType = z.infer diff --git a/web/gen/zod/models/chat.gen.ts b/web/gen/zod/models/chat.gen.ts new file mode 100644 index 0000000000..7297080034 --- /dev/null +++ b/web/gen/zod/models/chat.gen.ts @@ -0,0 +1,80 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zInputFileObject } from './input.gen' +import { zRetrieverResource } from './retriever.gen' +import { zUsage } from './usage.gen' +import { zUserInputFormItem } from './user.gen' + +export const zChatRequest = z.object({ + query: z.string().describe('User Input/Question content.'), + inputs: z.record(z.unknown()).describe('Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.').optional().default({}), + response_mode: z.enum(['streaming', 'blocking']).describe('Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.').optional(), + user: z.string().describe('User identifier, 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.'), + conversation_id: z.string().describe('Conversation ID to continue a conversation. Pass the previous message\'s conversation_id.').optional(), + files: z.array(zInputFileObject).describe('File list (images) for Vision-capable models.').optional(), + auto_generate_name: z.boolean().describe('Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.').optional().default(true), +}) + +export type ChatRequestZodType = z.infer + +/** + * Response object for blocking mode chat completion. + */ +export const zChatCompletionResponse = z.object({ + event: z.string().describe('Event type, fixed as `message`.').optional(), + task_id: z.string().uuid().describe('Task ID for request tracking and stop response API.').optional(), + id: z.string().uuid().describe('Unique ID of this response/message event.').optional(), + message_id: z.string().uuid().describe('Unique message ID.').optional(), + conversation_id: z.string().uuid().describe('Conversation ID.').optional(), + mode: z.string().describe('App mode, fixed as `chat`.').optional(), + answer: z.string().describe('Complete response content.').optional(), + metadata: z.object({ + usage: zUsage.optional(), + retriever_resources: z.array(zRetrieverResource).optional(), + }).optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Message creation timestamp (Unix epoch seconds).').optional(), +}).describe('Response object for blocking mode chat completion.') + +export type ChatCompletionResponseZodType = z.infer + +export const zChatAppParametersResponse = z.object({ + opening_statement: z.string().optional(), + suggested_questions: z.array(z.string()).optional(), + suggested_questions_after_answer: z.object({ + enabled: z.boolean().optional(), + }).optional(), + speech_to_text: z.object({ + enabled: z.boolean().optional(), + }).optional(), + text_to_speech: z.object({ + enabled: z.boolean().optional(), + voice: z.string().optional(), + language: z.string().optional(), + autoPlay: z.enum(['enabled', 'disabled']).optional(), + }).optional(), + retriever_resource: z.object({ + enabled: z.boolean().optional(), + }).optional(), + annotation_reply: z.object({ + enabled: z.boolean().optional(), + }).optional(), + user_input_form: z.array(zUserInputFormItem).optional(), + file_upload: z.object({ + image: z.object({ + enabled: z.boolean().optional(), + number_limits: z.number().int().optional(), + detail: z.string().optional(), + transfer_methods: z.array(z.enum(['remote_url', 'local_file'])).optional(), + }).optional(), + }).optional(), + system_parameters: z.object({ + file_size_limit: z.number().int().optional(), + image_file_size_limit: z.number().int().optional(), + audio_file_size_limit: z.number().int().optional(), + video_file_size_limit: z.number().int().optional(), + }).optional(), +}) + +export type ChatAppParametersResponseZodType = z.infer diff --git a/web/gen/zod/models/chunk.gen.ts b/web/gen/zod/models/chunk.gen.ts new file mode 100644 index 0000000000..068bec1035 --- /dev/null +++ b/web/gen/zod/models/chunk.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +/** + * Base schema for Server-Sent Event chunks in streaming mode. + */ +export const zChunkChatEvent = z.object({ + event: z.enum([ + 'message', + 'agent_message', + 'tts_message', + 'tts_message_end', + 'agent_thought', + 'message_file', + 'message_end', + 'message_replace', + 'error', + 'ping', + ]).describe('The type of event.'), +}).describe('Base schema for Server-Sent Event chunks in streaming mode.') + +export type ChunkChatEventZodType = z.infer diff --git a/web/gen/zod/models/conversation.gen.ts b/web/gen/zod/models/conversation.gen.ts new file mode 100644 index 0000000000..c2a5b81522 --- /dev/null +++ b/web/gen/zod/models/conversation.gen.ts @@ -0,0 +1,79 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zAgentThoughtItem } from './agent.gen' +import { zMessageFileItem } from './message.gen' +import { zRetrieverResource } from './retriever.gen' + +export const zConversationMessageItem = z.object({ + id: z.string().uuid().optional(), + conversation_id: z.string().uuid().optional(), + inputs: z.record(z.unknown()).optional(), + query: z.string().optional(), + answer: z.string().optional(), + message_files: z.array(zMessageFileItem).optional(), + feedback: z.union([ + z.object({ + rating: z.enum(['like', 'dislike']).optional(), + }), + z.null(), + ]).optional(), + retriever_resources: z.array(zRetrieverResource).optional(), + agent_thoughts: z.array(zAgentThoughtItem).optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), +}) + +export type ConversationMessageItemZodType = z.infer + +export const zConversationHistoryResponse = z.object({ + limit: z.number().int().optional(), + has_more: z.boolean().optional(), + data: z.array(zConversationMessageItem).optional(), +}) + +export type ConversationHistoryResponseZodType = z.infer + +export const zConversationListItem = z.object({ + id: z.string().uuid().optional(), + name: z.string().optional(), + inputs: z.record(z.unknown()).optional(), + status: z.string().optional(), + introduction: z.string().optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), + updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), +}) + +export type ConversationListItemZodType = z.infer + +export const zConversationRenameRequest = z.object({ + name: z.string().describe('(Optional) The name of the conversation. Omit if auto_generate is true.').optional(), + auto_generate: z.boolean().describe('(Optional) Automatically generate the title. Default false.').optional().default(false), + user: z.string().describe('The user identifier.'), +}) + +export type ConversationRenameRequestZodType = z.infer + +export const zConversationRenameResponse = zConversationListItem + +export type ConversationRenameResponseZodType = z.infer + +export const zConversationVariableItem = z.object({ + id: z.string().uuid().describe('Variable ID.').optional(), + name: z.string().describe('Variable name.').optional(), + value_type: z.string().describe('Variable type (string, number, object, json, etc.).').optional(), + value: z.string().describe('Variable value (can be a JSON string for complex types).').optional(), + description: z.string().describe('Variable description.').optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(), + updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Last update timestamp.').optional(), +}) + +export type ConversationVariableItemZodType = z.infer + +export const zConversationVariablesResponse = z.object({ + limit: z.number().int().describe('Number of items per page.').optional(), + has_more: z.boolean().describe('Whether there is a next page.').optional(), + data: z.array(zConversationVariableItem).optional(), +}) + +export type ConversationVariablesResponseZodType = z.infer diff --git a/web/gen/zod/models/conversations.gen.ts b/web/gen/zod/models/conversations.gen.ts new file mode 100644 index 0000000000..4e56be04b1 --- /dev/null +++ b/web/gen/zod/models/conversations.gen.ts @@ -0,0 +1,13 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zConversationListItem } from './conversation.gen' + +export const zConversationsListResponse = z.object({ + limit: z.number().int().optional(), + has_more: z.boolean().optional(), + data: z.array(zConversationListItem).optional(), +}) + +export type ConversationsListResponseZodType = z.infer diff --git a/web/gen/zod/models/create.gen.ts b/web/gen/zod/models/create.gen.ts new file mode 100644 index 0000000000..d3c6c70401 --- /dev/null +++ b/web/gen/zod/models/create.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zCreateAnnotationRequest = z.object({ + question: z.string(), + answer: z.string(), +}) + +export type CreateAnnotationRequestZodType = z.infer diff --git a/web/gen/zod/models/error.gen.ts b/web/gen/zod/models/error.gen.ts new file mode 100644 index 0000000000..19b6d5f079 --- /dev/null +++ b/web/gen/zod/models/error.gen.ts @@ -0,0 +1,11 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zErrorResponse = z.object({ + status: z.number().int().optional(), + code: z.string().optional(), + message: z.string().optional(), +}) + +export type ErrorResponseZodType = z.infer diff --git a/web/gen/zod/models/feedback.gen.ts b/web/gen/zod/models/feedback.gen.ts new file mode 100644 index 0000000000..912a169aea --- /dev/null +++ b/web/gen/zod/models/feedback.gen.ts @@ -0,0 +1,22 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zFeedbackItem = z.object({ + id: z.string().uuid().optional(), + app_id: z.string().uuid().optional(), + conversation_id: z.string().uuid().optional(), + message_id: z.string().uuid().optional(), + rating: z.enum(['like', 'dislike']).nullable().optional(), + content: z.string().optional(), + from_source: z.string().optional(), + from_end_user_id: z.string().uuid().optional(), + from_account_id: z.union([ + z.string().uuid(), + z.null(), + ]).optional(), + created_at: z.string().datetime().optional(), + updated_at: z.string().datetime().optional(), +}) + +export type FeedbackItemZodType = z.infer diff --git a/web/gen/zod/models/file.gen.ts b/web/gen/zod/models/file.gen.ts new file mode 100644 index 0000000000..49eded8219 --- /dev/null +++ b/web/gen/zod/models/file.gen.ts @@ -0,0 +1,15 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zFileUploadResponse = z.object({ + id: z.string().uuid().optional(), + name: z.string().optional(), + size: z.number().int().optional(), + extension: z.string().optional(), + mime_type: z.string().optional(), + created_by: z.string().uuid().optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(), +}) + +export type FileUploadResponseZodType = z.infer diff --git a/web/gen/zod/models/initial.gen.ts b/web/gen/zod/models/initial.gen.ts new file mode 100644 index 0000000000..621d8db414 --- /dev/null +++ b/web/gen/zod/models/initial.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zInitialAnnotationReplySettingsRequest = z.object({ + embedding_provider_name: z.string().describe('Specified embedding model provider name (Optional).').optional(), + embedding_model_name: z.string().describe('Specified embedding model name (Optional).').optional(), + score_threshold: z.number().describe('Similarity threshold for matching annotated replies.'), +}) + +export type InitialAnnotationReplySettingsRequestZodType = z.infer + +export const zInitialAnnotationReplySettingsResponse = z.object({ + job_id: z.string().uuid().optional(), + job_status: z.string().optional(), +}) + +export type InitialAnnotationReplySettingsResponseZodType = z.infer + +export const zInitialAnnotationReplySettingsStatusResponse = z.object({ + job_id: z.string().uuid().optional(), + job_status: z.string().optional(), + error_msg: z.union([ + z.string(), + z.null(), + ]).optional(), +}) + +export type InitialAnnotationReplySettingsStatusResponseZodType = z.infer diff --git a/web/gen/zod/models/input.gen.ts b/web/gen/zod/models/input.gen.ts new file mode 100644 index 0000000000..0456b5ceb3 --- /dev/null +++ b/web/gen/zod/models/input.gen.ts @@ -0,0 +1,21 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zInputFileObject = z.intersection(z.union([ + z.object({ + transfer_method: z.enum(['remote_url']).optional(), + url: z.string(), + }), + z.object({ + transfer_method: z.enum(['local_file']).optional(), + upload_file_id: z.string(), + }), +]), z.object({ + type: z.enum(['image']).describe('Supported type: `image`.'), + transfer_method: z.enum(['remote_url', 'local_file']).describe('Transfer method, `remote_url` for image URL / `local_file` for file upload'), + url: z.string().describe('Image URL (when the transfer method is `remote_url`)').optional(), + upload_file_id: z.string().describe('Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)').optional(), +})) + +export type InputFileObjectZodType = z.infer diff --git a/web/gen/zod/models/message.gen.ts b/web/gen/zod/models/message.gen.ts new file mode 100644 index 0000000000..d37f1e88d1 --- /dev/null +++ b/web/gen/zod/models/message.gen.ts @@ -0,0 +1,20 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zMessageFeedbackRequest = z.object({ + rating: z.enum(['like', 'dislike']).nullable().optional(), + user: z.string(), + content: z.string().optional(), +}) + +export type MessageFeedbackRequestZodType = z.infer + +export const zMessageFileItem = z.object({ + id: z.string().uuid().optional(), + type: z.string().describe('File type, e.g., \'image\'.').optional(), + url: z.string().describe('Preview image URL.').optional(), + belongs_to: z.enum(['user', 'assistant']).describe('Who this file belongs to.').optional(), +}) + +export type MessageFileItemZodType = z.infer diff --git a/web/gen/zod/models/paragraph.gen.ts b/web/gen/zod/models/paragraph.gen.ts new file mode 100644 index 0000000000..6d91c1070f --- /dev/null +++ b/web/gen/zod/models/paragraph.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zParagraphControl = z.object({ + label: z.string(), + variable: z.string(), + required: z.boolean(), + default: z.string().optional(), +}) + +export type ParagraphControlZodType = z.infer + +export const zParagraphControlWrapper = z.object({ + paragraph: zParagraphControl, +}) + +export type ParagraphControlWrapperZodType = z.infer diff --git a/web/gen/zod/models/retriever.gen.ts b/web/gen/zod/models/retriever.gen.ts new file mode 100644 index 0000000000..00c2c62220 --- /dev/null +++ b/web/gen/zod/models/retriever.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +/** + * Citation and Attribution information for a resource. + */ +export const zRetrieverResource = z.object({ + position: z.number().int().describe('Position of the resource in the list.').optional(), + dataset_id: z.string().uuid().describe('ID of the dataset.').optional(), + dataset_name: z.string().describe('Name of the dataset.').optional(), + document_id: z.string().uuid().describe('ID of the document.').optional(), + document_name: z.string().describe('Name of the document.').optional(), + segment_id: z.string().uuid().describe('ID of the specific segment within the document.').optional(), + score: z.number().describe('Relevance score of the resource.').optional(), + content: z.string().describe('Content snippet from the resource.').optional(), +}).describe('Citation and Attribution information for a resource.') + +export type RetrieverResourceZodType = z.infer diff --git a/web/gen/zod/models/select.gen.ts b/web/gen/zod/models/select.gen.ts new file mode 100644 index 0000000000..67d82a1a46 --- /dev/null +++ b/web/gen/zod/models/select.gen.ts @@ -0,0 +1,19 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zSelectControl = z.object({ + label: z.string(), + variable: z.string(), + required: z.boolean(), + default: z.string().optional(), + options: z.array(z.string()), +}) + +export type SelectControlZodType = z.infer + +export const zSelectControlWrapper = z.object({ + select: zSelectControl, +}) + +export type SelectControlWrapperZodType = z.infer diff --git a/web/gen/zod/models/stream.gen.ts b/web/gen/zod/models/stream.gen.ts new file mode 100644 index 0000000000..b057e2d862 --- /dev/null +++ b/web/gen/zod/models/stream.gen.ts @@ -0,0 +1,100 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zChunkChatEvent } from './chunk.gen' +import { zRetrieverResource } from './retriever.gen' +import { zUsage } from './usage.gen' + +export const zStreamEventBase = z.object({ + task_id: z.string().uuid().describe('Task ID.').optional(), + message_id: z.string().uuid().describe('Unique message ID.').optional(), + conversation_id: z.string().uuid().describe('Conversation ID.').optional(), + created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(), +}) + +export type StreamEventBaseZodType = z.infer + +export const zStreamEventChatMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + answer: z.string().describe('LLM returned text chunk.'), + event: z.literal('message'), +})) + +export type StreamEventChatMessageZodType = z.infer + +export const zStreamEventChatAgentMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + answer: z.string().describe('LLM returned text chunk (Agent mode).'), + event: z.literal('agent_message'), +})) + +export type StreamEventChatAgentMessageZodType = z.infer + +export const zStreamEventChatTtsMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + audio: z.string().describe('Base64 encoded audio chunk.'), + event: z.literal('tts_message'), +}).describe('TTS audio stream event (base64 encoded Mp3). Available if auto-play enabled.')) + +export type StreamEventChatTtsMessageZodType = z.infer + +export const zStreamEventChatTtsMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + audio: z.string().describe('Empty string for end event.'), + event: z.literal('tts_message_end'), +}).describe('TTS audio stream end event.')) + +export type StreamEventChatTtsMessageEndZodType = z.infer + +export const zStreamEventChatAgentThought = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + id: z.string().uuid().describe('Agent thought ID.'), + position: z.number().int().describe('Position of this thought in the sequence for the message.'), + thought: z.string().describe('What LLM is thinking.').optional(), + observation: z.string().describe('Response from tool calls.').optional(), + tool: z.string().describe('List of tools called, split by \';\'.').optional(), + tool_input: z.string().describe('Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}.').optional(), + message_files: z.array(z.string().uuid()).describe('File IDs of files related to this thought (e.g., generated by a tool).').optional(), + event: z.literal('agent_thought'), +}).describe('Agent thought, LLM thinking, tool call details (Agent mode).')) + +export type StreamEventChatAgentThoughtZodType = z.infer + +export const zStreamEventChatMessageFile = zChunkChatEvent.and(z.object({ + id: z.string().uuid().describe('File unique ID.'), + type: z.enum(['image']).describe('File type, currently only \'image\'.'), + belongs_to: z.enum(['assistant']).describe('Who this file belongs to, always \'assistant\' here.'), + url: z.string().describe('Remote URL of the file.'), + conversation_id: z.string().uuid().describe('Conversation ID.'), + event: z.literal('message_file'), +}).describe('Message file event, a new file created by a tool.')) + +export type StreamEventChatMessageFileZodType = z.infer + +export const zStreamEventChatMessageReplace = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + answer: z.string().describe('Replacement content.'), + event: z.literal('message_replace'), +}).describe('Message content replacement event (e.g., due to content moderation).')) + +export type StreamEventChatMessageReplaceZodType = z.infer + +export const zStreamEventChatError = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + status: z.number().int().describe('HTTP status code.'), + code: z.string().describe('Error code.'), + message: z.string().describe('Error message.'), + event: z.literal('error'), +}).describe('Error event during streaming.')) + +export type StreamEventChatErrorZodType = z.infer + +export const zStreamEventChatPing = zChunkChatEvent.and(z.object({ + event: z.literal('ping'), +}).describe('Ping event to keep connection alive.')) + +export type StreamEventChatPingZodType = z.infer + +export const zStreamEventChatMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({ + metadata: z.object({ + usage: zUsage.optional(), + retriever_resources: z.array(zRetrieverResource).optional(), + }), + event: z.literal('message_end'), +}).describe('Message end event, streaming has ended.')) + +export type StreamEventChatMessageEndZodType = z.infer diff --git a/web/gen/zod/models/suggested.gen.ts b/web/gen/zod/models/suggested.gen.ts new file mode 100644 index 0000000000..95542da1c9 --- /dev/null +++ b/web/gen/zod/models/suggested.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zSuggestedQuestionsResponse = z.object({ + result: z.string().optional(), + data: z.array(z.string()).optional(), +}) + +export type SuggestedQuestionsResponseZodType = z.infer diff --git a/web/gen/zod/models/text.gen.ts b/web/gen/zod/models/text.gen.ts new file mode 100644 index 0000000000..55409ee281 --- /dev/null +++ b/web/gen/zod/models/text.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +/** + * Requires `user`. Provide either `message_id` or `text`. + */ +export const zTextToAudioFormRequest = z.object({ + message_id: z.string().uuid().describe('Message ID (priority if both text and message_id provided).').optional(), + text: z.string().describe('Speech content.').optional(), + user: z.string().describe('User identifier.'), +}).describe('Requires `user`. Provide either `message_id` or `text`.') + +export type TextToAudioFormRequestZodType = z.infer + +export const zTextInputControl = z.object({ + label: z.string(), + variable: z.string(), + required: z.boolean(), + default: z.string().optional(), +}) + +export type TextInputControlZodType = z.infer + +export const zTextInputControlWrapper = z.object({ + 'text-input': zTextInputControl, +}) + +export type TextInputControlWrapperZodType = z.infer diff --git a/web/gen/zod/models/tool.gen.ts b/web/gen/zod/models/tool.gen.ts new file mode 100644 index 0000000000..9424e9503d --- /dev/null +++ b/web/gen/zod/models/tool.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zToolIconDetail = z.object({ + background: z.string().describe('Background color in hex format.').optional(), + content: z.string().describe('Emoji content.').optional(), +}) + +export type ToolIconDetailZodType = z.infer diff --git a/web/gen/zod/models/update.gen.ts b/web/gen/zod/models/update.gen.ts new file mode 100644 index 0000000000..b4f6383e60 --- /dev/null +++ b/web/gen/zod/models/update.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zUpdateAnnotationRequest = z.object({ + question: z.string(), + answer: z.string(), +}) + +export type UpdateAnnotationRequestZodType = z.infer diff --git a/web/gen/zod/models/usage.gen.ts b/web/gen/zod/models/usage.gen.ts new file mode 100644 index 0000000000..8ad7d71e85 --- /dev/null +++ b/web/gen/zod/models/usage.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +/** + * Model usage information. + */ +export const zUsage = z.object({ + prompt_tokens: z.number().int().optional(), + prompt_unit_price: z.string().optional(), + prompt_price_unit: z.string().optional(), + prompt_price: z.string().optional(), + completion_tokens: z.number().int().optional(), + completion_unit_price: z.string().optional(), + completion_price_unit: z.string().optional(), + completion_price: z.string().optional(), + total_tokens: z.number().int().optional(), + total_price: z.string().optional(), + currency: z.string().optional(), + latency: z.number().optional(), +}).describe('Model usage information.') + +export type UsageZodType = z.infer diff --git a/web/gen/zod/models/user.gen.ts b/web/gen/zod/models/user.gen.ts new file mode 100644 index 0000000000..f2c863233f --- /dev/null +++ b/web/gen/zod/models/user.gen.ts @@ -0,0 +1,15 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +import { zParagraphControlWrapper } from './paragraph.gen' +import { zSelectControlWrapper } from './select.gen' +import { zTextInputControlWrapper } from './text.gen' + +export const zUserInputFormItem = z.union([ + zTextInputControlWrapper, + zParagraphControlWrapper, + zSelectControlWrapper, +]) + +export type UserInputFormItemZodType = z.infer diff --git a/web/gen/zod/models/web.gen.ts b/web/gen/zod/models/web.gen.ts new file mode 100644 index 0000000000..cb1e76b680 --- /dev/null +++ b/web/gen/zod/models/web.gen.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { z } from 'zod' + +export const zWebAppSettingsResponse = z.object({ + title: z.string().optional(), + chat_color_theme: z.string().optional(), + chat_color_theme_inverted: z.boolean().optional(), + icon_type: z.enum(['emoji', 'image']).optional(), + icon: z.string().optional(), + icon_background: z.string().optional(), + icon_url: z.union([ + z.string(), + z.null(), + ]).optional(), + description: z.string().optional(), + copyright: z.string().optional(), + privacy_policy: z.string().optional(), + custom_disclaimer: z.string().optional(), + default_language: z.string().optional(), + show_workflow_steps: z.boolean().optional(), + use_icon_as_answer_icon: z.boolean().optional(), +}) + +export type WebAppSettingsResponseZodType = z.infer diff --git a/web/openapi-ts.config.ts b/web/openapi-ts.config.ts index e3c0605a97..94b6648c17 100644 --- a/web/openapi-ts.config.ts +++ b/web/openapi-ts.config.ts @@ -24,6 +24,22 @@ function getApiSegment(path: readonly (string | number)[] | undefined): string | return apiPath.split('/').filter(Boolean)[0] } +// Extract schema name prefix from path array +// e.g., ["components", "schemas", "ChatRequest"] → "chat" +// e.g., ["components", "schemas", "StreamEventBase"] → "stream" +// e.g., ["components", "schemas", "ErrorResponse"] → "error" +function getSchemaPrefix(path: readonly (string | number)[] | undefined): string | undefined { + if (!path || path[0] !== 'components' || path[1] !== 'schemas') + return undefined + const schemaName = path[2] + if (typeof schemaName !== 'string') + return undefined + // Split PascalCase into words and take the first word + // e.g., "ChatRequest" → ["Chat", "Request"] → "chat" + const match = schemaName.match(/^[A-Z][a-z]*/) + return match?.[0]?.toLowerCase() +} + // Get file path based on symbol metadata (mixed strategy) function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined { const meta = symbol.meta @@ -33,7 +49,8 @@ function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined { // Handle typescript plugin symbols if (meta.tool === 'typescript') { if (meta.resource === 'definition') { - return 'types/models' + const prefix = getSchemaPrefix(meta.path) + return `types/models/${prefix ?? 'common'}` } if (meta.resource === 'operation') { const segment = getApiSegment(meta.path) @@ -45,7 +62,8 @@ function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined { // Handle zod plugin symbols if (meta.tool === 'zod') { if (meta.resource === 'definition') { - return 'zod/models' + const prefix = getSchemaPrefix(meta.path) + return `zod/models/${prefix ?? 'common'}` } if (meta.resource === 'operation') { const segment = getApiSegment(meta.path)