From 7fe1457f7c76d29e4fd31dadfb41a043d48f73e1 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Sat, 24 Jan 2026 23:45:23 +0800 Subject: [PATCH] web api for open api v3 --- open-api/web-api.json | 4501 +++++++++++++++++++------------------- web/gen/orpc.gen.ts | 299 ++- web/gen/types.gen.ts | 1946 +++++++++++++++- web/gen/zod.gen.ts | 648 +++++- web/openapi-ts.config.ts | 2 +- 5 files changed, 5072 insertions(+), 2324 deletions(-) diff --git a/open-api/web-api.json b/open-api/web-api.json index 812d4013fc..058ef1fcc9 100644 --- a/open-api/web-api.json +++ b/open-api/web-api.json @@ -1,2297 +1,2230 @@ { - "swagger": "2.0", - "basePath": "\/api", - "paths": { - "\/audio-to-text": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "413": { - "description": "Audio file too large" - }, - "415": { - "description": "Unsupported audio type" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Convert audio to text", - "description": "Convert audio file to text using speech-to-text service.", - "operationId": "Audio to Text", - "tags": [ - "web" - ] - } - }, - "\/chat-messages": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Create a chat message for conversational applications.", - "operationId": "Create Chat Message", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/ChatMessagePayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/chat-messages\/{task_id}\/stop": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Task Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Stop a running chat message task.", - "operationId": "Stop Chat Message", - "parameters": [ - { - "name": "task_id", - "in": "path", - "required": true, - "type": "string", - "description": "Task ID to stop" - } - ], - "tags": [ - "web" - ] - } - }, - "\/completion-messages": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Create a completion message for text generation applications.", - "operationId": "Create Completion Message", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/CompletionMessagePayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/completion-messages\/{task_id}\/stop": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Task Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Stop a running completion message task.", - "operationId": "Stop Completion Message", - "parameters": [ - { - "name": "task_id", - "in": "path", - "required": true, - "type": "string", - "description": "Task ID to stop" - } - ], - "tags": [ - "web" - ] - } - }, - "\/conversations": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found or Not a Chat App" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Retrieve paginated list of conversations for a chat application.", - "operationId": "Get Conversation List", - "parameters": [ - { - "description": "Last conversation ID for pagination", - "type": "string", - "required": false, - "name": "last_id", - "in": "query" - }, - { - "description": "Number of conversations to return (1-100)", - "type": "integer", - "required": false, - "default": 20, - "name": "limit", - "in": "query" - }, - { - "description": "Filter by pinned status", - "type": "string", - "enum": [ - "true", - "false" - ], - "required": false, - "name": "pinned", - "in": "query" - }, - { - "description": "Sort order", - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ], - "required": false, - "default": "-updated_at", - "name": "sort_by", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/conversations\/{c_id}": { - "delete": { - "responses": { - "204": { - "description": "Conversation deleted successfully" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Conversation Not Found or Not a Chat App" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Delete a specific conversation.", - "operationId": "Delete Conversation", - "parameters": [ - { - "name": "c_id", - "in": "path", - "required": true, - "type": "string", - "description": "Conversation UUID" - } - ], - "tags": [ - "web" - ] - } - }, - "\/conversations\/{c_id}\/name": { - "post": { - "responses": { - "200": { - "description": "Conversation renamed successfully" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Conversation Not Found or Not a Chat App" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Rename a specific conversation with a custom name or auto-generate one.", - "operationId": "Rename Conversation", - "parameters": [ - { - "name": "c_id", - "in": "path", - "required": true, - "type": "string", - "description": "Conversation UUID" - }, - { - "description": "New conversation name", - "type": "string", - "required": false, - "name": "name", - "in": "query" - }, - { - "description": "Auto-generate conversation name", - "type": "boolean", - "required": false, - "default": false, - "name": "auto_generate", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/conversations\/{c_id}\/pin": { - "patch": { - "responses": { - "200": { - "description": "Conversation pinned successfully" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Conversation Not Found or Not a Chat App" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Pin a specific conversation to keep it at the top of the list.", - "operationId": "Pin Conversation", - "parameters": [ - { - "name": "c_id", - "in": "path", - "required": true, - "type": "string", - "description": "Conversation UUID" - } - ], - "tags": [ - "web" - ] - } - }, - "\/conversations\/{c_id}\/unpin": { - "patch": { - "responses": { - "200": { - "description": "Conversation unpinned successfully" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Conversation Not Found or Not a Chat App" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Unpin a specific conversation to remove it from the top of the list.", - "operationId": "Unpin Conversation", - "parameters": [ - { - "name": "c_id", - "in": "path", - "required": true, - "type": "string", - "description": "Conversation UUID" - } - ], - "tags": [ - "web" - ] - } - }, - "\/email-code-login": { - "post": { - "responses": { - "200": { - "description": "Email code sent successfully" - }, - "400": { - "description": "Bad request - invalid email format" - }, - "404": { - "description": "Account not found" - } - }, - "description": "Send email verification code for login", - "operationId": "send_email_code_login", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/EmailCodeLoginSendPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/email-code-login\/validity": { - "post": { - "responses": { - "200": { - "description": "Email code verified and login successful" - }, - "400": { - "description": "Bad request - invalid code or token" - }, - "401": { - "description": "Invalid token or expired code" - }, - "404": { - "description": "Account not found" - } - }, - "description": "Verify email code and complete login", - "operationId": "verify_email_code_login", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/EmailCodeLoginVerifyPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/files\/upload": { - "post": { - "responses": { - "201": { - "description": "File uploaded successfully", - "schema": { - "$ref": "#\/definitions\/FileResponse" - } - }, - "400": { - "description": "Bad request - invalid file or parameters" - }, - "413": { - "description": "File too large" - }, - "415": { - "description": "Unsupported file type" - } - }, - "summary": "Upload a file for use in web applications", - "description": "Upload a file for use in web applications\nAccepts file uploads for use within web applications, supporting\nmultiple file types with automatic validation and storage.\n\nArgs:\n app_model: The associated application model\n end_user: The end user uploading the file\n\nForm Parameters:\n file: The file to upload (required)\n source: Optional source type (datasets or None)\n\nReturns:\n dict: File information including ID, URL, and metadata\n int: HTTP status code 201 for success\n\nRaises:\n NoFileUploadedError: No file provided in request\n TooManyFilesError: Multiple files provided (only one allowed)\n FilenameNotExistsError: File has no filename\n FileTooLargeError: File exceeds size limit\n UnsupportedFileTypeError: File type not supported", - "operationId": "upload_file", - "tags": [ - "web" - ] - } - }, - "\/forgot-password": { - "post": { - "responses": { - "200": { - "description": "Password reset email sent successfully" - }, - "400": { - "description": "Bad request - invalid email format" - }, - "404": { - "description": "Account not found" - }, - "429": { - "description": "Too many requests - rate limit exceeded" - } - }, - "description": "Send password reset email", - "operationId": "send_forgot_password_email", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/ForgotPasswordSendPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/forgot-password\/resets": { - "post": { - "responses": { - "200": { - "description": "Password reset successfully" - }, - "400": { - "description": "Bad request - invalid parameters or password mismatch" - }, - "401": { - "description": "Invalid or expired token" - }, - "404": { - "description": "Account not found" - } - }, - "description": "Reset user password with verification token", - "operationId": "reset_password", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/ForgotPasswordResetPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/forgot-password\/validity": { - "post": { - "responses": { - "200": { - "description": "Token is valid" - }, - "400": { - "description": "Bad request - invalid token format" - }, - "401": { - "description": "Invalid or expired token" - } - }, - "description": "Verify password reset token validity", - "operationId": "check_forgot_password_token", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/ForgotPasswordCheckPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/login": { - "post": { - "responses": { - "200": { - "description": "Authentication successful" - }, - "400": { - "description": "Bad request - invalid email or password format" - }, - "401": { - "description": "Authentication failed - email or password mismatch" - }, - "403": { - "description": "Account banned or login disabled" - }, - "404": { - "description": "Account not found" - } - }, - "summary": "Authenticate user and login", - "description": "Authenticate user for web application access", - "operationId": "web_app_login", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/LoginPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/login\/status": { - "get": { - "responses": { - "200": { - "description": "Login status" - }, - "401": { - "description": "Login status" - } - }, - "description": "Check login status", - "operationId": "web_app_login_status", - "tags": [ - "web" - ] - } - }, - "\/logout": { - "post": { - "responses": { - "200": { - "description": "Logout successful" - } - }, - "description": "Logout user from web application", - "operationId": "web_app_logout", - "tags": [ - "web" - ] - } - }, - "\/messages": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Conversation Not Found or Not a Chat App" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Retrieve paginated list of messages from a conversation in a chat application.", - "operationId": "Get Message List", - "parameters": [ - { - "description": "Conversation UUID", - "type": "string", - "required": true, - "name": "conversation_id", - "in": "query" - }, - { - "description": "First message ID for pagination", - "type": "string", - "required": false, - "name": "first_id", - "in": "query" - }, - { - "description": "Number of messages to return (1-100)", - "type": "integer", - "required": false, - "default": 20, - "name": "limit", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/messages\/{message_id}\/feedbacks": { - "post": { - "responses": { - "200": { - "description": "Feedback submitted successfully" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Message Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Submit feedback (like\/dislike) for a specific message.", - "operationId": "Create Message Feedback", - "parameters": [ - { - "name": "message_id", - "in": "path", - "required": true, - "type": "string", - "description": "Message UUID" - }, - { - "description": "Feedback rating", - "type": "string", - "enum": [ - "like", - "dislike" - ], - "required": false, - "name": "rating", - "in": "query" - }, - { - "description": "Feedback content", - "type": "string", - "required": false, - "name": "content", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/messages\/{message_id}\/more-like-this": { - "parameters": [ - { - "name": "message_id", - "in": "path", - "required": true, - "type": "string" - } - ], - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request - Not a completion app or feature disabled" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Message Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Generate a new completion similar to an existing message (completion apps only).", - "operationId": "Generate More Like This", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/MessageMoreLikeThisQuery" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/messages\/{message_id}\/suggested-questions": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request - Not a chat app or feature disabled" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Message Not Found or Conversation Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Get suggested follow-up questions after a message (chat apps only).", - "operationId": "Get Suggested Questions", - "parameters": [ - { - "name": "message_id", - "in": "path", - "required": true, - "type": "string", - "description": "Message UUID" - } - ], - "tags": [ - "web" - ] - } - }, - "\/meta": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Get app meta", - "description": "Retrieve the metadata for a specific app.", - "operationId": "Get App Meta", - "tags": [ - "web" - ] - } - }, - "\/parameters": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Retrieve app parameters", - "description": "Retrieve the parameters for a specific app.", - "operationId": "Get App Parameters", - "tags": [ - "web" - ] - } - }, - "\/passport": { - "get": { - "responses": { - "200": { - "description": "Passport retrieved successfully" - }, - "401": { - "description": "Unauthorized - missing app code or invalid authentication" - }, - "404": { - "description": "Application or user not found" - } - }, - "description": "Get authentication passport for web application access", - "operationId": "get_passport", - "tags": [ - "web" - ] - } - }, - "\/remote-files\/upload": { - "post": { - "responses": { - "201": { - "description": "Remote file uploaded successfully", - "schema": { - "$ref": "#\/definitions\/FileWithSignedUrl" - } - }, - "400": { - "description": "Bad request - invalid URL or parameters" - }, - "413": { - "description": "File too large" - }, - "415": { - "description": "Unsupported file type" - }, - "500": { - "description": "Failed to fetch remote file" - } - }, - "summary": "Upload a file from a remote URL", - "description": "Upload a file from a remote URL\nDownloads a file from the provided remote URL and uploads it\nto the platform storage for use in web applications.\n\nArgs:\n app_model: The associated application model\n end_user: The end user making the request\n\nJSON Parameters:\n url: The remote URL to download the file from (required)\n\nReturns:\n dict: File information including ID, signed URL, and metadata\n int: HTTP status code 201 for success\n\nRaises:\n RemoteFileUploadError: Failed to fetch file from remote URL\n FileTooLargeError: File exceeds size limit\n UnsupportedFileTypeError: File type not supported", - "operationId": "upload_remote_file", - "tags": [ - "web" - ] - } - }, - "\/remote-files\/{url}": { - "parameters": [ - { - "name": "url", - "in": "path", - "required": true, - "type": "string" - } - ], - "get": { - "responses": { - "200": { - "description": "Remote file information retrieved successfully", - "schema": { - "$ref": "#\/definitions\/RemoteFileInfo" - } - }, - "400": { - "description": "Bad request - invalid URL" - }, - "404": { - "description": "Remote file not found" - }, - "500": { - "description": "Failed to fetch remote file" - } - }, - "summary": "Get information about a remote file", - "description": "Get information about a remote file\nRetrieves basic information about a file located at a remote URL,\nincluding content type and content length.\n\nArgs:\n app_model: The associated application model\n end_user: The end user making the request\n url: URL-encoded path to the remote file\n\nReturns:\n dict: Remote file information including type and length\n\nRaises:\n HTTPException: If the remote file cannot be accessed", - "operationId": "get_remote_file_info", - "tags": [ - "web" - ] - } - }, - "\/saved-messages": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request - Not a completion app" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Retrieve paginated list of saved messages for a completion application.", - "operationId": "Get Saved Messages", - "parameters": [ - { - "description": "Last message ID for pagination", - "type": "string", - "required": false, - "name": "last_id", - "in": "query" - }, - { - "description": "Number of messages to return (1-100)", - "type": "integer", - "required": false, - "default": 20, - "name": "limit", - "in": "query" - } - ], - "tags": [ - "web" - ] - }, - "post": { - "responses": { - "200": { - "description": "Message saved successfully" - }, - "400": { - "description": "Bad Request - Not a completion app" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Message Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Save a specific message for later reference.", - "operationId": "Save Message", - "parameters": [ - { - "description": "Message UUID to save", - "type": "string", - "required": true, - "name": "message_id", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/saved-messages\/{message_id}": { - "delete": { - "responses": { - "204": { - "description": "Message removed successfully" - }, - "400": { - "description": "Bad Request - Not a completion app" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Message Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Remove a message from saved messages.", - "operationId": "Delete Saved Message", - "parameters": [ - { - "name": "message_id", - "in": "path", - "required": true, - "type": "string", - "description": "Message UUID to delete" - } - ], - "tags": [ - "web" - ] - } - }, - "\/site": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Retrieve app site info", - "description": "Retrieve app site information and configuration.", - "operationId": "Get App Site Info", - "tags": [ - "web" - ] - } - }, - "\/system-features": { - "get": { - "responses": { - "200": { - "description": "System features retrieved successfully" - }, - "500": { - "description": "Internal server error" - } - }, - "summary": "Get system feature flags and configuration", - "description": "Get system feature flags and configuration\nReturns the current system feature flags and configuration\nthat control various functionalities across the platform.\n\nReturns:\n dict: System feature configuration object\n\nThis endpoint is akin to the `SystemFeatureApi` endpoint in api\/controllers\/console\/feature.py,\nexcept it is intended for use by the web app, instead of the console dashboard.\n\nNOTE: This endpoint is unauthenticated by design, as it provides system features\ndata required for webapp initialization.\n\nAuthentication would create circular dependency (can't authenticate without webapp loading).\n\nOnly non-sensitive configuration data should be returned by this endpoint.", - "operationId": "get_system_features", - "tags": [ - "web" - ] - } - }, - "\/text-to-audio": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Convert text to audio", - "description": "Convert text to audio using text-to-speech service.", - "operationId": "Text to Audio", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/TextToAudioPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/webapp\/access-mode": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Retrieve the access mode for a web application (public or restricted).", - "operationId": "Get App Access Mode", - "parameters": [ - { - "description": "Application ID", - "type": "string", - "required": false, - "name": "appId", - "in": "query" - }, - { - "description": "Application code", - "type": "string", - "required": false, - "name": "appCode", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/webapp\/permission": { - "get": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "500": { - "description": "Internal Server Error" - } - }, - "description": "Check if user has permission to access a web application.", - "operationId": "Check App Permission", - "parameters": [ - { - "description": "Application ID", - "type": "string", - "required": true, - "name": "appId", - "in": "query" - } - ], - "tags": [ - "web" - ] - } - }, - "\/workflows\/run": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "App Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Run workflow", - "description": "Execute a workflow with provided inputs and files.", - "operationId": "Run Workflow", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#\/definitions\/WorkflowRunPayload" - } - } - ], - "tags": [ - "web" - ] - } - }, - "\/workflows\/tasks\/{task_id}\/stop": { - "post": { - "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Task Not Found" - }, - "500": { - "description": "Internal Server Error" - } - }, - "summary": "Stop workflow task", - "description": "Stop a running workflow task.", - "operationId": "Stop Workflow Task", - "parameters": [ - { - "name": "task_id", - "in": "path", - "required": true, - "type": "string", - "description": "Task ID to stop" - } - ], - "tags": [ - "web" - ] - } + "openapi": "3.0.1", + "info": { + "title": "Web API", + "description": "Public APIs for web applications including file uploads, chat interactions, and app management", + "version": "1.0" + }, + "servers": [ + { + "url": "/api" + } + ], + "security": [ + { + "Bearer": [] + } + ], + "tags": [ + { + "name": "web", + "description": "Web application API operations" + } + ], + "paths": { + "/audio-to-text": { + "post": { + "tags": [ + "web" + ], + "summary": "Convert audio to text", + "description": "Convert audio file to text using speech-to-text service.", + "operationId": "Audio to Text", + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "413": { + "description": "Audio file too large", + "content": {} + }, + "415": { + "description": "Unsupported audio type", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } } + } }, - "info": { - "title": "Web API", - "version": "1.0", - "description": "Public APIs for web applications including file uploads, chat interactions, and app management" + "/chat-messages": { + "post": { + "tags": [ + "web" + ], + "description": "Create a chat message for conversational applications.", + "operationId": "Create Chat Message", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatMessagePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } }, - "produces": [ - "application\/json" - ], - "consumes": [ - "application\/json" - ], - "securityDefinitions": { - "Bearer": { - "type": "apiKey", - "in": "header", - "name": "Authorization", - "description": "Type: Bearer {your-api-key}" + "/chat-messages/{task_id}/stop": { + "post": { + "tags": [ + "web" + ], + "description": "Stop a running chat message task.", + "operationId": "Stop Chat Message", + "parameters": [ + { + "name": "task_id", + "in": "path", + "description": "Task ID to stop", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Task Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } } + } }, - "security": [ - { - "Bearer": [] + "/completion-messages": { + "post": { + "tags": [ + "web" + ], + "description": "Create a completion message for text generation applications.", + "operationId": "Create Completion Message", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CompletionMessagePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/completion-messages/{task_id}/stop": { + "post": { + "tags": [ + "web" + ], + "description": "Stop a running completion message task.", + "operationId": "Stop Completion Message", + "parameters": [ + { + "name": "task_id", + "in": "path", + "description": "Task ID to stop", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Task Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } } - ], - "tags": [ - { - "name": "web", - "description": "Web application API operations" + } + }, + "/conversations": { + "get": { + "tags": [ + "web" + ], + "description": "Retrieve paginated list of conversations for a chat application.", + "operationId": "Get Conversation List", + "parameters": [ + { + "name": "last_id", + "in": "query", + "description": "Last conversation ID for pagination", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of conversations to return (1-100)", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "pinned", + "in": "query", + "description": "Filter by pinned status", + "schema": { + "type": "string", + "enum": [ + "true", + "false" + ] + } + }, + { + "name": "sort_by", + "in": "query", + "description": "Sort order", + "schema": { + "type": "string", + "default": "-updated_at", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found or Not a Chat App", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } } - ], - "definitions": { - "TextToAudioPayload": { - "properties": { - "message_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Message Id" - }, - "voice": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Voice" - }, - "text": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Text" - }, - "streaming": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Streaming" - } - }, - "title": "TextToAudioPayload", - "type": "object" - }, - "CompletionMessagePayload": { - "properties": { - "inputs": { - "additionalProperties": true, - "description": "Input variables for the completion", - "title": "Inputs", - "type": "object" - }, - "query": { - "default": "", - "description": "Query text for completion", - "title": "Query", - "type": "string" - }, - "files": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Files to be processed", - "title": "Files" - }, - "response_mode": { - "anyOf": [ - { - "enum": [ - "blocking", - "streaming" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Response mode: blocking or streaming", - "title": "Response Mode" - }, - "retriever_from": { - "default": "web_app", - "description": "Source of retriever", - "title": "Retriever From", - "type": "string" - } - }, - "required": [ - "inputs" - ], - "title": "CompletionMessagePayload", - "type": "object" - }, - "ChatMessagePayload": { - "properties": { - "inputs": { - "additionalProperties": true, - "description": "Input variables for the chat", - "title": "Inputs", - "type": "object" - }, - "query": { - "description": "User query\/message", - "title": "Query", - "type": "string" - }, - "files": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Files to be processed", - "title": "Files" - }, - "response_mode": { - "anyOf": [ - { - "enum": [ - "blocking", - "streaming" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Response mode: blocking or streaming", - "title": "Response Mode" - }, - "conversation_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Conversation ID", - "title": "Conversation Id" - }, - "parent_message_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parent message ID", - "title": "Parent Message Id" - }, - "retriever_from": { - "default": "web_app", - "description": "Source of retriever", - "title": "Retriever From", - "type": "string" - } - }, - "required": [ - "inputs", - "query" - ], - "title": "ChatMessagePayload", - "type": "object" - }, - "FileResponse": { - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "size": { - "title": "Size", - "type": "integer" - }, - "extension": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Extension" - }, - "mime_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Mime Type" - }, - "created_by": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Created By" - }, - "created_at": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Created At" - }, - "preview_url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Preview Url" - }, - "source_url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Source Url" - }, - "original_url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Original Url" - }, - "user_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "User Id" - }, - "tenant_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Tenant Id" - }, - "conversation_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Conversation Id" - }, - "file_key": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "File Key" - } - }, - "required": [ - "id", - "name", - "size" - ], - "title": "FileResponse", - "type": "object" - }, - "ForgotPasswordSendPayload": { - "properties": { - "email": { - "title": "Email", - "type": "string" - }, - "language": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Language" - } - }, - "required": [ - "email" - ], - "title": "ForgotPasswordSendPayload", - "type": "object" - }, - "ForgotPasswordCheckPayload": { - "properties": { - "email": { - "title": "Email", - "type": "string" - }, - "code": { - "title": "Code", - "type": "string" - }, - "token": { - "minLength": 1, - "title": "Token", - "type": "string" - } - }, - "required": [ - "email", - "code", - "token" - ], - "title": "ForgotPasswordCheckPayload", - "type": "object" - }, - "ForgotPasswordResetPayload": { - "properties": { - "token": { - "minLength": 1, - "title": "Token", - "type": "string" - }, - "new_password": { - "title": "New Password", - "type": "string" - }, - "password_confirm": { - "title": "Password Confirm", - "type": "string" - } - }, - "required": [ - "token", - "new_password", - "password_confirm" - ], - "title": "ForgotPasswordResetPayload", - "type": "object" - }, - "LoginPayload": { - "properties": { - "email": { - "title": "Email", - "type": "string" - }, - "password": { - "title": "Password", - "type": "string" - } - }, - "required": [ - "email", - "password" - ], - "title": "LoginPayload", - "type": "object" - }, - "EmailCodeLoginSendPayload": { - "properties": { - "email": { - "title": "Email", - "type": "string" - }, - "language": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Language" - } - }, - "required": [ - "email" - ], - "title": "EmailCodeLoginSendPayload", - "type": "object" - }, - "EmailCodeLoginVerifyPayload": { - "properties": { - "email": { - "title": "Email", - "type": "string" - }, - "code": { - "title": "Code", - "type": "string" - }, - "token": { - "minLength": 1, - "title": "Token", - "type": "string" - } - }, - "required": [ - "email", - "code", - "token" - ], - "title": "EmailCodeLoginVerifyPayload", - "type": "object" - }, - "MessageMoreLikeThisQuery": { - "properties": { - "response_mode": { - "description": "Response mode", - "enum": [ - "blocking", - "streaming" - ], - "title": "Response Mode", - "type": "string" - } - }, - "required": [ - "response_mode" - ], - "title": "MessageMoreLikeThisQuery", - "type": "object" - }, - "RemoteFileInfo": { - "properties": { - "file_type": { - "title": "File Type", - "type": "string" - }, - "file_length": { - "title": "File Length", - "type": "integer" - } - }, - "required": [ - "file_type", - "file_length" - ], - "title": "RemoteFileInfo", - "type": "object" - }, - "FileWithSignedUrl": { - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "size": { - "title": "Size", - "type": "integer" - }, - "extension": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Extension" - }, - "url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Url" - }, - "mime_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Mime Type" - }, - "created_by": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Created By" - }, - "created_at": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Created At" - } - }, - "required": [ - "id", - "name", - "size" - ], - "title": "FileWithSignedUrl", - "type": "object" - }, - "WorkflowRunPayload": { - "properties": { - "inputs": { - "additionalProperties": true, - "description": "Input variables for the workflow", - "title": "Inputs", - "type": "object" - }, - "files": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Files to be processed by the workflow", - "title": "Files" - } - }, - "required": [ - "inputs" - ], - "title": "WorkflowRunPayload", - "type": "object" - }, - "AppAccessModeQuery": { - "properties": { - "appId": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Application ID", - "title": "Appid" - }, - "appCode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Application code", - "title": "Appcode" - } - }, - "title": "AppAccessModeQuery", - "type": "object" - }, - "ConversationListQuery": { - "properties": { - "last_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Last Id" - }, - "limit": { - "default": 20, - "maximum": 100, - "minimum": 1, - "title": "Limit", - "type": "integer" - }, - "pinned": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pinned" - }, - "sort_by": { - "default": "-updated_at", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ], - "title": "Sort By", - "type": "string" - } - }, - "title": "ConversationListQuery", - "type": "object" - }, - "ConversationRenamePayload": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Name" - }, - "auto_generate": { - "default": false, - "title": "Auto Generate", - "type": "boolean" - } - }, - "title": "ConversationRenamePayload", - "type": "object" - }, - "MessageListQuery": { - "properties": { - "conversation_id": { - "description": "Conversation UUID", - "title": "Conversation Id", - "type": "string" - }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "First message ID for pagination", - "title": "First Id" - }, - "limit": { - "default": 20, - "description": "Number of messages to return (1-100)", - "maximum": 100, - "minimum": 1, - "title": "Limit", - "type": "integer" - } - }, - "required": [ - "conversation_id" - ], - "title": "MessageListQuery", - "type": "object" - }, - "MessageFeedbackPayload": { - "properties": { - "rating": { - "anyOf": [ - { - "enum": [ - "like", - "dislike" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Feedback rating", - "title": "Rating" - }, - "content": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Feedback content", - "title": "Content" - } - }, - "title": "MessageFeedbackPayload", - "type": "object" - }, - "RemoteFileUploadPayload": { - "properties": { - "url": { - "description": "Remote file URL", - "format": "uri", - "maxLength": 2083, - "minLength": 1, - "title": "Url", - "type": "string" - } - }, - "required": [ - "url" - ], - "title": "RemoteFileUploadPayload", - "type": "object" - }, - "SavedMessageListQuery": { - "properties": { - "last_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Last Id" - }, - "limit": { - "default": 20, - "maximum": 100, - "minimum": 1, - "title": "Limit", - "type": "integer" - } - }, - "title": "SavedMessageListQuery", - "type": "object" - }, - "SavedMessageCreatePayload": { - "properties": { - "message_id": { - "title": "Message Id", - "type": "string" - } - }, - "required": [ - "message_id" - ], - "title": "SavedMessageCreatePayload", - "type": "object" + } + }, + "/conversations/{c_id}": { + "delete": { + "tags": [ + "web" + ], + "description": "Delete a specific conversation.", + "operationId": "Delete Conversation", + "parameters": [ + { + "name": "c_id", + "in": "path", + "description": "Conversation UUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Conversation deleted successfully", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Conversation Not Found or Not a Chat App", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } } + } + }, + "/conversations/{c_id}/name": { + "post": { + "tags": [ + "web" + ], + "description": "Rename a specific conversation with a custom name or auto-generate one.", + "operationId": "Rename Conversation", + "parameters": [ + { + "name": "c_id", + "in": "path", + "description": "Conversation UUID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "name", + "in": "query", + "description": "New conversation name", + "schema": { + "type": "string" + } + }, + { + "name": "auto_generate", + "in": "query", + "description": "Auto-generate conversation name", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "Conversation renamed successfully", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Conversation Not Found or Not a Chat App", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/conversations/{c_id}/pin": { + "patch": { + "tags": [ + "web" + ], + "description": "Pin a specific conversation to keep it at the top of the list.", + "operationId": "Pin Conversation", + "parameters": [ + { + "name": "c_id", + "in": "path", + "description": "Conversation UUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Conversation pinned successfully", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Conversation Not Found or Not a Chat App", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/conversations/{c_id}/unpin": { + "patch": { + "tags": [ + "web" + ], + "description": "Unpin a specific conversation to remove it from the top of the list.", + "operationId": "Unpin Conversation", + "parameters": [ + { + "name": "c_id", + "in": "path", + "description": "Conversation UUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Conversation unpinned successfully", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Conversation Not Found or Not a Chat App", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/email-code-login": { + "post": { + "tags": [ + "web" + ], + "description": "Send email verification code for login", + "operationId": "send_email_code_login", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EmailCodeLoginSendPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Email code sent successfully", + "content": {} + }, + "400": { + "description": "Bad request - invalid email format", + "content": {} + }, + "404": { + "description": "Account not found", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/email-code-login/validity": { + "post": { + "tags": [ + "web" + ], + "description": "Verify email code and complete login", + "operationId": "verify_email_code_login", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EmailCodeLoginVerifyPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Email code verified and login successful", + "content": {} + }, + "400": { + "description": "Bad request - invalid code or token", + "content": {} + }, + "401": { + "description": "Invalid token or expired code", + "content": {} + }, + "404": { + "description": "Account not found", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/files/upload": { + "post": { + "tags": [ + "web" + ], + "summary": "Upload a file for use in web applications", + "description": "Upload a file for use in web applications\nAccepts file uploads for use within web applications, supporting\nmultiple file types with automatic validation and storage.\n\nArgs:\n app_model: The associated application model\n end_user: The end user uploading the file\n\nForm Parameters:\n file: The file to upload (required)\n source: Optional source type (datasets or None)\n\nReturns:\n dict: File information including ID, URL, and metadata\n int: HTTP status code 201 for success\n\nRaises:\n NoFileUploadedError: No file provided in request\n TooManyFilesError: Multiple files provided (only one allowed)\n FilenameNotExistsError: File has no filename\n FileTooLargeError: File exceeds size limit\n UnsupportedFileTypeError: File type not supported", + "operationId": "upload_file", + "responses": { + "201": { + "description": "File uploaded successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileResponse" + } + } + } + }, + "400": { + "description": "Bad request - invalid file or parameters", + "content": {} + }, + "413": { + "description": "File too large", + "content": {} + }, + "415": { + "description": "Unsupported file type", + "content": {} + } + } + } + }, + "/forgot-password": { + "post": { + "tags": [ + "web" + ], + "description": "Send password reset email", + "operationId": "send_forgot_password_email", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForgotPasswordSendPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Password reset email sent successfully", + "content": {} + }, + "400": { + "description": "Bad request - invalid email format", + "content": {} + }, + "404": { + "description": "Account not found", + "content": {} + }, + "429": { + "description": "Too many requests - rate limit exceeded", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/forgot-password/resets": { + "post": { + "tags": [ + "web" + ], + "description": "Reset user password with verification token", + "operationId": "reset_password", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForgotPasswordResetPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Password reset successfully", + "content": {} + }, + "400": { + "description": "Bad request - invalid parameters or password mismatch", + "content": {} + }, + "401": { + "description": "Invalid or expired token", + "content": {} + }, + "404": { + "description": "Account not found", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/forgot-password/validity": { + "post": { + "tags": [ + "web" + ], + "description": "Verify password reset token validity", + "operationId": "check_forgot_password_token", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForgotPasswordCheckPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Token is valid", + "content": {} + }, + "400": { + "description": "Bad request - invalid token format", + "content": {} + }, + "401": { + "description": "Invalid or expired token", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/login": { + "post": { + "tags": [ + "web" + ], + "summary": "Authenticate user and login", + "description": "Authenticate user for web application access", + "operationId": "web_app_login", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoginPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Authentication successful", + "content": {} + }, + "400": { + "description": "Bad request - invalid email or password format", + "content": {} + }, + "401": { + "description": "Authentication failed - email or password mismatch", + "content": {} + }, + "403": { + "description": "Account banned or login disabled", + "content": {} + }, + "404": { + "description": "Account not found", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/login/status": { + "get": { + "tags": [ + "web" + ], + "description": "Check login status", + "operationId": "web_app_login_status", + "responses": { + "200": { + "description": "Login status", + "content": {} + }, + "401": { + "description": "Login status", + "content": {} + } + } + } + }, + "/logout": { + "post": { + "tags": [ + "web" + ], + "description": "Logout user from web application", + "operationId": "web_app_logout", + "responses": { + "200": { + "description": "Logout successful", + "content": {} + } + } + } + }, + "/messages": { + "get": { + "tags": [ + "web" + ], + "description": "Retrieve paginated list of messages from a conversation in a chat application.", + "operationId": "Get Message List", + "parameters": [ + { + "name": "conversation_id", + "in": "query", + "description": "Conversation UUID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "first_id", + "in": "query", + "description": "First message ID for pagination", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of messages to return (1-100)", + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Conversation Not Found or Not a Chat App", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/messages/{message_id}/feedbacks": { + "post": { + "tags": [ + "web" + ], + "description": "Submit feedback (like/dislike) for a specific message.", + "operationId": "Create Message Feedback", + "parameters": [ + { + "name": "message_id", + "in": "path", + "description": "Message UUID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "rating", + "in": "query", + "description": "Feedback rating", + "schema": { + "type": "string", + "enum": [ + "like", + "dislike" + ] + } + }, + { + "name": "content", + "in": "query", + "description": "Feedback content", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Feedback submitted successfully", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Message Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/messages/{message_id}/more-like-this": { + "get": { + "tags": [ + "web" + ], + "description": "Generate a new completion similar to an existing message (completion apps only).", + "operationId": "Generate More Like This", + "parameters": [ + { + "name": "message_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageMoreLikeThisQuery" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request - Not a completion app or feature disabled", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Message Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/messages/{message_id}/suggested-questions": { + "get": { + "tags": [ + "web" + ], + "description": "Get suggested follow-up questions after a message (chat apps only).", + "operationId": "Get Suggested Questions", + "parameters": [ + { + "name": "message_id", + "in": "path", + "description": "Message UUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request - Not a chat app or feature disabled", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Message Not Found or Conversation Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/meta": { + "get": { + "tags": [ + "web" + ], + "summary": "Get app meta", + "description": "Retrieve the metadata for a specific app.", + "operationId": "Get App Meta", + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/parameters": { + "get": { + "tags": [ + "web" + ], + "summary": "Retrieve app parameters", + "description": "Retrieve the parameters for a specific app.", + "operationId": "Get App Parameters", + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/passport": { + "get": { + "tags": [ + "web" + ], + "description": "Get authentication passport for web application access", + "operationId": "get_passport", + "responses": { + "200": { + "description": "Passport retrieved successfully", + "content": {} + }, + "401": { + "description": "Unauthorized - missing app code or invalid authentication", + "content": {} + }, + "404": { + "description": "Application or user not found", + "content": {} + } + } + } + }, + "/remote-files/upload": { + "post": { + "tags": [ + "web" + ], + "summary": "Upload a file from a remote URL", + "description": "Upload a file from a remote URL\nDownloads a file from the provided remote URL and uploads it\nto the platform storage for use in web applications.\n\nArgs:\n app_model: The associated application model\n end_user: The end user making the request\n\nJSON Parameters:\n url: The remote URL to download the file from (required)\n\nReturns:\n dict: File information including ID, signed URL, and metadata\n int: HTTP status code 201 for success\n\nRaises:\n RemoteFileUploadError: Failed to fetch file from remote URL\n FileTooLargeError: File exceeds size limit\n UnsupportedFileTypeError: File type not supported", + "operationId": "upload_remote_file", + "responses": { + "201": { + "description": "Remote file uploaded successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileWithSignedUrl" + } + } + } + }, + "400": { + "description": "Bad request - invalid URL or parameters", + "content": {} + }, + "413": { + "description": "File too large", + "content": {} + }, + "415": { + "description": "Unsupported file type", + "content": {} + }, + "500": { + "description": "Failed to fetch remote file", + "content": {} + } + } + } + }, + "/remote-files/{url}": { + "get": { + "tags": [ + "web" + ], + "summary": "Get information about a remote file", + "description": "Get information about a remote file\nRetrieves basic information about a file located at a remote URL,\nincluding content type and content length.\n\nArgs:\n app_model: The associated application model\n end_user: The end user making the request\n url: URL-encoded path to the remote file\n\nReturns:\n dict: Remote file information including type and length\n\nRaises:\n HTTPException: If the remote file cannot be accessed", + "operationId": "get_remote_file_info", + "parameters": [ + { + "name": "url", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Remote file information retrieved successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RemoteFileInfo" + } + } + } + }, + "400": { + "description": "Bad request - invalid URL", + "content": {} + }, + "404": { + "description": "Remote file not found", + "content": {} + }, + "500": { + "description": "Failed to fetch remote file", + "content": {} + } + } + } + }, + "/saved-messages": { + "get": { + "tags": [ + "web" + ], + "description": "Retrieve paginated list of saved messages for a completion application.", + "operationId": "Get Saved Messages", + "parameters": [ + { + "name": "last_id", + "in": "query", + "description": "Last message ID for pagination", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of messages to return (1-100)", + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request - Not a completion app", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + }, + "post": { + "tags": [ + "web" + ], + "description": "Save a specific message for later reference.", + "operationId": "Save Message", + "parameters": [ + { + "name": "message_id", + "in": "query", + "description": "Message UUID to save", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Message saved successfully", + "content": {} + }, + "400": { + "description": "Bad Request - Not a completion app", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Message Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/saved-messages/{message_id}": { + "delete": { + "tags": [ + "web" + ], + "description": "Remove a message from saved messages.", + "operationId": "Delete Saved Message", + "parameters": [ + { + "name": "message_id", + "in": "path", + "description": "Message UUID to delete", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Message removed successfully", + "content": {} + }, + "400": { + "description": "Bad Request - Not a completion app", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Message Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/site": { + "get": { + "tags": [ + "web" + ], + "summary": "Retrieve app site info", + "description": "Retrieve app site information and configuration.", + "operationId": "Get App Site Info", + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/system-features": { + "get": { + "tags": [ + "web" + ], + "summary": "Get system feature flags and configuration", + "description": "Get system feature flags and configuration\nReturns the current system feature flags and configuration\nthat control various functionalities across the platform.\n\nReturns:\n dict: System feature configuration object\n\nThis endpoint is akin to the `SystemFeatureApi` endpoint in api/controllers/console/feature.py,\nexcept it is intended for use by the web app, instead of the console dashboard.\n\nNOTE: This endpoint is unauthenticated by design, as it provides system features\ndata required for webapp initialization.\n\nAuthentication would create circular dependency (can't authenticate without webapp loading).\n\nOnly non-sensitive configuration data should be returned by this endpoint.", + "operationId": "get_system_features", + "responses": { + "200": { + "description": "System features retrieved successfully", + "content": {} + }, + "500": { + "description": "Internal server error", + "content": {} + } + } + } + }, + "/text-to-audio": { + "post": { + "tags": [ + "web" + ], + "summary": "Convert text to audio", + "description": "Convert text to audio using text-to-speech service.", + "operationId": "Text to Audio", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TextToAudioPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/webapp/access-mode": { + "get": { + "tags": [ + "web" + ], + "description": "Retrieve the access mode for a web application (public or restricted).", + "operationId": "Get App Access Mode", + "parameters": [ + { + "name": "appId", + "in": "query", + "description": "Application ID", + "schema": { + "type": "string" + } + }, + { + "name": "appCode", + "in": "query", + "description": "Application code", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/webapp/permission": { + "get": { + "tags": [ + "web" + ], + "description": "Check if user has permission to access a web application.", + "operationId": "Check App Permission", + "parameters": [ + { + "name": "appId", + "in": "query", + "description": "Application ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + }, + "/workflows/run": { + "post": { + "tags": [ + "web" + ], + "summary": "Run workflow", + "description": "Execute a workflow with provided inputs and files.", + "operationId": "Run Workflow", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowRunPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "App Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + }, + "x-codegen-request-body-name": "payload" + } + }, + "/workflows/tasks/{task_id}/stop": { + "post": { + "tags": [ + "web" + ], + "summary": "Stop workflow task", + "description": "Stop a running workflow task.", + "operationId": "Stop Workflow Task", + "parameters": [ + { + "name": "task_id", + "in": "path", + "description": "Task ID to stop", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": {} + }, + "400": { + "description": "Bad Request", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": {} + }, + "404": { + "description": "Task Not Found", + "content": {} + }, + "500": { + "description": "Internal Server Error", + "content": {} + } + } + } + } + }, + "components": { + "schemas": { + "TextToAudioPayload": { + "title": "TextToAudioPayload", + "type": "object", + "properties": { + "message_id": { + "title": "Message Id", + "type": "object" + }, + "voice": { + "title": "Voice", + "type": "object" + }, + "text": { + "title": "Text", + "type": "object" + }, + "streaming": { + "title": "Streaming", + "type": "object" + } + } + }, + "CompletionMessagePayload": { + "title": "CompletionMessagePayload", + "required": [ + "inputs" + ], + "type": "object", + "properties": { + "inputs": { + "title": "Inputs", + "type": "object", + "additionalProperties": true, + "description": "Input variables for the completion" + }, + "query": { + "title": "Query", + "type": "string", + "description": "Query text for completion", + "default": "" + }, + "files": { + "title": "Files", + "type": "object", + "description": "Files to be processed" + }, + "response_mode": { + "title": "Response Mode", + "type": "object", + "description": "Response mode: blocking or streaming" + }, + "retriever_from": { + "title": "Retriever From", + "type": "string", + "description": "Source of retriever", + "default": "web_app" + } + } + }, + "ChatMessagePayload": { + "title": "ChatMessagePayload", + "required": [ + "inputs", + "query" + ], + "type": "object", + "properties": { + "inputs": { + "title": "Inputs", + "type": "object", + "additionalProperties": true, + "description": "Input variables for the chat" + }, + "query": { + "title": "Query", + "type": "string", + "description": "User query/message" + }, + "files": { + "title": "Files", + "type": "object", + "description": "Files to be processed" + }, + "response_mode": { + "title": "Response Mode", + "type": "object", + "description": "Response mode: blocking or streaming" + }, + "conversation_id": { + "title": "Conversation Id", + "type": "object", + "description": "Conversation ID" + }, + "parent_message_id": { + "title": "Parent Message Id", + "type": "object", + "description": "Parent message ID" + }, + "retriever_from": { + "title": "Retriever From", + "type": "string", + "description": "Source of retriever", + "default": "web_app" + } + } + }, + "FileResponse": { + "title": "FileResponse", + "required": [ + "id", + "name", + "size" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "extension": { + "title": "Extension", + "type": "object" + }, + "mime_type": { + "title": "Mime Type", + "type": "object" + }, + "created_by": { + "title": "Created By", + "type": "object" + }, + "created_at": { + "title": "Created At", + "type": "object" + }, + "preview_url": { + "title": "Preview Url", + "type": "object" + }, + "source_url": { + "title": "Source Url", + "type": "object" + }, + "original_url": { + "title": "Original Url", + "type": "object" + }, + "user_id": { + "title": "User Id", + "type": "object" + }, + "tenant_id": { + "title": "Tenant Id", + "type": "object" + }, + "conversation_id": { + "title": "Conversation Id", + "type": "object" + }, + "file_key": { + "title": "File Key", + "type": "object" + } + } + }, + "ForgotPasswordSendPayload": { + "title": "ForgotPasswordSendPayload", + "required": [ + "email" + ], + "type": "object", + "properties": { + "email": { + "title": "Email", + "type": "string" + }, + "language": { + "title": "Language", + "type": "object" + } + } + }, + "ForgotPasswordCheckPayload": { + "title": "ForgotPasswordCheckPayload", + "required": [ + "code", + "email", + "token" + ], + "type": "object", + "properties": { + "email": { + "title": "Email", + "type": "string" + }, + "code": { + "title": "Code", + "type": "string" + }, + "token": { + "title": "Token", + "minLength": 1, + "type": "string" + } + } + }, + "ForgotPasswordResetPayload": { + "title": "ForgotPasswordResetPayload", + "required": [ + "new_password", + "password_confirm", + "token" + ], + "type": "object", + "properties": { + "token": { + "title": "Token", + "minLength": 1, + "type": "string" + }, + "new_password": { + "title": "New Password", + "type": "string" + }, + "password_confirm": { + "title": "Password Confirm", + "type": "string" + } + } + }, + "LoginPayload": { + "title": "LoginPayload", + "required": [ + "email", + "password" + ], + "type": "object", + "properties": { + "email": { + "title": "Email", + "type": "string" + }, + "password": { + "title": "Password", + "type": "string" + } + } + }, + "EmailCodeLoginSendPayload": { + "title": "EmailCodeLoginSendPayload", + "required": [ + "email" + ], + "type": "object", + "properties": { + "email": { + "title": "Email", + "type": "string" + }, + "language": { + "title": "Language", + "type": "object" + } + } + }, + "EmailCodeLoginVerifyPayload": { + "title": "EmailCodeLoginVerifyPayload", + "required": [ + "code", + "email", + "token" + ], + "type": "object", + "properties": { + "email": { + "title": "Email", + "type": "string" + }, + "code": { + "title": "Code", + "type": "string" + }, + "token": { + "title": "Token", + "minLength": 1, + "type": "string" + } + } + }, + "MessageMoreLikeThisQuery": { + "title": "MessageMoreLikeThisQuery", + "required": [ + "response_mode" + ], + "type": "object", + "properties": { + "response_mode": { + "title": "Response Mode", + "type": "string", + "description": "Response mode", + "enum": [ + "blocking", + "streaming" + ] + } + } + }, + "RemoteFileInfo": { + "title": "RemoteFileInfo", + "required": [ + "file_length", + "file_type" + ], + "type": "object", + "properties": { + "file_type": { + "title": "File Type", + "type": "string" + }, + "file_length": { + "title": "File Length", + "type": "integer" + } + } + }, + "FileWithSignedUrl": { + "title": "FileWithSignedUrl", + "required": [ + "id", + "name", + "size" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "extension": { + "title": "Extension", + "type": "object" + }, + "url": { + "title": "Url", + "type": "object" + }, + "mime_type": { + "title": "Mime Type", + "type": "object" + }, + "created_by": { + "title": "Created By", + "type": "object" + }, + "created_at": { + "title": "Created At", + "type": "object" + } + } + }, + "WorkflowRunPayload": { + "title": "WorkflowRunPayload", + "required": [ + "inputs" + ], + "type": "object", + "properties": { + "inputs": { + "title": "Inputs", + "type": "object", + "additionalProperties": true, + "description": "Input variables for the workflow" + }, + "files": { + "title": "Files", + "type": "object", + "description": "Files to be processed by the workflow" + } + } + }, + "AppAccessModeQuery": { + "title": "AppAccessModeQuery", + "type": "object", + "properties": { + "appId": { + "title": "Appid", + "type": "object", + "description": "Application ID" + }, + "appCode": { + "title": "Appcode", + "type": "object", + "description": "Application code" + } + } + }, + "ConversationListQuery": { + "title": "ConversationListQuery", + "type": "object", + "properties": { + "last_id": { + "title": "Last Id", + "type": "object" + }, + "limit": { + "title": "Limit", + "maximum": 100, + "minimum": 1, + "type": "integer" + }, + "pinned": { + "title": "Pinned", + "type": "object" + }, + "sort_by": { + "title": "Sort By", + "type": "string", + "default": "-updated_at", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + } + } + }, + "ConversationRenamePayload": { + "title": "ConversationRenamePayload", + "type": "object", + "properties": { + "name": { + "title": "Name", + "type": "object" + }, + "auto_generate": { + "title": "Auto Generate", + "type": "boolean", + "default": false + } + } + }, + "MessageListQuery": { + "title": "MessageListQuery", + "required": [ + "conversation_id" + ], + "type": "object", + "properties": { + "conversation_id": { + "title": "Conversation Id", + "type": "string", + "description": "Conversation UUID" + }, + "first_id": { + "title": "First Id", + "type": "object", + "description": "First message ID for pagination" + }, + "limit": { + "title": "Limit", + "maximum": 100, + "minimum": 1, + "type": "integer", + "description": "Number of messages to return (1-100)" + } + } + }, + "MessageFeedbackPayload": { + "title": "MessageFeedbackPayload", + "type": "object", + "properties": { + "rating": { + "title": "Rating", + "type": "object", + "description": "Feedback rating" + }, + "content": { + "title": "Content", + "type": "object", + "description": "Feedback content" + } + } + }, + "RemoteFileUploadPayload": { + "title": "RemoteFileUploadPayload", + "required": [ + "url" + ], + "type": "object", + "properties": { + "url": { + "title": "Url", + "maxLength": 2083, + "minLength": 1, + "type": "string", + "description": "Remote file URL", + "format": "uri" + } + } + }, + "SavedMessageListQuery": { + "title": "SavedMessageListQuery", + "type": "object", + "properties": { + "last_id": { + "title": "Last Id", + "type": "object" + }, + "limit": { + "title": "Limit", + "maximum": 100, + "minimum": 1, + "type": "integer" + } + } + }, + "SavedMessageCreatePayload": { + "title": "SavedMessageCreatePayload", + "required": [ + "message_id" + ], + "type": "object", + "properties": { + "message_id": { + "title": "Message Id", + "type": "string" + } + } + } }, "responses": { - "ParseError": { - "description": "When a mask can't be parsed" - }, - "MaskError": { - "description": "When any error occurs on mask" - }, - "HTTPException": {}, - "ValueError": {}, - "AppInvokeQuotaExceededError": {}, - "Exception": {} + "ParseError": { + "description": "When a mask can't be parsed", + "content": {} + }, + "MaskError": { + "description": "When any error occurs on mask", + "content": {} + }, + "HTTPException": { + "content": {} + }, + "ValueError": { + "content": {} + }, + "AppInvokeQuotaExceededError": { + "content": {} + }, + "Exception": { + "content": {} + } + }, + "securitySchemes": { + "Bearer": { + "type": "apiKey", + "description": "Type: Bearer {your-api-key}", + "name": "Authorization", + "in": "header" + } } + }, + "x-original-swagger-version": "2.0" } diff --git a/web/gen/orpc.gen.ts b/web/gen/orpc.gen.ts index 1e9df17292..15ccaba799 100644 --- a/web/gen/orpc.gen.ts +++ b/web/gen/orpc.gen.ts @@ -1,15 +1,306 @@ // This file is auto-generated by @hey-api/openapi-ts import { oc } from '@orpc/contract' -import { zGetConsoleApiPingResponse } from './zod.gen' +import { zCheckAppPermissionData, zCheckForgotPasswordTokenData, zCreateChatMessageData, zCreateCompletionMessageData, zCreateMessageFeedbackData, zDeleteConversationData, zDeleteSavedMessageData, zGenerateMoreLikeThisData, zGetAppAccessModeData, zGetConversationListData, zGetMessageListData, zGetRemoteFileInfoData, zGetRemoteFileInfoResponse, zGetSavedMessagesData, zGetSuggestedQuestionsData, zPinConversationData, zRenameConversationData, zResetPasswordData, zRunWorkflowData, zSaveMessageData, zSendEmailCodeLoginData, zSendForgotPasswordEmailData, zStopChatMessageData, zStopCompletionMessageData, zStopWorkflowTaskData, zTextToAudioData, zUnpinConversationData, zUploadFileResponse, zUploadRemoteFileResponse, zVerifyEmailCodeLoginData, zWebAppLoginData } from './zod.gen' export const base = oc.$route({ inputStructure: 'detailed' }) /** - * Health check endpoint for connection testing. + * Convert audio file to text using speech-to-text service. */ -export const getConsoleApiPingContract = base.route({ path: '/console/api/ping', method: 'GET' }).output(zGetConsoleApiPingResponse) +export const audioToTextContract = base.route({ path: '/audio-to-text', method: 'POST' }) -export const contracts = { console: { getConsoleApiPingContract } } +/** + * Create a chat message for conversational applications. + */ +export const createChatMessageContract = base.route({ path: '/chat-messages', method: 'POST' }).input(zCreateChatMessageData) + +/** + * Stop a running chat message task. + */ +export const stopChatMessageContract = base.route({ path: '/chat-messages/{task_id}/stop', method: 'POST' }).input(zStopChatMessageData) + +/** + * Create a completion message for text generation applications. + */ +export const createCompletionMessageContract = base.route({ path: '/completion-messages', method: 'POST' }).input(zCreateCompletionMessageData) + +/** + * Stop a running completion message task. + */ +export const stopCompletionMessageContract = base.route({ path: '/completion-messages/{task_id}/stop', method: 'POST' }).input(zStopCompletionMessageData) + +/** + * Retrieve paginated list of conversations for a chat application. + */ +export const getConversationListContract = base.route({ path: '/conversations', method: 'GET' }).input(zGetConversationListData) + +/** + * Delete a specific conversation. + */ +export const deleteConversationContract = base.route({ path: '/conversations/{c_id}', method: 'DELETE' }).input(zDeleteConversationData) + +/** + * Rename a specific conversation with a custom name or auto-generate one. + */ +export const renameConversationContract = base.route({ path: '/conversations/{c_id}/name', method: 'POST' }).input(zRenameConversationData) + +/** + * Pin a specific conversation to keep it at the top of the list. + */ +export const pinConversationContract = base.route({ path: '/conversations/{c_id}/pin', method: 'PATCH' }).input(zPinConversationData) + +/** + * Unpin a specific conversation to remove it from the top of the list. + */ +export const unpinConversationContract = base.route({ path: '/conversations/{c_id}/unpin', method: 'PATCH' }).input(zUnpinConversationData) + +/** + * Send email verification code for login + */ +export const sendEmailCodeLoginContract = base.route({ path: '/email-code-login', method: 'POST' }).input(zSendEmailCodeLoginData) + +/** + * Verify email code and complete login + */ +export const verifyEmailCodeLoginContract = base.route({ path: '/email-code-login/validity', method: 'POST' }).input(zVerifyEmailCodeLoginData) + +/** + * Upload a file for use in web applications + * Accepts file uploads for use within web applications, supporting + * multiple file types with automatic validation and storage. + * + * Args: + * app_model: The associated application model + * end_user: The end user uploading the file + * + * Form Parameters: + * file: The file to upload (required) + * source: Optional source type (datasets or None) + * + * Returns: + * dict: File information including ID, URL, and metadata + * int: HTTP status code 201 for success + * + * Raises: + * NoFileUploadedError: No file provided in request + * TooManyFilesError: Multiple files provided (only one allowed) + * FilenameNotExistsError: File has no filename + * FileTooLargeError: File exceeds size limit + * UnsupportedFileTypeError: File type not supported + */ +export const uploadFileContract = base.route({ path: '/files/upload', method: 'POST' }).output(zUploadFileResponse) + +/** + * Send password reset email + */ +export const sendForgotPasswordEmailContract = base.route({ path: '/forgot-password', method: 'POST' }).input(zSendForgotPasswordEmailData) + +/** + * Reset user password with verification token + */ +export const resetPasswordContract = base.route({ path: '/forgot-password/resets', method: 'POST' }).input(zResetPasswordData) + +/** + * Verify password reset token validity + */ +export const checkForgotPasswordTokenContract = base.route({ path: '/forgot-password/validity', method: 'POST' }).input(zCheckForgotPasswordTokenData) + +/** + * Authenticate user for web application access + */ +export const webAppLoginContract = base.route({ path: '/login', method: 'POST' }).input(zWebAppLoginData) + +/** + * Check login status + */ +export const webAppLoginStatusContract = base.route({ path: '/login/status', method: 'GET' }) + +/** + * Logout user from web application + */ +export const webAppLogoutContract = base.route({ path: '/logout', method: 'POST' }) + +/** + * Retrieve paginated list of messages from a conversation in a chat application. + */ +export const getMessageListContract = base.route({ path: '/messages', method: 'GET' }).input(zGetMessageListData) + +/** + * Submit feedback (like/dislike) for a specific message. + */ +export const createMessageFeedbackContract = base.route({ path: '/messages/{message_id}/feedbacks', method: 'POST' }).input(zCreateMessageFeedbackData) + +/** + * Generate a new completion similar to an existing message (completion apps only). + */ +export const generateMoreLikeThisContract = base.route({ path: '/messages/{message_id}/more-like-this', method: 'GET' }).input(zGenerateMoreLikeThisData) + +/** + * Get suggested follow-up questions after a message (chat apps only). + */ +export const getSuggestedQuestionsContract = base.route({ path: '/messages/{message_id}/suggested-questions', method: 'GET' }).input(zGetSuggestedQuestionsData) + +/** + * Retrieve the metadata for a specific app. + */ +export const getAppMetaContract = base.route({ path: '/meta', method: 'GET' }) + +/** + * Retrieve the parameters for a specific app. + */ +export const getAppParametersContract = base.route({ path: '/parameters', method: 'GET' }) + +/** + * Get authentication passport for web application access + */ +export const getPassportContract = base.route({ path: '/passport', method: 'GET' }) + +/** + * Upload a file from a remote URL + * Downloads a file from the provided remote URL and uploads it + * to the platform storage for use in web applications. + * + * Args: + * app_model: The associated application model + * end_user: The end user making the request + * + * JSON Parameters: + * url: The remote URL to download the file from (required) + * + * Returns: + * dict: File information including ID, signed URL, and metadata + * int: HTTP status code 201 for success + * + * Raises: + * RemoteFileUploadError: Failed to fetch file from remote URL + * FileTooLargeError: File exceeds size limit + * UnsupportedFileTypeError: File type not supported + */ +export const uploadRemoteFileContract = base.route({ path: '/remote-files/upload', method: 'POST' }).output(zUploadRemoteFileResponse) + +/** + * Get information about a remote file + * Retrieves basic information about a file located at a remote URL, + * including content type and content length. + * + * Args: + * app_model: The associated application model + * end_user: The end user making the request + * url: URL-encoded path to the remote file + * + * Returns: + * dict: Remote file information including type and length + * + * Raises: + * HTTPException: If the remote file cannot be accessed + */ +export const getRemoteFileInfoContract = base.route({ path: '/remote-files/{url}', method: 'GET' }).input(zGetRemoteFileInfoData).output(zGetRemoteFileInfoResponse) + +/** + * Retrieve paginated list of saved messages for a completion application. + */ +export const getSavedMessagesContract = base.route({ path: '/saved-messages', method: 'GET' }).input(zGetSavedMessagesData) + +/** + * Save a specific message for later reference. + */ +export const saveMessageContract = base.route({ path: '/saved-messages', method: 'POST' }).input(zSaveMessageData) + +/** + * Remove a message from saved messages. + */ +export const deleteSavedMessageContract = base.route({ path: '/saved-messages/{message_id}', method: 'DELETE' }).input(zDeleteSavedMessageData) + +/** + * Retrieve app site information and configuration. + */ +export const getAppSiteInfoContract = base.route({ path: '/site', method: 'GET' }) + +/** + * Get system feature flags and configuration + * Returns the current system feature flags and configuration + * that control various functionalities across the platform. + * + * Returns: + * dict: System feature configuration object + * + * This endpoint is akin to the `SystemFeatureApi` endpoint in api/controllers/console/feature.py, + * except it is intended for use by the web app, instead of the console dashboard. + * + * NOTE: This endpoint is unauthenticated by design, as it provides system features + * data required for webapp initialization. + * + * Authentication would create circular dependency (can't authenticate without webapp loading). + * + * Only non-sensitive configuration data should be returned by this endpoint. + */ +export const getSystemFeaturesContract = base.route({ path: '/system-features', method: 'GET' }) + +/** + * Convert text to audio using text-to-speech service. + */ +export const textToAudioContract = base.route({ path: '/text-to-audio', method: 'POST' }).input(zTextToAudioData) + +/** + * Retrieve the access mode for a web application (public or restricted). + */ +export const getAppAccessModeContract = base.route({ path: '/webapp/access-mode', method: 'GET' }).input(zGetAppAccessModeData) + +/** + * Check if user has permission to access a web application. + */ +export const checkAppPermissionContract = base.route({ path: '/webapp/permission', method: 'GET' }).input(zCheckAppPermissionData) + +/** + * Execute a workflow with provided inputs and files. + */ +export const runWorkflowContract = base.route({ path: '/workflows/run', method: 'POST' }).input(zRunWorkflowData) + +/** + * Stop a running workflow task. + */ +export const stopWorkflowTaskContract = base.route({ path: '/workflows/tasks/{task_id}/stop', method: 'POST' }).input(zStopWorkflowTaskData) + +export const contracts = { web: { + audioToTextContract, + createChatMessageContract, + stopChatMessageContract, + createCompletionMessageContract, + stopCompletionMessageContract, + getConversationListContract, + deleteConversationContract, + renameConversationContract, + pinConversationContract, + unpinConversationContract, + sendEmailCodeLoginContract, + verifyEmailCodeLoginContract, + uploadFileContract, + sendForgotPasswordEmailContract, + resetPasswordContract, + checkForgotPasswordTokenContract, + webAppLoginContract, + webAppLoginStatusContract, + webAppLogoutContract, + getMessageListContract, + createMessageFeedbackContract, + generateMoreLikeThisContract, + getSuggestedQuestionsContract, + getAppMetaContract, + getAppParametersContract, + getPassportContract, + uploadRemoteFileContract, + getRemoteFileInfoContract, + getSavedMessagesContract, + saveMessageContract, + deleteSavedMessageContract, + getAppSiteInfoContract, + getSystemFeaturesContract, + textToAudioContract, + getAppAccessModeContract, + checkAppPermissionContract, + runWorkflowContract, + stopWorkflowTaskContract, +} } export type Contracts = typeof contracts diff --git a/web/gen/types.gen.ts b/web/gen/types.gen.ts index 985abdcc32..96cb9841c3 100644 --- a/web/gen/types.gen.ts +++ b/web/gen/types.gen.ts @@ -1,42 +1,1952 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: `${string}://${string}` | (string & {}) + baseUrl: `${string}://${string}/api` | (string & {}) } -export type ErrorSchema = { - error: { - type: string - message: string - status: number - details?: string +/** + * TextToAudioPayload + */ +export type TextToAudioPayload = { + /** + * Message Id + */ + message_id?: { + [key: string]: unknown + } + /** + * Voice + */ + voice?: { + [key: string]: unknown + } + /** + * Text + */ + text?: { + [key: string]: unknown + } + /** + * Streaming + */ + streaming?: { + [key: string]: unknown } } /** - * PingResponse + * CompletionMessagePayload */ -export type PingResponse = { +export type CompletionMessagePayload = { /** - * Result + * Inputs * - * Health check result + * Input variables for the completion */ - result: string + inputs: { + [key: string]: unknown + } + /** + * Query + * + * Query text for completion + */ + query?: string + /** + * Files + * + * Files to be processed + */ + files?: { + [key: string]: unknown + } + /** + * Response Mode + * + * Response mode: blocking or streaming + */ + response_mode?: { + [key: string]: unknown + } + /** + * Retriever From + * + * Source of retriever + */ + retriever_from?: string } -export type GetConsoleApiPingData = { +/** + * ChatMessagePayload + */ +export type ChatMessagePayload = { + /** + * Inputs + * + * Input variables for the chat + */ + inputs: { + [key: string]: unknown + } + /** + * Query + * + * User query/message + */ + query: string + /** + * Files + * + * Files to be processed + */ + files?: { + [key: string]: unknown + } + /** + * Response Mode + * + * Response mode: blocking or streaming + */ + response_mode?: { + [key: string]: unknown + } + /** + * Conversation Id + * + * Conversation ID + */ + conversation_id?: { + [key: string]: unknown + } + /** + * Parent Message Id + * + * Parent message ID + */ + parent_message_id?: { + [key: string]: unknown + } + /** + * Retriever From + * + * Source of retriever + */ + retriever_from?: string +} + +/** + * FileResponse + */ +export type FileResponse = { + /** + * Id + */ + id: string + /** + * Name + */ + name: string + /** + * Size + */ + size: number + /** + * Extension + */ + extension?: { + [key: string]: unknown + } + /** + * Mime Type + */ + mime_type?: { + [key: string]: unknown + } + /** + * Created By + */ + created_by?: { + [key: string]: unknown + } + /** + * Created At + */ + created_at?: { + [key: string]: unknown + } + /** + * Preview Url + */ + preview_url?: { + [key: string]: unknown + } + /** + * Source Url + */ + source_url?: { + [key: string]: unknown + } + /** + * Original Url + */ + original_url?: { + [key: string]: unknown + } + /** + * User Id + */ + user_id?: { + [key: string]: unknown + } + /** + * Tenant Id + */ + tenant_id?: { + [key: string]: unknown + } + /** + * Conversation Id + */ + conversation_id?: { + [key: string]: unknown + } + /** + * File Key + */ + file_key?: { + [key: string]: unknown + } +} + +/** + * ForgotPasswordSendPayload + */ +export type ForgotPasswordSendPayload = { + /** + * Email + */ + email: string + /** + * Language + */ + language?: { + [key: string]: unknown + } +} + +/** + * ForgotPasswordCheckPayload + */ +export type ForgotPasswordCheckPayload = { + /** + * Email + */ + email: string + /** + * Code + */ + code: string + /** + * Token + */ + token: string +} + +/** + * ForgotPasswordResetPayload + */ +export type ForgotPasswordResetPayload = { + /** + * Token + */ + token: string + /** + * New Password + */ + new_password: string + /** + * Password Confirm + */ + password_confirm: string +} + +/** + * LoginPayload + */ +export type LoginPayload = { + /** + * Email + */ + email: string + /** + * Password + */ + password: string +} + +/** + * EmailCodeLoginSendPayload + */ +export type EmailCodeLoginSendPayload = { + /** + * Email + */ + email: string + /** + * Language + */ + language?: { + [key: string]: unknown + } +} + +/** + * EmailCodeLoginVerifyPayload + */ +export type EmailCodeLoginVerifyPayload = { + /** + * Email + */ + email: string + /** + * Code + */ + code: string + /** + * Token + */ + token: string +} + +/** + * MessageMoreLikeThisQuery + */ +export type MessageMoreLikeThisQuery = { + /** + * Response Mode + * + * Response mode + */ + response_mode: 'blocking' | 'streaming' +} + +/** + * RemoteFileInfo + */ +export type RemoteFileInfo = { + /** + * File Type + */ + file_type: string + /** + * File Length + */ + file_length: number +} + +/** + * FileWithSignedUrl + */ +export type FileWithSignedUrl = { + /** + * Id + */ + id: string + /** + * Name + */ + name: string + /** + * Size + */ + size: number + /** + * Extension + */ + extension?: { + [key: string]: unknown + } + /** + * Url + */ + url?: { + [key: string]: unknown + } + /** + * Mime Type + */ + mime_type?: { + [key: string]: unknown + } + /** + * Created By + */ + created_by?: { + [key: string]: unknown + } + /** + * Created At + */ + created_at?: { + [key: string]: unknown + } +} + +/** + * WorkflowRunPayload + */ +export type WorkflowRunPayload = { + /** + * Inputs + * + * Input variables for the workflow + */ + inputs: { + [key: string]: unknown + } + /** + * Files + * + * Files to be processed by the workflow + */ + files?: { + [key: string]: unknown + } +} + +/** + * AppAccessModeQuery + */ +export type AppAccessModeQuery = { + /** + * Appid + * + * Application ID + */ + appId?: { + [key: string]: unknown + } + /** + * Appcode + * + * Application code + */ + appCode?: { + [key: string]: unknown + } +} + +/** + * ConversationListQuery + */ +export type ConversationListQuery = { + /** + * Last Id + */ + last_id?: { + [key: string]: unknown + } + /** + * Limit + */ + limit?: number + /** + * Pinned + */ + pinned?: { + [key: string]: unknown + } + /** + * Sort By + */ + sort_by?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at' +} + +/** + * ConversationRenamePayload + */ +export type ConversationRenamePayload = { + /** + * Name + */ + name?: { + [key: string]: unknown + } + /** + * Auto Generate + */ + auto_generate?: boolean +} + +/** + * MessageListQuery + */ +export type MessageListQuery = { + /** + * Conversation Id + * + * Conversation UUID + */ + conversation_id: string + /** + * First Id + * + * First message ID for pagination + */ + first_id?: { + [key: string]: unknown + } + /** + * Limit + * + * Number of messages to return (1-100) + */ + limit?: number +} + +/** + * MessageFeedbackPayload + */ +export type MessageFeedbackPayload = { + /** + * Rating + * + * Feedback rating + */ + rating?: { + [key: string]: unknown + } + /** + * Content + * + * Feedback content + */ + content?: { + [key: string]: unknown + } +} + +/** + * RemoteFileUploadPayload + */ +export type RemoteFileUploadPayload = { + /** + * Url + * + * Remote file URL + */ + url: string +} + +/** + * SavedMessageListQuery + */ +export type SavedMessageListQuery = { + /** + * Last Id + */ + last_id?: { + [key: string]: unknown + } + /** + * Limit + */ + limit?: number +} + +/** + * SavedMessageCreatePayload + */ +export type SavedMessageCreatePayload = { + /** + * Message Id + */ + message_id: string +} + +export type AudioToTextData = { body?: never path?: never query?: never - url: '/console/api/ping' + url: '/audio-to-text' } -export type GetConsoleApiPingResponses = { +export type AudioToTextErrors = { /** - * OK + * Bad Request */ - 200: PingResponse + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Audio file too large + */ + 413: unknown + /** + * Unsupported audio type + */ + 415: unknown + /** + * Internal Server Error + */ + 500: unknown } -export type GetConsoleApiPingResponse = GetConsoleApiPingResponses[keyof GetConsoleApiPingResponses] +export type AudioToTextResponses = { + /** + * Success + */ + 200: unknown +} + +export type CreateChatMessageData = { + body: ChatMessagePayload + path?: never + query?: never + url: '/chat-messages' +} + +export type CreateChatMessageErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type CreateChatMessageResponses = { + /** + * Success + */ + 200: unknown +} + +export type StopChatMessageData = { + body?: never + path: { + /** + * Task ID to stop + */ + task_id: string + } + query?: never + url: '/chat-messages/{task_id}/stop' +} + +export type StopChatMessageErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Task Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type StopChatMessageResponses = { + /** + * Success + */ + 200: unknown +} + +export type CreateCompletionMessageData = { + body: CompletionMessagePayload + path?: never + query?: never + url: '/completion-messages' +} + +export type CreateCompletionMessageErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type CreateCompletionMessageResponses = { + /** + * Success + */ + 200: unknown +} + +export type StopCompletionMessageData = { + body?: never + path: { + /** + * Task ID to stop + */ + task_id: string + } + query?: never + url: '/completion-messages/{task_id}/stop' +} + +export type StopCompletionMessageErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Task Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type StopCompletionMessageResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetConversationListData = { + body?: never + path?: never + query?: { + /** + * Last conversation ID for pagination + */ + last_id?: string + /** + * Number of conversations to return (1-100) + */ + limit?: number + /** + * Filter by pinned status + */ + pinned?: 'true' | 'false' + /** + * Sort order + */ + sort_by?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at' + } + url: '/conversations' +} + +export type GetConversationListErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found or Not a Chat App + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetConversationListResponses = { + /** + * Success + */ + 200: unknown +} + +export type DeleteConversationData = { + body?: never + path: { + /** + * Conversation UUID + */ + c_id: string + } + query?: never + url: '/conversations/{c_id}' +} + +export type DeleteConversationErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Conversation Not Found or Not a Chat App + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type DeleteConversationResponses = { + /** + * Conversation deleted successfully + */ + 204: void +} + +export type DeleteConversationResponse = DeleteConversationResponses[keyof DeleteConversationResponses] + +export type RenameConversationData = { + body?: never + path: { + /** + * Conversation UUID + */ + c_id: string + } + query?: { + /** + * New conversation name + */ + name?: string + /** + * Auto-generate conversation name + */ + auto_generate?: boolean + } + url: '/conversations/{c_id}/name' +} + +export type RenameConversationErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Conversation Not Found or Not a Chat App + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type RenameConversationResponses = { + /** + * Conversation renamed successfully + */ + 200: unknown +} + +export type PinConversationData = { + body?: never + path: { + /** + * Conversation UUID + */ + c_id: string + } + query?: never + url: '/conversations/{c_id}/pin' +} + +export type PinConversationErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Conversation Not Found or Not a Chat App + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type PinConversationResponses = { + /** + * Conversation pinned successfully + */ + 200: unknown +} + +export type UnpinConversationData = { + body?: never + path: { + /** + * Conversation UUID + */ + c_id: string + } + query?: never + url: '/conversations/{c_id}/unpin' +} + +export type UnpinConversationErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Conversation Not Found or Not a Chat App + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type UnpinConversationResponses = { + /** + * Conversation unpinned successfully + */ + 200: unknown +} + +export type SendEmailCodeLoginData = { + body: EmailCodeLoginSendPayload + path?: never + query?: never + url: '/email-code-login' +} + +export type SendEmailCodeLoginErrors = { + /** + * Bad request - invalid email format + */ + 400: unknown + /** + * Account not found + */ + 404: unknown +} + +export type SendEmailCodeLoginResponses = { + /** + * Email code sent successfully + */ + 200: unknown +} + +export type VerifyEmailCodeLoginData = { + body: EmailCodeLoginVerifyPayload + path?: never + query?: never + url: '/email-code-login/validity' +} + +export type VerifyEmailCodeLoginErrors = { + /** + * Bad request - invalid code or token + */ + 400: unknown + /** + * Invalid token or expired code + */ + 401: unknown + /** + * Account not found + */ + 404: unknown +} + +export type VerifyEmailCodeLoginResponses = { + /** + * Email code verified and login successful + */ + 200: unknown +} + +export type UploadFileData = { + body?: never + path?: never + query?: never + url: '/files/upload' +} + +export type UploadFileErrors = { + /** + * Bad request - invalid file or parameters + */ + 400: unknown + /** + * File too large + */ + 413: unknown + /** + * Unsupported file type + */ + 415: unknown +} + +export type UploadFileResponses = { + /** + * File uploaded successfully + */ + 201: FileResponse +} + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses] + +export type SendForgotPasswordEmailData = { + body: ForgotPasswordSendPayload + path?: never + query?: never + url: '/forgot-password' +} + +export type SendForgotPasswordEmailErrors = { + /** + * Bad request - invalid email format + */ + 400: unknown + /** + * Account not found + */ + 404: unknown + /** + * Too many requests - rate limit exceeded + */ + 429: unknown +} + +export type SendForgotPasswordEmailResponses = { + /** + * Password reset email sent successfully + */ + 200: unknown +} + +export type ResetPasswordData = { + body: ForgotPasswordResetPayload + path?: never + query?: never + url: '/forgot-password/resets' +} + +export type ResetPasswordErrors = { + /** + * Bad request - invalid parameters or password mismatch + */ + 400: unknown + /** + * Invalid or expired token + */ + 401: unknown + /** + * Account not found + */ + 404: unknown +} + +export type ResetPasswordResponses = { + /** + * Password reset successfully + */ + 200: unknown +} + +export type CheckForgotPasswordTokenData = { + body: ForgotPasswordCheckPayload + path?: never + query?: never + url: '/forgot-password/validity' +} + +export type CheckForgotPasswordTokenErrors = { + /** + * Bad request - invalid token format + */ + 400: unknown + /** + * Invalid or expired token + */ + 401: unknown +} + +export type CheckForgotPasswordTokenResponses = { + /** + * Token is valid + */ + 200: unknown +} + +export type WebAppLoginData = { + body: LoginPayload + path?: never + query?: never + url: '/login' +} + +export type WebAppLoginErrors = { + /** + * Bad request - invalid email or password format + */ + 400: unknown + /** + * Authentication failed - email or password mismatch + */ + 401: unknown + /** + * Account banned or login disabled + */ + 403: unknown + /** + * Account not found + */ + 404: unknown +} + +export type WebAppLoginResponses = { + /** + * Authentication successful + */ + 200: unknown +} + +export type WebAppLoginStatusData = { + body?: never + path?: never + query?: never + url: '/login/status' +} + +export type WebAppLoginStatusErrors = { + /** + * Login status + */ + 401: unknown +} + +export type WebAppLoginStatusResponses = { + /** + * Login status + */ + 200: unknown +} + +export type WebAppLogoutData = { + body?: never + path?: never + query?: never + url: '/logout' +} + +export type WebAppLogoutResponses = { + /** + * Logout successful + */ + 200: unknown +} + +export type GetMessageListData = { + body?: never + path?: never + query: { + /** + * Conversation UUID + */ + conversation_id: string + /** + * First message ID for pagination + */ + first_id?: string + /** + * Number of messages to return (1-100) + */ + limit?: number + } + url: '/messages' +} + +export type GetMessageListErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Conversation Not Found or Not a Chat App + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetMessageListResponses = { + /** + * Success + */ + 200: unknown +} + +export type CreateMessageFeedbackData = { + body?: never + path: { + /** + * Message UUID + */ + message_id: string + } + query?: { + /** + * Feedback rating + */ + rating?: 'like' | 'dislike' + /** + * Feedback content + */ + content?: string + } + url: '/messages/{message_id}/feedbacks' +} + +export type CreateMessageFeedbackErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Message Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type CreateMessageFeedbackResponses = { + /** + * Feedback submitted successfully + */ + 200: unknown +} + +export type GenerateMoreLikeThisData = { + body: MessageMoreLikeThisQuery + path: { + message_id: string + } + query?: never + url: '/messages/{message_id}/more-like-this' +} + +export type GenerateMoreLikeThisErrors = { + /** + * Bad Request - Not a completion app or feature disabled + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Message Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GenerateMoreLikeThisResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetSuggestedQuestionsData = { + body?: never + path: { + /** + * Message UUID + */ + message_id: string + } + query?: never + url: '/messages/{message_id}/suggested-questions' +} + +export type GetSuggestedQuestionsErrors = { + /** + * Bad Request - Not a chat app or feature disabled + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Message Not Found or Conversation Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetSuggestedQuestionsResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetAppMetaData = { + body?: never + path?: never + query?: never + url: '/meta' +} + +export type GetAppMetaErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetAppMetaResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetAppParametersData = { + body?: never + path?: never + query?: never + url: '/parameters' +} + +export type GetAppParametersErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetAppParametersResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetPassportData = { + body?: never + path?: never + query?: never + url: '/passport' +} + +export type GetPassportErrors = { + /** + * Unauthorized - missing app code or invalid authentication + */ + 401: unknown + /** + * Application or user not found + */ + 404: unknown +} + +export type GetPassportResponses = { + /** + * Passport retrieved successfully + */ + 200: unknown +} + +export type UploadRemoteFileData = { + body?: never + path?: never + query?: never + url: '/remote-files/upload' +} + +export type UploadRemoteFileErrors = { + /** + * Bad request - invalid URL or parameters + */ + 400: unknown + /** + * File too large + */ + 413: unknown + /** + * Unsupported file type + */ + 415: unknown + /** + * Failed to fetch remote file + */ + 500: unknown +} + +export type UploadRemoteFileResponses = { + /** + * Remote file uploaded successfully + */ + 201: FileWithSignedUrl +} + +export type UploadRemoteFileResponse = UploadRemoteFileResponses[keyof UploadRemoteFileResponses] + +export type GetRemoteFileInfoData = { + body?: never + path: { + url: string + } + query?: never + url: '/remote-files/{url}' +} + +export type GetRemoteFileInfoErrors = { + /** + * Bad request - invalid URL + */ + 400: unknown + /** + * Remote file not found + */ + 404: unknown + /** + * Failed to fetch remote file + */ + 500: unknown +} + +export type GetRemoteFileInfoResponses = { + /** + * Remote file information retrieved successfully + */ + 200: RemoteFileInfo +} + +export type GetRemoteFileInfoResponse = GetRemoteFileInfoResponses[keyof GetRemoteFileInfoResponses] + +export type GetSavedMessagesData = { + body?: never + path?: never + query?: { + /** + * Last message ID for pagination + */ + last_id?: string + /** + * Number of messages to return (1-100) + */ + limit?: number + } + url: '/saved-messages' +} + +export type GetSavedMessagesErrors = { + /** + * Bad Request - Not a completion app + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetSavedMessagesResponses = { + /** + * Success + */ + 200: unknown +} + +export type SaveMessageData = { + body?: never + path?: never + query: { + /** + * Message UUID to save + */ + message_id: string + } + url: '/saved-messages' +} + +export type SaveMessageErrors = { + /** + * Bad Request - Not a completion app + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Message Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type SaveMessageResponses = { + /** + * Message saved successfully + */ + 200: unknown +} + +export type DeleteSavedMessageData = { + body?: never + path: { + /** + * Message UUID to delete + */ + message_id: string + } + query?: never + url: '/saved-messages/{message_id}' +} + +export type DeleteSavedMessageErrors = { + /** + * Bad Request - Not a completion app + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Message Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type DeleteSavedMessageResponses = { + /** + * Message removed successfully + */ + 204: void +} + +export type DeleteSavedMessageResponse = DeleteSavedMessageResponses[keyof DeleteSavedMessageResponses] + +export type GetAppSiteInfoData = { + body?: never + path?: never + query?: never + url: '/site' +} + +export type GetAppSiteInfoErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetAppSiteInfoResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetSystemFeaturesData = { + body?: never + path?: never + query?: never + url: '/system-features' +} + +export type GetSystemFeaturesErrors = { + /** + * Internal server error + */ + 500: unknown +} + +export type GetSystemFeaturesResponses = { + /** + * System features retrieved successfully + */ + 200: unknown +} + +export type TextToAudioData = { + body: TextToAudioPayload + path?: never + query?: never + url: '/text-to-audio' +} + +export type TextToAudioErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type TextToAudioResponses = { + /** + * Success + */ + 200: unknown +} + +export type GetAppAccessModeData = { + body?: never + path?: never + query?: { + /** + * Application ID + */ + appId?: string + /** + * Application code + */ + appCode?: string + } + url: '/webapp/access-mode' +} + +export type GetAppAccessModeErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type GetAppAccessModeResponses = { + /** + * Success + */ + 200: unknown +} + +export type CheckAppPermissionData = { + body?: never + path?: never + query: { + /** + * Application ID + */ + appId: string + } + url: '/webapp/permission' +} + +export type CheckAppPermissionErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type CheckAppPermissionResponses = { + /** + * Success + */ + 200: unknown +} + +export type RunWorkflowData = { + body: WorkflowRunPayload + path?: never + query?: never + url: '/workflows/run' +} + +export type RunWorkflowErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * App Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type RunWorkflowResponses = { + /** + * Success + */ + 200: unknown +} + +export type StopWorkflowTaskData = { + body?: never + path: { + /** + * Task ID to stop + */ + task_id: string + } + query?: never + url: '/workflows/tasks/{task_id}/stop' +} + +export type StopWorkflowTaskErrors = { + /** + * Bad Request + */ + 400: unknown + /** + * Unauthorized + */ + 401: unknown + /** + * Forbidden + */ + 403: unknown + /** + * Task Not Found + */ + 404: unknown + /** + * Internal Server Error + */ + 500: unknown +} + +export type StopWorkflowTaskResponses = { + /** + * Success + */ + 200: unknown +} diff --git a/web/gen/zod.gen.ts b/web/gen/zod.gen.ts index 03c0ca2532..43763bffd2 100644 --- a/web/gen/zod.gen.ts +++ b/web/gen/zod.gen.ts @@ -2,37 +2,651 @@ import { z } from 'zod' -export const zErrorSchema = z.object({ - error: z.object({ - type: z.string(), - message: z.string(), - status: z.number().int(), - details: z.string().optional(), - }), +/** + * TextToAudioPayload + */ +export const zTextToAudioPayload = z.object({ + message_id: z.record(z.unknown()).optional(), + voice: z.record(z.unknown()).optional(), + text: z.record(z.unknown()).optional(), + streaming: z.record(z.unknown()).optional(), }) -export type ErrorSchemaZodType = z.infer +export type TextToAudioPayloadZodType = z.infer /** - * PingResponse + * CompletionMessagePayload */ -export const zPingResponse = z.object({ - result: z.string().describe('Health check result'), +export const zCompletionMessagePayload = z.object({ + inputs: z.record(z.unknown()).describe('Input variables for the completion'), + query: z.string().describe('Query text for completion').optional().default(''), + files: z.record(z.unknown()).describe('Files to be processed').optional(), + response_mode: z.record(z.unknown()).describe('Response mode: blocking or streaming').optional(), + retriever_from: z.string().describe('Source of retriever').optional().default('web_app'), }) -export type PingResponseZodType = z.infer +export type CompletionMessagePayloadZodType = z.infer -export const zGetConsoleApiPingData = z.object({ +/** + * ChatMessagePayload + */ +export const zChatMessagePayload = z.object({ + inputs: z.record(z.unknown()).describe('Input variables for the chat'), + query: z.string().describe('User query/message'), + files: z.record(z.unknown()).describe('Files to be processed').optional(), + response_mode: z.record(z.unknown()).describe('Response mode: blocking or streaming').optional(), + conversation_id: z.record(z.unknown()).describe('Conversation ID').optional(), + parent_message_id: z.record(z.unknown()).describe('Parent message ID').optional(), + retriever_from: z.string().describe('Source of retriever').optional().default('web_app'), +}) + +export type ChatMessagePayloadZodType = z.infer + +/** + * FileResponse + */ +export const zFileResponse = z.object({ + id: z.string(), + name: z.string(), + size: z.number().int(), + extension: z.record(z.unknown()).optional(), + mime_type: z.record(z.unknown()).optional(), + created_by: z.record(z.unknown()).optional(), + created_at: z.record(z.unknown()).optional(), + preview_url: z.record(z.unknown()).optional(), + source_url: z.record(z.unknown()).optional(), + original_url: z.record(z.unknown()).optional(), + user_id: z.record(z.unknown()).optional(), + tenant_id: z.record(z.unknown()).optional(), + conversation_id: z.record(z.unknown()).optional(), + file_key: z.record(z.unknown()).optional(), +}) + +export type FileResponseZodType = z.infer + +/** + * ForgotPasswordSendPayload + */ +export const zForgotPasswordSendPayload = z.object({ + email: z.string(), + language: z.record(z.unknown()).optional(), +}) + +export type ForgotPasswordSendPayloadZodType = z.infer + +/** + * ForgotPasswordCheckPayload + */ +export const zForgotPasswordCheckPayload = z.object({ + email: z.string(), + code: z.string(), + token: z.string().min(1), +}) + +export type ForgotPasswordCheckPayloadZodType = z.infer + +/** + * ForgotPasswordResetPayload + */ +export const zForgotPasswordResetPayload = z.object({ + token: z.string().min(1), + new_password: z.string(), + password_confirm: z.string(), +}) + +export type ForgotPasswordResetPayloadZodType = z.infer + +/** + * LoginPayload + */ +export const zLoginPayload = z.object({ + email: z.string(), + password: z.string(), +}) + +export type LoginPayloadZodType = z.infer + +/** + * EmailCodeLoginSendPayload + */ +export const zEmailCodeLoginSendPayload = z.object({ + email: z.string(), + language: z.record(z.unknown()).optional(), +}) + +export type EmailCodeLoginSendPayloadZodType = z.infer + +/** + * EmailCodeLoginVerifyPayload + */ +export const zEmailCodeLoginVerifyPayload = z.object({ + email: z.string(), + code: z.string(), + token: z.string().min(1), +}) + +export type EmailCodeLoginVerifyPayloadZodType = z.infer + +/** + * MessageMoreLikeThisQuery + */ +export const zMessageMoreLikeThisQuery = z.object({ + response_mode: z.enum(['blocking', 'streaming']).describe('Response mode'), +}) + +export type MessageMoreLikeThisQueryZodType = z.infer + +/** + * RemoteFileInfo + */ +export const zRemoteFileInfo = z.object({ + file_type: z.string(), + file_length: z.number().int(), +}) + +export type RemoteFileInfoZodType = z.infer + +/** + * FileWithSignedUrl + */ +export const zFileWithSignedUrl = z.object({ + id: z.string(), + name: z.string(), + size: z.number().int(), + extension: z.record(z.unknown()).optional(), + url: z.record(z.unknown()).optional(), + mime_type: z.record(z.unknown()).optional(), + created_by: z.record(z.unknown()).optional(), + created_at: z.record(z.unknown()).optional(), +}) + +export type FileWithSignedUrlZodType = z.infer + +/** + * WorkflowRunPayload + */ +export const zWorkflowRunPayload = z.object({ + inputs: z.record(z.unknown()).describe('Input variables for the workflow'), + files: z.record(z.unknown()).describe('Files to be processed by the workflow').optional(), +}) + +export type WorkflowRunPayloadZodType = z.infer + +/** + * AppAccessModeQuery + */ +export const zAppAccessModeQuery = z.object({ + appId: z.record(z.unknown()).describe('Application ID').optional(), + appCode: z.record(z.unknown()).describe('Application code').optional(), +}) + +export type AppAccessModeQueryZodType = z.infer + +/** + * ConversationListQuery + */ +export const zConversationListQuery = z.object({ + last_id: z.record(z.unknown()).optional(), + limit: z.number().int().gte(1).lte(100).optional(), + pinned: z.record(z.unknown()).optional(), + sort_by: z.enum([ + 'created_at', + '-created_at', + 'updated_at', + '-updated_at', + ]).optional(), +}) + +export type ConversationListQueryZodType = z.infer + +/** + * ConversationRenamePayload + */ +export const zConversationRenamePayload = z.object({ + name: z.record(z.unknown()).optional(), + auto_generate: z.boolean().optional().default(false), +}) + +export type ConversationRenamePayloadZodType = z.infer + +/** + * MessageListQuery + */ +export const zMessageListQuery = z.object({ + conversation_id: z.string().describe('Conversation UUID'), + first_id: z.record(z.unknown()).describe('First message ID for pagination').optional(), + limit: z.number().int().gte(1).lte(100).describe('Number of messages to return (1-100)').optional(), +}) + +export type MessageListQueryZodType = z.infer + +/** + * MessageFeedbackPayload + */ +export const zMessageFeedbackPayload = z.object({ + rating: z.record(z.unknown()).describe('Feedback rating').optional(), + content: z.record(z.unknown()).describe('Feedback content').optional(), +}) + +export type MessageFeedbackPayloadZodType = z.infer + +/** + * RemoteFileUploadPayload + */ +export const zRemoteFileUploadPayload = z.object({ + url: z.string().url().min(1).max(2083).describe('Remote file URL'), +}) + +export type RemoteFileUploadPayloadZodType = z.infer + +/** + * SavedMessageListQuery + */ +export const zSavedMessageListQuery = z.object({ + last_id: z.record(z.unknown()).optional(), + limit: z.number().int().gte(1).lte(100).optional(), +}) + +export type SavedMessageListQueryZodType = z.infer + +/** + * SavedMessageCreatePayload + */ +export const zSavedMessageCreatePayload = z.object({ + message_id: z.string(), +}) + +export type SavedMessageCreatePayloadZodType = z.infer + +export const zAudioToTextData = z.object({ body: z.never().optional(), path: z.never().optional(), query: z.never().optional(), }) -export type GetConsoleApiPingDataZodType = z.infer +export type AudioToTextDataZodType = z.infer + +export const zCreateChatMessageData = z.object({ + body: zChatMessagePayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type CreateChatMessageDataZodType = z.infer + +export const zStopChatMessageData = z.object({ + body: z.never().optional(), + path: z.object({ + task_id: z.string().describe('Task ID to stop'), + }), + query: z.never().optional(), +}) + +export type StopChatMessageDataZodType = z.infer + +export const zCreateCompletionMessageData = z.object({ + body: zCompletionMessagePayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type CreateCompletionMessageDataZodType = z.infer + +export const zStopCompletionMessageData = z.object({ + body: z.never().optional(), + path: z.object({ + task_id: z.string().describe('Task ID to stop'), + }), + query: z.never().optional(), +}) + +export type StopCompletionMessageDataZodType = z.infer + +export const zGetConversationListData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + last_id: z.string().describe('Last conversation ID for pagination').optional(), + limit: z.number().int().describe('Number of conversations to return (1-100)').optional().default(20), + pinned: z.enum(['true', 'false']).describe('Filter by pinned status').optional(), + sort_by: z.enum([ + 'created_at', + '-created_at', + 'updated_at', + '-updated_at', + ]).describe('Sort order').optional(), + }).optional(), +}) + +export type GetConversationListDataZodType = z.infer + +export const zDeleteConversationData = z.object({ + body: z.never().optional(), + path: z.object({ + c_id: z.string().describe('Conversation UUID'), + }), + query: z.never().optional(), +}) + +export type DeleteConversationDataZodType = z.infer /** - * OK + * Conversation deleted successfully */ -export const zGetConsoleApiPingResponse = zPingResponse +export const zDeleteConversationResponse = z.void().describe('Conversation deleted successfully') -export type GetConsoleApiPingResponseZodType = z.infer +export type DeleteConversationResponseZodType = z.infer + +export const zRenameConversationData = z.object({ + body: z.never().optional(), + path: z.object({ + c_id: z.string().describe('Conversation UUID'), + }), + query: z.object({ + name: z.string().describe('New conversation name').optional(), + auto_generate: z.boolean().describe('Auto-generate conversation name').optional().default(false), + }).optional(), +}) + +export type RenameConversationDataZodType = z.infer + +export const zPinConversationData = z.object({ + body: z.never().optional(), + path: z.object({ + c_id: z.string().describe('Conversation UUID'), + }), + query: z.never().optional(), +}) + +export type PinConversationDataZodType = z.infer + +export const zUnpinConversationData = z.object({ + body: z.never().optional(), + path: z.object({ + c_id: z.string().describe('Conversation UUID'), + }), + query: z.never().optional(), +}) + +export type UnpinConversationDataZodType = z.infer + +export const zSendEmailCodeLoginData = z.object({ + body: zEmailCodeLoginSendPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type SendEmailCodeLoginDataZodType = z.infer + +export const zVerifyEmailCodeLoginData = z.object({ + body: zEmailCodeLoginVerifyPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type VerifyEmailCodeLoginDataZodType = z.infer + +export const zUploadFileData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type UploadFileDataZodType = z.infer + +/** + * File uploaded successfully + */ +export const zUploadFileResponse = zFileResponse + +export type UploadFileResponseZodType = z.infer + +export const zSendForgotPasswordEmailData = z.object({ + body: zForgotPasswordSendPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type SendForgotPasswordEmailDataZodType = z.infer + +export const zResetPasswordData = z.object({ + body: zForgotPasswordResetPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type ResetPasswordDataZodType = z.infer + +export const zCheckForgotPasswordTokenData = z.object({ + body: zForgotPasswordCheckPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type CheckForgotPasswordTokenDataZodType = z.infer + +export const zWebAppLoginData = z.object({ + body: zLoginPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type WebAppLoginDataZodType = z.infer + +export const zWebAppLoginStatusData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type WebAppLoginStatusDataZodType = z.infer + +export const zWebAppLogoutData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type WebAppLogoutDataZodType = z.infer + +export const zGetMessageListData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + conversation_id: z.string().describe('Conversation UUID'), + first_id: z.string().describe('First message ID for pagination').optional(), + limit: z.number().int().describe('Number of messages to return (1-100)').optional().default(20), + }), +}) + +export type GetMessageListDataZodType = z.infer + +export const zCreateMessageFeedbackData = z.object({ + body: z.never().optional(), + path: z.object({ + message_id: z.string().describe('Message UUID'), + }), + query: z.object({ + rating: z.enum(['like', 'dislike']).describe('Feedback rating').optional(), + content: z.string().describe('Feedback content').optional(), + }).optional(), +}) + +export type CreateMessageFeedbackDataZodType = z.infer + +export const zGenerateMoreLikeThisData = z.object({ + body: zMessageMoreLikeThisQuery, + path: z.object({ + message_id: z.string(), + }), + query: z.never().optional(), +}) + +export type GenerateMoreLikeThisDataZodType = z.infer + +export const zGetSuggestedQuestionsData = z.object({ + body: z.never().optional(), + path: z.object({ + message_id: z.string().describe('Message UUID'), + }), + query: z.never().optional(), +}) + +export type GetSuggestedQuestionsDataZodType = z.infer + +export const zGetAppMetaData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetAppMetaDataZodType = z.infer + +export const zGetAppParametersData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetAppParametersDataZodType = z.infer + +export const zGetPassportData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetPassportDataZodType = z.infer + +export const zUploadRemoteFileData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type UploadRemoteFileDataZodType = z.infer + +/** + * Remote file uploaded successfully + */ +export const zUploadRemoteFileResponse = zFileWithSignedUrl + +export type UploadRemoteFileResponseZodType = z.infer + +export const zGetRemoteFileInfoData = z.object({ + body: z.never().optional(), + path: z.object({ + url: z.string(), + }), + query: z.never().optional(), +}) + +export type GetRemoteFileInfoDataZodType = z.infer + +/** + * Remote file information retrieved successfully + */ +export const zGetRemoteFileInfoResponse = zRemoteFileInfo + +export type GetRemoteFileInfoResponseZodType = z.infer + +export const zGetSavedMessagesData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + last_id: z.string().describe('Last message ID for pagination').optional(), + limit: z.number().int().describe('Number of messages to return (1-100)').optional().default(20), + }).optional(), +}) + +export type GetSavedMessagesDataZodType = z.infer + +export const zSaveMessageData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + message_id: z.string().describe('Message UUID to save'), + }), +}) + +export type SaveMessageDataZodType = z.infer + +export const zDeleteSavedMessageData = z.object({ + body: z.never().optional(), + path: z.object({ + message_id: z.string().describe('Message UUID to delete'), + }), + query: z.never().optional(), +}) + +export type DeleteSavedMessageDataZodType = z.infer + +/** + * Message removed successfully + */ +export const zDeleteSavedMessageResponse = z.void().describe('Message removed successfully') + +export type DeleteSavedMessageResponseZodType = z.infer + +export const zGetAppSiteInfoData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetAppSiteInfoDataZodType = z.infer + +export const zGetSystemFeaturesData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.never().optional(), +}) + +export type GetSystemFeaturesDataZodType = z.infer + +export const zTextToAudioData = z.object({ + body: zTextToAudioPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type TextToAudioDataZodType = z.infer + +export const zGetAppAccessModeData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + appId: z.string().describe('Application ID').optional(), + appCode: z.string().describe('Application code').optional(), + }).optional(), +}) + +export type GetAppAccessModeDataZodType = z.infer + +export const zCheckAppPermissionData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + appId: z.string().describe('Application ID'), + }), +}) + +export type CheckAppPermissionDataZodType = z.infer + +export const zRunWorkflowData = z.object({ + body: zWorkflowRunPayload, + path: z.never().optional(), + query: z.never().optional(), +}) + +export type RunWorkflowDataZodType = z.infer + +export const zStopWorkflowTaskData = z.object({ + body: z.never().optional(), + path: z.object({ + task_id: z.string().describe('Task ID to stop'), + }), + query: z.never().optional(), +}) + +export type StopWorkflowTaskDataZodType = z.infer diff --git a/web/openapi-ts.config.ts b/web/openapi-ts.config.ts index d23105236f..6f2177c249 100644 --- a/web/openapi-ts.config.ts +++ b/web/openapi-ts.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from '@hey-api/openapi-ts' import { defineConfig as defineOrpcConfig } from './plugins/hey-api-orpc/config' export default defineConfig({ - input: '../open-api/fastopenapi.json', + input: '../open-api/web-api.json', output: { indexFile: false, path: './gen',