mirror of
https://github.com/langgenius/dify.git
synced 2026-04-30 15:38:08 +08:00
split more
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { AppFeedbacksResponse } from '../models.gen'
|
||||
import type { AppFeedbacksResponse } from '../models/app.gen'
|
||||
|
||||
export type GetChatAppFeedbacksData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { AnnotationItem, AnnotationListResponse, CreateAnnotationRequest, InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse, UpdateAnnotationRequest } from '../models.gen'
|
||||
import type { AnnotationItem, AnnotationListResponse } from '../models/annotation.gen'
|
||||
import type { CreateAnnotationRequest } from '../models/create.gen'
|
||||
import type { InitialAnnotationReplySettingsRequest, InitialAnnotationReplySettingsResponse as InitialAnnotationReplySettingsResponse2, InitialAnnotationReplySettingsStatusResponse } from '../models/initial.gen'
|
||||
import type { UpdateAnnotationRequest } from '../models/update.gen'
|
||||
|
||||
export type GetAnnotationListData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { AudioToTextRequest, AudioToTextResponse as AudioToTextResponse2 } from '../models.gen'
|
||||
import type { AudioToTextRequest, AudioToTextResponse as AudioToTextResponse2 } from '../models/audio.gen'
|
||||
|
||||
export type AudioToTextData = {
|
||||
body: AudioToTextRequest
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ChatCompletionResponse, ChatRequest, ErrorResponse } from '../models.gen'
|
||||
import type { ChatCompletionResponse, ChatRequest } from '../models/chat.gen'
|
||||
import type { ErrorResponse } from '../models/error.gen'
|
||||
|
||||
export type SendChatMessageData = {
|
||||
/**
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ConversationListItem, ConversationRenameRequest, ConversationsListResponse, ConversationVariablesResponse, ErrorResponse } from '../models.gen'
|
||||
import type { ConversationListItem, ConversationRenameRequest, ConversationVariablesResponse } from '../models/conversation.gen'
|
||||
import type { ConversationsListResponse } from '../models/conversations.gen'
|
||||
import type { ErrorResponse } from '../models/error.gen'
|
||||
|
||||
export type GetConversationsListData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ErrorResponse, FileUploadResponse } from '../models.gen'
|
||||
import type { ErrorResponse } from '../models/error.gen'
|
||||
import type { FileUploadResponse } from '../models/file.gen'
|
||||
|
||||
export type UploadChatFileData = {
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { AppInfoResponse } from '../models.gen'
|
||||
import type { AppInfoResponse } from '../models/app.gen'
|
||||
|
||||
export type GetChatAppInfoData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ConversationHistoryResponse, MessageFeedbackRequest, SuggestedQuestionsResponse } from '../models.gen'
|
||||
import type { ConversationHistoryResponse } from '../models/conversation.gen'
|
||||
import type { MessageFeedbackRequest } from '../models/message.gen'
|
||||
import type { SuggestedQuestionsResponse } from '../models/suggested.gen'
|
||||
|
||||
export type PostChatMessageFeedbackData = {
|
||||
body: MessageFeedbackRequest
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { AppMetaResponse } from '../models.gen'
|
||||
import type { AppMetaResponse } from '../models/app.gen'
|
||||
|
||||
export type GetChatAppMetaData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ChatAppParametersResponse } from '../models.gen'
|
||||
import type { ChatAppParametersResponse } from '../models/chat.gen'
|
||||
|
||||
export type GetChatAppParametersData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { WebAppSettingsResponse } from '../models.gen'
|
||||
import type { WebAppSettingsResponse } from '../models/web.gen'
|
||||
|
||||
export type GetChatWebAppSettingsData = {
|
||||
body?: never
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { TextToAudioFormRequest } from '../models.gen'
|
||||
import type { TextToAudioFormRequest } from '../models/text.gen'
|
||||
|
||||
export type TextToAudioChatData = {
|
||||
body: TextToAudioFormRequest
|
||||
|
||||
@ -1,717 +0,0 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ChatRequest = {
|
||||
/**
|
||||
* User Input/Question content.
|
||||
*/
|
||||
query: string
|
||||
/**
|
||||
* Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.
|
||||
*/
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
/**
|
||||
* Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.
|
||||
*/
|
||||
response_mode?: 'streaming' | 'blocking'
|
||||
/**
|
||||
* User identifier, unique within the application. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.
|
||||
*/
|
||||
user: string
|
||||
/**
|
||||
* Conversation ID to continue a conversation. Pass the previous message's conversation_id.
|
||||
*/
|
||||
conversation_id?: string
|
||||
/**
|
||||
* File list (images) for Vision-capable models.
|
||||
*/
|
||||
files?: Array<InputFileObject>
|
||||
/**
|
||||
* Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.
|
||||
*/
|
||||
auto_generate_name?: boolean
|
||||
}
|
||||
|
||||
export type InputFileObject = ({
|
||||
transfer_method?: 'remote_url'
|
||||
url: string
|
||||
} | {
|
||||
transfer_method?: 'local_file'
|
||||
upload_file_id: string
|
||||
}) & {
|
||||
/**
|
||||
* Supported type: `image`.
|
||||
*/
|
||||
type: 'image'
|
||||
/**
|
||||
* Transfer method, `remote_url` for image URL / `local_file` for file upload
|
||||
*/
|
||||
transfer_method: 'remote_url' | 'local_file'
|
||||
/**
|
||||
* Image URL (when the transfer method is `remote_url`)
|
||||
*/
|
||||
url?: string
|
||||
/**
|
||||
* Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)
|
||||
*/
|
||||
upload_file_id?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Response object for blocking mode chat completion.
|
||||
*/
|
||||
export type ChatCompletionResponse = {
|
||||
/**
|
||||
* Event type, fixed as `message`.
|
||||
*/
|
||||
event?: string
|
||||
/**
|
||||
* Task ID for request tracking and stop response API.
|
||||
*/
|
||||
task_id?: string
|
||||
/**
|
||||
* Unique ID of this response/message event.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* Unique message ID.
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Conversation ID.
|
||||
*/
|
||||
conversation_id?: string
|
||||
/**
|
||||
* App mode, fixed as `chat`.
|
||||
*/
|
||||
mode?: string
|
||||
/**
|
||||
* Complete response content.
|
||||
*/
|
||||
answer?: string
|
||||
metadata?: {
|
||||
usage?: Usage
|
||||
retriever_resources?: Array<RetrieverResource>
|
||||
}
|
||||
/**
|
||||
* Message creation timestamp (Unix epoch seconds).
|
||||
*/
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Base schema for Server-Sent Event chunks in streaming mode.
|
||||
*/
|
||||
export type ChunkChatEvent = {
|
||||
/**
|
||||
* The type of event.
|
||||
*/
|
||||
event: 'message' | 'agent_message' | 'tts_message' | 'tts_message_end' | 'agent_thought' | 'message_file' | 'message_end' | 'message_replace' | 'error' | 'ping'
|
||||
}
|
||||
|
||||
export type StreamEventBase = {
|
||||
/**
|
||||
* Task ID.
|
||||
*/
|
||||
task_id?: string
|
||||
/**
|
||||
* Unique message ID.
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Conversation ID.
|
||||
*/
|
||||
conversation_id?: string
|
||||
/**
|
||||
* Creation timestamp.
|
||||
*/
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type StreamEventChatMessage = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* LLM returned text chunk.
|
||||
*/
|
||||
answer: string
|
||||
event: 'message'
|
||||
}
|
||||
|
||||
export type StreamEventChatAgentMessage = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* LLM returned text chunk (Agent mode).
|
||||
*/
|
||||
answer: string
|
||||
event: 'agent_message'
|
||||
}
|
||||
|
||||
export type StreamEventChatTtsMessage = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Base64 encoded audio chunk.
|
||||
*/
|
||||
audio: string
|
||||
event: 'tts_message'
|
||||
}
|
||||
|
||||
export type StreamEventChatTtsMessageEnd = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Empty string for end event.
|
||||
*/
|
||||
audio: string
|
||||
event: 'tts_message_end'
|
||||
}
|
||||
|
||||
export type StreamEventChatAgentThought = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Agent thought ID.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* Position of this thought in the sequence for the message.
|
||||
*/
|
||||
position: number
|
||||
/**
|
||||
* What LLM is thinking.
|
||||
*/
|
||||
thought?: string
|
||||
/**
|
||||
* Response from tool calls.
|
||||
*/
|
||||
observation?: string
|
||||
/**
|
||||
* List of tools called, split by ';'.
|
||||
*/
|
||||
tool?: string
|
||||
/**
|
||||
* Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}.
|
||||
*/
|
||||
tool_input?: string
|
||||
/**
|
||||
* File IDs of files related to this thought (e.g., generated by a tool).
|
||||
*/
|
||||
message_files?: Array<string>
|
||||
event: 'agent_thought'
|
||||
}
|
||||
|
||||
export type StreamEventChatMessageFile = Omit<ChunkChatEvent, 'event'> & {
|
||||
/**
|
||||
* File unique ID.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* File type, currently only 'image'.
|
||||
*/
|
||||
type: 'image'
|
||||
/**
|
||||
* Who this file belongs to, always 'assistant' here.
|
||||
*/
|
||||
belongs_to: 'assistant'
|
||||
/**
|
||||
* Remote URL of the file.
|
||||
*/
|
||||
url: string
|
||||
/**
|
||||
* Conversation ID.
|
||||
*/
|
||||
conversation_id: string
|
||||
event: 'message_file'
|
||||
}
|
||||
|
||||
export type StreamEventChatMessageEnd = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
metadata: {
|
||||
usage?: Usage
|
||||
retriever_resources?: Array<RetrieverResource>
|
||||
}
|
||||
event: 'message_end'
|
||||
}
|
||||
|
||||
export type StreamEventChatMessageReplace = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Replacement content.
|
||||
*/
|
||||
answer: string
|
||||
event: 'message_replace'
|
||||
}
|
||||
|
||||
export type StreamEventChatError = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* HTTP status code.
|
||||
*/
|
||||
status: number
|
||||
/**
|
||||
* Error code.
|
||||
*/
|
||||
code: string
|
||||
/**
|
||||
* Error message.
|
||||
*/
|
||||
message: string
|
||||
event: 'error'
|
||||
}
|
||||
|
||||
export type StreamEventChatPing = Omit<ChunkChatEvent, 'event'> & {
|
||||
event: 'ping'
|
||||
[key: string]: unknown | 'ping'
|
||||
}
|
||||
|
||||
/**
|
||||
* Model usage information.
|
||||
*/
|
||||
export type Usage = {
|
||||
prompt_tokens?: number
|
||||
prompt_unit_price?: string
|
||||
prompt_price_unit?: string
|
||||
prompt_price?: string
|
||||
completion_tokens?: number
|
||||
completion_unit_price?: string
|
||||
completion_price_unit?: string
|
||||
completion_price?: string
|
||||
total_tokens?: number
|
||||
total_price?: string
|
||||
currency?: string
|
||||
latency?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Citation and Attribution information for a resource.
|
||||
*/
|
||||
export type RetrieverResource = {
|
||||
/**
|
||||
* Position of the resource in the list.
|
||||
*/
|
||||
position?: number
|
||||
/**
|
||||
* ID of the dataset.
|
||||
*/
|
||||
dataset_id?: string
|
||||
/**
|
||||
* Name of the dataset.
|
||||
*/
|
||||
dataset_name?: string
|
||||
/**
|
||||
* ID of the document.
|
||||
*/
|
||||
document_id?: string
|
||||
/**
|
||||
* Name of the document.
|
||||
*/
|
||||
document_name?: string
|
||||
/**
|
||||
* ID of the specific segment within the document.
|
||||
*/
|
||||
segment_id?: string
|
||||
/**
|
||||
* Relevance score of the resource.
|
||||
*/
|
||||
score?: number
|
||||
/**
|
||||
* Content snippet from the resource.
|
||||
*/
|
||||
content?: string
|
||||
}
|
||||
|
||||
export type FileUploadResponse = {
|
||||
id?: string
|
||||
name?: string
|
||||
size?: number
|
||||
extension?: string
|
||||
mime_type?: string
|
||||
created_by?: string
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type MessageFeedbackRequest = {
|
||||
rating?: 'like' | 'dislike' | null
|
||||
user: string
|
||||
content?: string
|
||||
}
|
||||
|
||||
export type AppFeedbacksResponse = {
|
||||
data?: Array<FeedbackItem>
|
||||
}
|
||||
|
||||
export type FeedbackItem = {
|
||||
id?: string
|
||||
app_id?: string
|
||||
conversation_id?: string
|
||||
message_id?: string
|
||||
rating?: 'like' | 'dislike' | null
|
||||
content?: string
|
||||
from_source?: string
|
||||
from_end_user_id?: string
|
||||
from_account_id?: string | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export type SuggestedQuestionsResponse = {
|
||||
result?: string
|
||||
data?: Array<string>
|
||||
}
|
||||
|
||||
export type ConversationHistoryResponse = {
|
||||
limit?: number
|
||||
has_more?: boolean
|
||||
data?: Array<ConversationMessageItem>
|
||||
}
|
||||
|
||||
export type ConversationMessageItem = {
|
||||
id?: string
|
||||
conversation_id?: string
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
query?: string
|
||||
answer?: string
|
||||
message_files?: Array<MessageFileItem>
|
||||
feedback?: {
|
||||
rating?: 'like' | 'dislike'
|
||||
} | null
|
||||
retriever_resources?: Array<RetrieverResource>
|
||||
agent_thoughts?: Array<AgentThoughtItem>
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type MessageFileItem = {
|
||||
id?: string
|
||||
/**
|
||||
* File type, e.g., 'image'.
|
||||
*/
|
||||
type?: string
|
||||
/**
|
||||
* Preview image URL.
|
||||
*/
|
||||
url?: string
|
||||
/**
|
||||
* Who this file belongs to.
|
||||
*/
|
||||
belongs_to?: 'user' | 'assistant'
|
||||
}
|
||||
|
||||
export type AgentThoughtItem = {
|
||||
/**
|
||||
* Agent thought ID.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* Unique message ID this thought belongs to.
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Position of this thought.
|
||||
*/
|
||||
position?: number
|
||||
/**
|
||||
* What LLM is thinking.
|
||||
*/
|
||||
thought?: string
|
||||
/**
|
||||
* Tools called, split by ';'.
|
||||
*/
|
||||
tool?: string
|
||||
/**
|
||||
* Input of tools in JSON format.
|
||||
*/
|
||||
tool_input?: string
|
||||
/**
|
||||
* Response from tool calls.
|
||||
*/
|
||||
observation?: string
|
||||
/**
|
||||
* File IDs related to this thought (from example, Markdown text says 'message_files').
|
||||
*/
|
||||
files?: Array<string>
|
||||
/**
|
||||
* Creation timestamp.
|
||||
*/
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type ConversationsListResponse = {
|
||||
limit?: number
|
||||
has_more?: boolean
|
||||
data?: Array<ConversationListItem>
|
||||
}
|
||||
|
||||
export type ConversationListItem = {
|
||||
id?: string
|
||||
name?: string
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
status?: string
|
||||
introduction?: string
|
||||
created_at?: number
|
||||
updated_at?: number
|
||||
}
|
||||
|
||||
export type ConversationRenameRequest = {
|
||||
/**
|
||||
* (Optional) The name of the conversation. Omit if auto_generate is true.
|
||||
*/
|
||||
name?: string
|
||||
/**
|
||||
* (Optional) Automatically generate the title. Default false.
|
||||
*/
|
||||
auto_generate?: boolean
|
||||
/**
|
||||
* The user identifier.
|
||||
*/
|
||||
user: string
|
||||
}
|
||||
|
||||
export type ConversationRenameResponse = ConversationListItem
|
||||
|
||||
export type ConversationVariablesResponse = {
|
||||
/**
|
||||
* Number of items per page.
|
||||
*/
|
||||
limit?: number
|
||||
/**
|
||||
* Whether there is a next page.
|
||||
*/
|
||||
has_more?: boolean
|
||||
data?: Array<ConversationVariableItem>
|
||||
}
|
||||
|
||||
export type ConversationVariableItem = {
|
||||
/**
|
||||
* Variable ID.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* Variable name.
|
||||
*/
|
||||
name?: string
|
||||
/**
|
||||
* Variable type (string, number, object, json, etc.).
|
||||
*/
|
||||
value_type?: string
|
||||
/**
|
||||
* Variable value (can be a JSON string for complex types).
|
||||
*/
|
||||
value?: string
|
||||
/**
|
||||
* Variable description.
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* Creation timestamp.
|
||||
*/
|
||||
created_at?: number
|
||||
/**
|
||||
* Last update timestamp.
|
||||
*/
|
||||
updated_at?: number
|
||||
}
|
||||
|
||||
export type AudioToTextRequest = {
|
||||
/**
|
||||
* Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB.
|
||||
*/
|
||||
file: Blob | File
|
||||
/**
|
||||
* User identifier.
|
||||
*/
|
||||
user: string
|
||||
}
|
||||
|
||||
export type AudioToTextResponse = {
|
||||
/**
|
||||
* Output text from speech recognition.
|
||||
*/
|
||||
text?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires `user`. Provide either `message_id` or `text`.
|
||||
*/
|
||||
export type TextToAudioFormRequest = {
|
||||
/**
|
||||
* Message ID (priority if both text and message_id provided).
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Speech content.
|
||||
*/
|
||||
text?: string
|
||||
/**
|
||||
* User identifier.
|
||||
*/
|
||||
user: string
|
||||
}
|
||||
|
||||
export type AppInfoResponse = {
|
||||
name?: string
|
||||
description?: string
|
||||
tags?: Array<string>
|
||||
}
|
||||
|
||||
export type ChatAppParametersResponse = {
|
||||
opening_statement?: string
|
||||
suggested_questions?: Array<string>
|
||||
suggested_questions_after_answer?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
speech_to_text?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
text_to_speech?: {
|
||||
enabled?: boolean
|
||||
voice?: string
|
||||
language?: string
|
||||
autoPlay?: 'enabled' | 'disabled'
|
||||
}
|
||||
retriever_resource?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
annotation_reply?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
user_input_form?: Array<UserInputFormItem>
|
||||
file_upload?: {
|
||||
image?: {
|
||||
enabled?: boolean
|
||||
number_limits?: number
|
||||
detail?: string
|
||||
transfer_methods?: Array<'remote_url' | 'local_file'>
|
||||
}
|
||||
}
|
||||
system_parameters?: {
|
||||
file_size_limit?: number
|
||||
image_file_size_limit?: number
|
||||
audio_file_size_limit?: number
|
||||
video_file_size_limit?: number
|
||||
}
|
||||
}
|
||||
|
||||
export type UserInputFormItem = TextInputControlWrapper | ParagraphControlWrapper | SelectControlWrapper
|
||||
|
||||
export type TextInputControlWrapper = {
|
||||
'text-input': TextInputControl
|
||||
}
|
||||
|
||||
export type ParagraphControlWrapper = {
|
||||
paragraph: ParagraphControl
|
||||
}
|
||||
|
||||
export type SelectControlWrapper = {
|
||||
select: SelectControl
|
||||
}
|
||||
|
||||
export type TextInputControl = {
|
||||
label: string
|
||||
variable: string
|
||||
required: boolean
|
||||
default?: string
|
||||
}
|
||||
|
||||
export type ParagraphControl = {
|
||||
label: string
|
||||
variable: string
|
||||
required: boolean
|
||||
default?: string
|
||||
}
|
||||
|
||||
export type SelectControl = {
|
||||
label: string
|
||||
variable: string
|
||||
required: boolean
|
||||
default?: string
|
||||
options: Array<string>
|
||||
}
|
||||
|
||||
export type AppMetaResponse = {
|
||||
/**
|
||||
* Tool icons. Keys are tool names.
|
||||
*/
|
||||
tool_icons?: {
|
||||
[key: string]: string | ToolIconDetail
|
||||
}
|
||||
}
|
||||
|
||||
export type ToolIconDetail = {
|
||||
/**
|
||||
* Background color in hex format.
|
||||
*/
|
||||
background?: string
|
||||
/**
|
||||
* Emoji content.
|
||||
*/
|
||||
content?: string
|
||||
}
|
||||
|
||||
export type WebAppSettingsResponse = {
|
||||
title?: string
|
||||
chat_color_theme?: string
|
||||
chat_color_theme_inverted?: boolean
|
||||
icon_type?: 'emoji' | 'image'
|
||||
icon?: string
|
||||
icon_background?: string
|
||||
icon_url?: string | null
|
||||
description?: string
|
||||
copyright?: string
|
||||
privacy_policy?: string
|
||||
custom_disclaimer?: string
|
||||
default_language?: string
|
||||
show_workflow_steps?: boolean
|
||||
use_icon_as_answer_icon?: boolean
|
||||
}
|
||||
|
||||
export type AnnotationListResponse = {
|
||||
data?: Array<AnnotationItem>
|
||||
has_more?: boolean
|
||||
limit?: number
|
||||
total?: number
|
||||
page?: number
|
||||
}
|
||||
|
||||
export type AnnotationItem = {
|
||||
id?: string
|
||||
question?: string
|
||||
answer?: string
|
||||
hit_count?: number
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type CreateAnnotationRequest = {
|
||||
question: string
|
||||
answer: string
|
||||
}
|
||||
|
||||
export type UpdateAnnotationRequest = {
|
||||
question: string
|
||||
answer: string
|
||||
}
|
||||
|
||||
export type InitialAnnotationReplySettingsRequest = {
|
||||
/**
|
||||
* Specified embedding model provider name (Optional).
|
||||
*/
|
||||
embedding_provider_name?: string
|
||||
/**
|
||||
* Specified embedding model name (Optional).
|
||||
*/
|
||||
embedding_model_name?: string
|
||||
/**
|
||||
* Similarity threshold for matching annotated replies.
|
||||
*/
|
||||
score_threshold: number
|
||||
}
|
||||
|
||||
export type InitialAnnotationReplySettingsResponse = {
|
||||
job_id?: string
|
||||
job_status?: string
|
||||
}
|
||||
|
||||
export type InitialAnnotationReplySettingsStatusResponse = {
|
||||
job_id?: string
|
||||
job_status?: string
|
||||
error_msg?: string | null
|
||||
}
|
||||
|
||||
export type ErrorResponse = {
|
||||
status?: number
|
||||
code?: string
|
||||
message?: string
|
||||
}
|
||||
40
web/gen/types/models/agent.gen.ts
Normal file
40
web/gen/types/models/agent.gen.ts
Normal file
@ -0,0 +1,40 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type AgentThoughtItem = {
|
||||
/**
|
||||
* Agent thought ID.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* Unique message ID this thought belongs to.
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Position of this thought.
|
||||
*/
|
||||
position?: number
|
||||
/**
|
||||
* What LLM is thinking.
|
||||
*/
|
||||
thought?: string
|
||||
/**
|
||||
* Tools called, split by ';'.
|
||||
*/
|
||||
tool?: string
|
||||
/**
|
||||
* Input of tools in JSON format.
|
||||
*/
|
||||
tool_input?: string
|
||||
/**
|
||||
* Response from tool calls.
|
||||
*/
|
||||
observation?: string
|
||||
/**
|
||||
* File IDs related to this thought (from example, Markdown text says 'message_files').
|
||||
*/
|
||||
files?: Array<string>
|
||||
/**
|
||||
* Creation timestamp.
|
||||
*/
|
||||
created_at?: number
|
||||
}
|
||||
17
web/gen/types/models/annotation.gen.ts
Normal file
17
web/gen/types/models/annotation.gen.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type AnnotationListResponse = {
|
||||
data?: Array<AnnotationItem>
|
||||
has_more?: boolean
|
||||
limit?: number
|
||||
total?: number
|
||||
page?: number
|
||||
}
|
||||
|
||||
export type AnnotationItem = {
|
||||
id?: string
|
||||
question?: string
|
||||
answer?: string
|
||||
hit_count?: number
|
||||
created_at?: number
|
||||
}
|
||||
23
web/gen/types/models/app.gen.ts
Normal file
23
web/gen/types/models/app.gen.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { FeedbackItem } from './feedback.gen'
|
||||
import type { ToolIconDetail } from './tool.gen'
|
||||
|
||||
export type AppFeedbacksResponse = {
|
||||
data?: Array<FeedbackItem>
|
||||
}
|
||||
|
||||
export type AppInfoResponse = {
|
||||
name?: string
|
||||
description?: string
|
||||
tags?: Array<string>
|
||||
}
|
||||
|
||||
export type AppMetaResponse = {
|
||||
/**
|
||||
* Tool icons. Keys are tool names.
|
||||
*/
|
||||
tool_icons?: {
|
||||
[key: string]: string | ToolIconDetail
|
||||
}
|
||||
}
|
||||
19
web/gen/types/models/audio.gen.ts
Normal file
19
web/gen/types/models/audio.gen.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type AudioToTextRequest = {
|
||||
/**
|
||||
* Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB.
|
||||
*/
|
||||
file: Blob | File
|
||||
/**
|
||||
* User identifier.
|
||||
*/
|
||||
user: string
|
||||
}
|
||||
|
||||
export type AudioToTextResponse = {
|
||||
/**
|
||||
* Output text from speech recognition.
|
||||
*/
|
||||
text?: string
|
||||
}
|
||||
119
web/gen/types/models/chat.gen.ts
Normal file
119
web/gen/types/models/chat.gen.ts
Normal file
@ -0,0 +1,119 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { InputFileObject } from './input.gen'
|
||||
import type { RetrieverResource } from './retriever.gen'
|
||||
import type { Usage } from './usage.gen'
|
||||
import type { UserInputFormItem } from './user.gen'
|
||||
|
||||
export type ChatRequest = {
|
||||
/**
|
||||
* User Input/Question content.
|
||||
*/
|
||||
query: string
|
||||
/**
|
||||
* Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.
|
||||
*/
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
/**
|
||||
* Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.
|
||||
*/
|
||||
response_mode?: 'streaming' | 'blocking'
|
||||
/**
|
||||
* User identifier, unique within the application. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.
|
||||
*/
|
||||
user: string
|
||||
/**
|
||||
* Conversation ID to continue a conversation. Pass the previous message's conversation_id.
|
||||
*/
|
||||
conversation_id?: string
|
||||
/**
|
||||
* File list (images) for Vision-capable models.
|
||||
*/
|
||||
files?: Array<InputFileObject>
|
||||
/**
|
||||
* Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.
|
||||
*/
|
||||
auto_generate_name?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Response object for blocking mode chat completion.
|
||||
*/
|
||||
export type ChatCompletionResponse = {
|
||||
/**
|
||||
* Event type, fixed as `message`.
|
||||
*/
|
||||
event?: string
|
||||
/**
|
||||
* Task ID for request tracking and stop response API.
|
||||
*/
|
||||
task_id?: string
|
||||
/**
|
||||
* Unique ID of this response/message event.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* Unique message ID.
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Conversation ID.
|
||||
*/
|
||||
conversation_id?: string
|
||||
/**
|
||||
* App mode, fixed as `chat`.
|
||||
*/
|
||||
mode?: string
|
||||
/**
|
||||
* Complete response content.
|
||||
*/
|
||||
answer?: string
|
||||
metadata?: {
|
||||
usage?: Usage
|
||||
retriever_resources?: Array<RetrieverResource>
|
||||
}
|
||||
/**
|
||||
* Message creation timestamp (Unix epoch seconds).
|
||||
*/
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type ChatAppParametersResponse = {
|
||||
opening_statement?: string
|
||||
suggested_questions?: Array<string>
|
||||
suggested_questions_after_answer?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
speech_to_text?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
text_to_speech?: {
|
||||
enabled?: boolean
|
||||
voice?: string
|
||||
language?: string
|
||||
autoPlay?: 'enabled' | 'disabled'
|
||||
}
|
||||
retriever_resource?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
annotation_reply?: {
|
||||
enabled?: boolean
|
||||
}
|
||||
user_input_form?: Array<UserInputFormItem>
|
||||
file_upload?: {
|
||||
image?: {
|
||||
enabled?: boolean
|
||||
number_limits?: number
|
||||
detail?: string
|
||||
transfer_methods?: Array<'remote_url' | 'local_file'>
|
||||
}
|
||||
}
|
||||
system_parameters?: {
|
||||
file_size_limit?: number
|
||||
image_file_size_limit?: number
|
||||
audio_file_size_limit?: number
|
||||
video_file_size_limit?: number
|
||||
}
|
||||
}
|
||||
11
web/gen/types/models/chunk.gen.ts
Normal file
11
web/gen/types/models/chunk.gen.ts
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
/**
|
||||
* Base schema for Server-Sent Event chunks in streaming mode.
|
||||
*/
|
||||
export type ChunkChatEvent = {
|
||||
/**
|
||||
* The type of event.
|
||||
*/
|
||||
event: 'message' | 'agent_message' | 'tts_message' | 'tts_message_end' | 'agent_thought' | 'message_file' | 'message_end' | 'message_replace' | 'error' | 'ping'
|
||||
}
|
||||
100
web/gen/types/models/conversation.gen.ts
Normal file
100
web/gen/types/models/conversation.gen.ts
Normal file
@ -0,0 +1,100 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { AgentThoughtItem } from './agent.gen'
|
||||
import type { MessageFileItem } from './message.gen'
|
||||
import type { RetrieverResource } from './retriever.gen'
|
||||
|
||||
export type ConversationHistoryResponse = {
|
||||
limit?: number
|
||||
has_more?: boolean
|
||||
data?: Array<ConversationMessageItem>
|
||||
}
|
||||
|
||||
export type ConversationMessageItem = {
|
||||
id?: string
|
||||
conversation_id?: string
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
query?: string
|
||||
answer?: string
|
||||
message_files?: Array<MessageFileItem>
|
||||
feedback?: {
|
||||
rating?: 'like' | 'dislike'
|
||||
} | null
|
||||
retriever_resources?: Array<RetrieverResource>
|
||||
agent_thoughts?: Array<AgentThoughtItem>
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type ConversationListItem = {
|
||||
id?: string
|
||||
name?: string
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
status?: string
|
||||
introduction?: string
|
||||
created_at?: number
|
||||
updated_at?: number
|
||||
}
|
||||
|
||||
export type ConversationRenameRequest = {
|
||||
/**
|
||||
* (Optional) The name of the conversation. Omit if auto_generate is true.
|
||||
*/
|
||||
name?: string
|
||||
/**
|
||||
* (Optional) Automatically generate the title. Default false.
|
||||
*/
|
||||
auto_generate?: boolean
|
||||
/**
|
||||
* The user identifier.
|
||||
*/
|
||||
user: string
|
||||
}
|
||||
|
||||
export type ConversationRenameResponse = ConversationListItem
|
||||
|
||||
export type ConversationVariablesResponse = {
|
||||
/**
|
||||
* Number of items per page.
|
||||
*/
|
||||
limit?: number
|
||||
/**
|
||||
* Whether there is a next page.
|
||||
*/
|
||||
has_more?: boolean
|
||||
data?: Array<ConversationVariableItem>
|
||||
}
|
||||
|
||||
export type ConversationVariableItem = {
|
||||
/**
|
||||
* Variable ID.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* Variable name.
|
||||
*/
|
||||
name?: string
|
||||
/**
|
||||
* Variable type (string, number, object, json, etc.).
|
||||
*/
|
||||
value_type?: string
|
||||
/**
|
||||
* Variable value (can be a JSON string for complex types).
|
||||
*/
|
||||
value?: string
|
||||
/**
|
||||
* Variable description.
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* Creation timestamp.
|
||||
*/
|
||||
created_at?: number
|
||||
/**
|
||||
* Last update timestamp.
|
||||
*/
|
||||
updated_at?: number
|
||||
}
|
||||
9
web/gen/types/models/conversations.gen.ts
Normal file
9
web/gen/types/models/conversations.gen.ts
Normal file
@ -0,0 +1,9 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ConversationListItem } from './conversation.gen'
|
||||
|
||||
export type ConversationsListResponse = {
|
||||
limit?: number
|
||||
has_more?: boolean
|
||||
data?: Array<ConversationListItem>
|
||||
}
|
||||
6
web/gen/types/models/create.gen.ts
Normal file
6
web/gen/types/models/create.gen.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type CreateAnnotationRequest = {
|
||||
question: string
|
||||
answer: string
|
||||
}
|
||||
7
web/gen/types/models/error.gen.ts
Normal file
7
web/gen/types/models/error.gen.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ErrorResponse = {
|
||||
status?: number
|
||||
code?: string
|
||||
message?: string
|
||||
}
|
||||
15
web/gen/types/models/feedback.gen.ts
Normal file
15
web/gen/types/models/feedback.gen.ts
Normal file
@ -0,0 +1,15 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type FeedbackItem = {
|
||||
id?: string
|
||||
app_id?: string
|
||||
conversation_id?: string
|
||||
message_id?: string
|
||||
rating?: 'like' | 'dislike' | null
|
||||
content?: string
|
||||
from_source?: string
|
||||
from_end_user_id?: string
|
||||
from_account_id?: string | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
11
web/gen/types/models/file.gen.ts
Normal file
11
web/gen/types/models/file.gen.ts
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type FileUploadResponse = {
|
||||
id?: string
|
||||
name?: string
|
||||
size?: number
|
||||
extension?: string
|
||||
mime_type?: string
|
||||
created_by?: string
|
||||
created_at?: number
|
||||
}
|
||||
27
web/gen/types/models/initial.gen.ts
Normal file
27
web/gen/types/models/initial.gen.ts
Normal file
@ -0,0 +1,27 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type InitialAnnotationReplySettingsRequest = {
|
||||
/**
|
||||
* Specified embedding model provider name (Optional).
|
||||
*/
|
||||
embedding_provider_name?: string
|
||||
/**
|
||||
* Specified embedding model name (Optional).
|
||||
*/
|
||||
embedding_model_name?: string
|
||||
/**
|
||||
* Similarity threshold for matching annotated replies.
|
||||
*/
|
||||
score_threshold: number
|
||||
}
|
||||
|
||||
export type InitialAnnotationReplySettingsResponse = {
|
||||
job_id?: string
|
||||
job_status?: string
|
||||
}
|
||||
|
||||
export type InitialAnnotationReplySettingsStatusResponse = {
|
||||
job_id?: string
|
||||
job_status?: string
|
||||
error_msg?: string | null
|
||||
}
|
||||
26
web/gen/types/models/input.gen.ts
Normal file
26
web/gen/types/models/input.gen.ts
Normal file
@ -0,0 +1,26 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type InputFileObject = ({
|
||||
transfer_method?: 'remote_url'
|
||||
url: string
|
||||
} | {
|
||||
transfer_method?: 'local_file'
|
||||
upload_file_id: string
|
||||
}) & {
|
||||
/**
|
||||
* Supported type: `image`.
|
||||
*/
|
||||
type: 'image'
|
||||
/**
|
||||
* Transfer method, `remote_url` for image URL / `local_file` for file upload
|
||||
*/
|
||||
transfer_method: 'remote_url' | 'local_file'
|
||||
/**
|
||||
* Image URL (when the transfer method is `remote_url`)
|
||||
*/
|
||||
url?: string
|
||||
/**
|
||||
* Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)
|
||||
*/
|
||||
upload_file_id?: string
|
||||
}
|
||||
23
web/gen/types/models/message.gen.ts
Normal file
23
web/gen/types/models/message.gen.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type MessageFeedbackRequest = {
|
||||
rating?: 'like' | 'dislike' | null
|
||||
user: string
|
||||
content?: string
|
||||
}
|
||||
|
||||
export type MessageFileItem = {
|
||||
id?: string
|
||||
/**
|
||||
* File type, e.g., 'image'.
|
||||
*/
|
||||
type?: string
|
||||
/**
|
||||
* Preview image URL.
|
||||
*/
|
||||
url?: string
|
||||
/**
|
||||
* Who this file belongs to.
|
||||
*/
|
||||
belongs_to?: 'user' | 'assistant'
|
||||
}
|
||||
12
web/gen/types/models/paragraph.gen.ts
Normal file
12
web/gen/types/models/paragraph.gen.ts
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ParagraphControlWrapper = {
|
||||
paragraph: ParagraphControl
|
||||
}
|
||||
|
||||
export type ParagraphControl = {
|
||||
label: string
|
||||
variable: string
|
||||
required: boolean
|
||||
default?: string
|
||||
}
|
||||
39
web/gen/types/models/retriever.gen.ts
Normal file
39
web/gen/types/models/retriever.gen.ts
Normal file
@ -0,0 +1,39 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
/**
|
||||
* Citation and Attribution information for a resource.
|
||||
*/
|
||||
export type RetrieverResource = {
|
||||
/**
|
||||
* Position of the resource in the list.
|
||||
*/
|
||||
position?: number
|
||||
/**
|
||||
* ID of the dataset.
|
||||
*/
|
||||
dataset_id?: string
|
||||
/**
|
||||
* Name of the dataset.
|
||||
*/
|
||||
dataset_name?: string
|
||||
/**
|
||||
* ID of the document.
|
||||
*/
|
||||
document_id?: string
|
||||
/**
|
||||
* Name of the document.
|
||||
*/
|
||||
document_name?: string
|
||||
/**
|
||||
* ID of the specific segment within the document.
|
||||
*/
|
||||
segment_id?: string
|
||||
/**
|
||||
* Relevance score of the resource.
|
||||
*/
|
||||
score?: number
|
||||
/**
|
||||
* Content snippet from the resource.
|
||||
*/
|
||||
content?: string
|
||||
}
|
||||
13
web/gen/types/models/select.gen.ts
Normal file
13
web/gen/types/models/select.gen.ts
Normal file
@ -0,0 +1,13 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type SelectControlWrapper = {
|
||||
select: SelectControl
|
||||
}
|
||||
|
||||
export type SelectControl = {
|
||||
label: string
|
||||
variable: string
|
||||
required: boolean
|
||||
default?: string
|
||||
options: Array<string>
|
||||
}
|
||||
149
web/gen/types/models/stream.gen.ts
Normal file
149
web/gen/types/models/stream.gen.ts
Normal file
@ -0,0 +1,149 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ChunkChatEvent } from './chunk.gen'
|
||||
import type { RetrieverResource } from './retriever.gen'
|
||||
import type { Usage } from './usage.gen'
|
||||
|
||||
export type StreamEventBase = {
|
||||
/**
|
||||
* Task ID.
|
||||
*/
|
||||
task_id?: string
|
||||
/**
|
||||
* Unique message ID.
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Conversation ID.
|
||||
*/
|
||||
conversation_id?: string
|
||||
/**
|
||||
* Creation timestamp.
|
||||
*/
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export type StreamEventChatMessage = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* LLM returned text chunk.
|
||||
*/
|
||||
answer: string
|
||||
event: 'message'
|
||||
}
|
||||
|
||||
export type StreamEventChatAgentMessage = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* LLM returned text chunk (Agent mode).
|
||||
*/
|
||||
answer: string
|
||||
event: 'agent_message'
|
||||
}
|
||||
|
||||
export type StreamEventChatTtsMessage = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Base64 encoded audio chunk.
|
||||
*/
|
||||
audio: string
|
||||
event: 'tts_message'
|
||||
}
|
||||
|
||||
export type StreamEventChatTtsMessageEnd = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Empty string for end event.
|
||||
*/
|
||||
audio: string
|
||||
event: 'tts_message_end'
|
||||
}
|
||||
|
||||
export type StreamEventChatAgentThought = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Agent thought ID.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* Position of this thought in the sequence for the message.
|
||||
*/
|
||||
position: number
|
||||
/**
|
||||
* What LLM is thinking.
|
||||
*/
|
||||
thought?: string
|
||||
/**
|
||||
* Response from tool calls.
|
||||
*/
|
||||
observation?: string
|
||||
/**
|
||||
* List of tools called, split by ';'.
|
||||
*/
|
||||
tool?: string
|
||||
/**
|
||||
* Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}.
|
||||
*/
|
||||
tool_input?: string
|
||||
/**
|
||||
* File IDs of files related to this thought (e.g., generated by a tool).
|
||||
*/
|
||||
message_files?: Array<string>
|
||||
event: 'agent_thought'
|
||||
}
|
||||
|
||||
export type StreamEventChatMessageFile = Omit<ChunkChatEvent, 'event'> & {
|
||||
/**
|
||||
* File unique ID.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* File type, currently only 'image'.
|
||||
*/
|
||||
type: 'image'
|
||||
/**
|
||||
* Who this file belongs to, always 'assistant' here.
|
||||
*/
|
||||
belongs_to: 'assistant'
|
||||
/**
|
||||
* Remote URL of the file.
|
||||
*/
|
||||
url: string
|
||||
/**
|
||||
* Conversation ID.
|
||||
*/
|
||||
conversation_id: string
|
||||
event: 'message_file'
|
||||
}
|
||||
|
||||
export type StreamEventChatMessageEnd = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
metadata: {
|
||||
usage?: Usage
|
||||
retriever_resources?: Array<RetrieverResource>
|
||||
}
|
||||
event: 'message_end'
|
||||
}
|
||||
|
||||
export type StreamEventChatMessageReplace = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* Replacement content.
|
||||
*/
|
||||
answer: string
|
||||
event: 'message_replace'
|
||||
}
|
||||
|
||||
export type StreamEventChatError = Omit<ChunkChatEvent, 'event'> & StreamEventBase & {
|
||||
/**
|
||||
* HTTP status code.
|
||||
*/
|
||||
status: number
|
||||
/**
|
||||
* Error code.
|
||||
*/
|
||||
code: string
|
||||
/**
|
||||
* Error message.
|
||||
*/
|
||||
message: string
|
||||
event: 'error'
|
||||
}
|
||||
|
||||
export type StreamEventChatPing = Omit<ChunkChatEvent, 'event'> & {
|
||||
event: 'ping'
|
||||
[key: string]: unknown | 'ping'
|
||||
}
|
||||
6
web/gen/types/models/suggested.gen.ts
Normal file
6
web/gen/types/models/suggested.gen.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type SuggestedQuestionsResponse = {
|
||||
result?: string
|
||||
data?: Array<string>
|
||||
}
|
||||
30
web/gen/types/models/text.gen.ts
Normal file
30
web/gen/types/models/text.gen.ts
Normal file
@ -0,0 +1,30 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
/**
|
||||
* Requires `user`. Provide either `message_id` or `text`.
|
||||
*/
|
||||
export type TextToAudioFormRequest = {
|
||||
/**
|
||||
* Message ID (priority if both text and message_id provided).
|
||||
*/
|
||||
message_id?: string
|
||||
/**
|
||||
* Speech content.
|
||||
*/
|
||||
text?: string
|
||||
/**
|
||||
* User identifier.
|
||||
*/
|
||||
user: string
|
||||
}
|
||||
|
||||
export type TextInputControlWrapper = {
|
||||
'text-input': TextInputControl
|
||||
}
|
||||
|
||||
export type TextInputControl = {
|
||||
label: string
|
||||
variable: string
|
||||
required: boolean
|
||||
default?: string
|
||||
}
|
||||
12
web/gen/types/models/tool.gen.ts
Normal file
12
web/gen/types/models/tool.gen.ts
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ToolIconDetail = {
|
||||
/**
|
||||
* Background color in hex format.
|
||||
*/
|
||||
background?: string
|
||||
/**
|
||||
* Emoji content.
|
||||
*/
|
||||
content?: string
|
||||
}
|
||||
6
web/gen/types/models/update.gen.ts
Normal file
6
web/gen/types/models/update.gen.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type UpdateAnnotationRequest = {
|
||||
question: string
|
||||
answer: string
|
||||
}
|
||||
19
web/gen/types/models/usage.gen.ts
Normal file
19
web/gen/types/models/usage.gen.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
/**
|
||||
* Model usage information.
|
||||
*/
|
||||
export type Usage = {
|
||||
prompt_tokens?: number
|
||||
prompt_unit_price?: string
|
||||
prompt_price_unit?: string
|
||||
prompt_price?: string
|
||||
completion_tokens?: number
|
||||
completion_unit_price?: string
|
||||
completion_price_unit?: string
|
||||
completion_price?: string
|
||||
total_tokens?: number
|
||||
total_price?: string
|
||||
currency?: string
|
||||
latency?: number
|
||||
}
|
||||
7
web/gen/types/models/user.gen.ts
Normal file
7
web/gen/types/models/user.gen.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { ParagraphControlWrapper } from './paragraph.gen'
|
||||
import type { SelectControlWrapper } from './select.gen'
|
||||
import type { TextInputControlWrapper } from './text.gen'
|
||||
|
||||
export type UserInputFormItem = TextInputControlWrapper | ParagraphControlWrapper | SelectControlWrapper
|
||||
18
web/gen/types/models/web.gen.ts
Normal file
18
web/gen/types/models/web.gen.ts
Normal file
@ -0,0 +1,18 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type WebAppSettingsResponse = {
|
||||
title?: string
|
||||
chat_color_theme?: string
|
||||
chat_color_theme_inverted?: boolean
|
||||
icon_type?: 'emoji' | 'image'
|
||||
icon?: string
|
||||
icon_background?: string
|
||||
icon_url?: string | null
|
||||
description?: string
|
||||
copyright?: string
|
||||
privacy_policy?: string
|
||||
custom_disclaimer?: string
|
||||
default_language?: string
|
||||
show_workflow_steps?: boolean
|
||||
use_icon_as_answer_icon?: boolean
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zAppFeedbacksResponse } from '../models.gen'
|
||||
import { zAppFeedbacksResponse } from '../models/app.gen'
|
||||
|
||||
export const zGetChatAppFeedbacksData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zAnnotationItem, zAnnotationListResponse, zCreateAnnotationRequest, zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse, zUpdateAnnotationRequest } from '../models.gen'
|
||||
import { zAnnotationItem, zAnnotationListResponse } from '../models/annotation.gen'
|
||||
import { zCreateAnnotationRequest } from '../models/create.gen'
|
||||
import { zInitialAnnotationReplySettingsRequest, zInitialAnnotationReplySettingsResponse as zInitialAnnotationReplySettingsResponse2, zInitialAnnotationReplySettingsStatusResponse } from '../models/initial.gen'
|
||||
import { zUpdateAnnotationRequest } from '../models/update.gen'
|
||||
|
||||
export const zGetAnnotationListData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zAudioToTextRequest, zAudioToTextResponse as zAudioToTextResponse2 } from '../models.gen'
|
||||
import { zAudioToTextRequest, zAudioToTextResponse as zAudioToTextResponse2 } from '../models/audio.gen'
|
||||
|
||||
export const zAudioToTextData = z.object({
|
||||
body: zAudioToTextRequest,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zChatCompletionResponse, zChatRequest } from '../models.gen'
|
||||
import { zChatCompletionResponse, zChatRequest } from '../models/chat.gen'
|
||||
|
||||
export const zSendChatMessageData = z.object({
|
||||
body: zChatRequest,
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zConversationListItem, zConversationRenameRequest, zConversationsListResponse, zConversationVariablesResponse } from '../models.gen'
|
||||
import { zConversationListItem, zConversationRenameRequest, zConversationVariablesResponse } from '../models/conversation.gen'
|
||||
import { zConversationsListResponse } from '../models/conversations.gen'
|
||||
|
||||
export const zGetConversationsListData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zFileUploadResponse } from '../models.gen'
|
||||
import { zFileUploadResponse } from '../models/file.gen'
|
||||
|
||||
export const zUploadChatFileData = z.object({
|
||||
body: z.object({
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zAppInfoResponse } from '../models.gen'
|
||||
import { zAppInfoResponse } from '../models/app.gen'
|
||||
|
||||
export const zGetChatAppInfoData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zConversationHistoryResponse, zMessageFeedbackRequest, zSuggestedQuestionsResponse } from '../models.gen'
|
||||
import { zConversationHistoryResponse } from '../models/conversation.gen'
|
||||
import { zMessageFeedbackRequest } from '../models/message.gen'
|
||||
import { zSuggestedQuestionsResponse } from '../models/suggested.gen'
|
||||
|
||||
export const zPostChatMessageFeedbackData = z.object({
|
||||
body: zMessageFeedbackRequest,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zAppMetaResponse } from '../models.gen'
|
||||
import { zAppMetaResponse } from '../models/app.gen'
|
||||
|
||||
export const zGetChatAppMetaData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zChatAppParametersResponse } from '../models.gen'
|
||||
import { zChatAppParametersResponse } from '../models/chat.gen'
|
||||
|
||||
export const zGetChatAppParametersData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zWebAppSettingsResponse } from '../models.gen'
|
||||
import { zWebAppSettingsResponse } from '../models/web.gen'
|
||||
|
||||
export const zGetChatWebAppSettingsData = z.object({
|
||||
body: z.never().optional(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zTextToAudioFormRequest } from '../models.gen'
|
||||
import { zTextToAudioFormRequest } from '../models/text.gen'
|
||||
|
||||
export const zTextToAudioChatData = z.object({
|
||||
body: zTextToAudioFormRequest,
|
||||
|
||||
@ -1,589 +0,0 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zInputFileObject = z.intersection(z.union([
|
||||
z.object({
|
||||
transfer_method: z.enum(['remote_url']).optional(),
|
||||
url: z.string(),
|
||||
}),
|
||||
z.object({
|
||||
transfer_method: z.enum(['local_file']).optional(),
|
||||
upload_file_id: z.string(),
|
||||
}),
|
||||
]), z.object({
|
||||
type: z.enum(['image']).describe('Supported type: `image`.'),
|
||||
transfer_method: z.enum(['remote_url', 'local_file']).describe('Transfer method, `remote_url` for image URL / `local_file` for file upload'),
|
||||
url: z.string().describe('Image URL (when the transfer method is `remote_url`)').optional(),
|
||||
upload_file_id: z.string().describe('Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)').optional(),
|
||||
}))
|
||||
|
||||
export type InputFileObjectZodType = z.infer<typeof zInputFileObject>
|
||||
|
||||
export const zChatRequest = z.object({
|
||||
query: z.string().describe('User Input/Question content.'),
|
||||
inputs: z.record(z.unknown()).describe('Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.').optional().default({}),
|
||||
response_mode: z.enum(['streaming', 'blocking']).describe('Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.').optional(),
|
||||
user: z.string().describe('User identifier, unique within the application. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'),
|
||||
conversation_id: z.string().describe('Conversation ID to continue a conversation. Pass the previous message\'s conversation_id.').optional(),
|
||||
files: z.array(zInputFileObject).describe('File list (images) for Vision-capable models.').optional(),
|
||||
auto_generate_name: z.boolean().describe('Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.').optional().default(true),
|
||||
})
|
||||
|
||||
export type ChatRequestZodType = z.infer<typeof zChatRequest>
|
||||
|
||||
/**
|
||||
* Base schema for Server-Sent Event chunks in streaming mode.
|
||||
*/
|
||||
export const zChunkChatEvent = z.object({
|
||||
event: z.enum([
|
||||
'message',
|
||||
'agent_message',
|
||||
'tts_message',
|
||||
'tts_message_end',
|
||||
'agent_thought',
|
||||
'message_file',
|
||||
'message_end',
|
||||
'message_replace',
|
||||
'error',
|
||||
'ping',
|
||||
]).describe('The type of event.'),
|
||||
}).describe('Base schema for Server-Sent Event chunks in streaming mode.')
|
||||
|
||||
export type ChunkChatEventZodType = z.infer<typeof zChunkChatEvent>
|
||||
|
||||
export const zStreamEventBase = z.object({
|
||||
task_id: z.string().uuid().describe('Task ID.').optional(),
|
||||
message_id: z.string().uuid().describe('Unique message ID.').optional(),
|
||||
conversation_id: z.string().uuid().describe('Conversation ID.').optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(),
|
||||
})
|
||||
|
||||
export type StreamEventBaseZodType = z.infer<typeof zStreamEventBase>
|
||||
|
||||
export const zStreamEventChatMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
answer: z.string().describe('LLM returned text chunk.'),
|
||||
event: z.literal('message'),
|
||||
}))
|
||||
|
||||
export type StreamEventChatMessageZodType = z.infer<typeof zStreamEventChatMessage>
|
||||
|
||||
export const zStreamEventChatAgentMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
answer: z.string().describe('LLM returned text chunk (Agent mode).'),
|
||||
event: z.literal('agent_message'),
|
||||
}))
|
||||
|
||||
export type StreamEventChatAgentMessageZodType = z.infer<typeof zStreamEventChatAgentMessage>
|
||||
|
||||
export const zStreamEventChatTtsMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
audio: z.string().describe('Base64 encoded audio chunk.'),
|
||||
event: z.literal('tts_message'),
|
||||
}).describe('TTS audio stream event (base64 encoded Mp3). Available if auto-play enabled.'))
|
||||
|
||||
export type StreamEventChatTtsMessageZodType = z.infer<typeof zStreamEventChatTtsMessage>
|
||||
|
||||
export const zStreamEventChatTtsMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
audio: z.string().describe('Empty string for end event.'),
|
||||
event: z.literal('tts_message_end'),
|
||||
}).describe('TTS audio stream end event.'))
|
||||
|
||||
export type StreamEventChatTtsMessageEndZodType = z.infer<typeof zStreamEventChatTtsMessageEnd>
|
||||
|
||||
export const zStreamEventChatAgentThought = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
id: z.string().uuid().describe('Agent thought ID.'),
|
||||
position: z.number().int().describe('Position of this thought in the sequence for the message.'),
|
||||
thought: z.string().describe('What LLM is thinking.').optional(),
|
||||
observation: z.string().describe('Response from tool calls.').optional(),
|
||||
tool: z.string().describe('List of tools called, split by \';\'.').optional(),
|
||||
tool_input: z.string().describe('Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}.').optional(),
|
||||
message_files: z.array(z.string().uuid()).describe('File IDs of files related to this thought (e.g., generated by a tool).').optional(),
|
||||
event: z.literal('agent_thought'),
|
||||
}).describe('Agent thought, LLM thinking, tool call details (Agent mode).'))
|
||||
|
||||
export type StreamEventChatAgentThoughtZodType = z.infer<typeof zStreamEventChatAgentThought>
|
||||
|
||||
export const zStreamEventChatMessageFile = zChunkChatEvent.and(z.object({
|
||||
id: z.string().uuid().describe('File unique ID.'),
|
||||
type: z.enum(['image']).describe('File type, currently only \'image\'.'),
|
||||
belongs_to: z.enum(['assistant']).describe('Who this file belongs to, always \'assistant\' here.'),
|
||||
url: z.string().describe('Remote URL of the file.'),
|
||||
conversation_id: z.string().uuid().describe('Conversation ID.'),
|
||||
event: z.literal('message_file'),
|
||||
}).describe('Message file event, a new file created by a tool.'))
|
||||
|
||||
export type StreamEventChatMessageFileZodType = z.infer<typeof zStreamEventChatMessageFile>
|
||||
|
||||
export const zStreamEventChatMessageReplace = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
answer: z.string().describe('Replacement content.'),
|
||||
event: z.literal('message_replace'),
|
||||
}).describe('Message content replacement event (e.g., due to content moderation).'))
|
||||
|
||||
export type StreamEventChatMessageReplaceZodType = z.infer<typeof zStreamEventChatMessageReplace>
|
||||
|
||||
export const zStreamEventChatError = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
status: z.number().int().describe('HTTP status code.'),
|
||||
code: z.string().describe('Error code.'),
|
||||
message: z.string().describe('Error message.'),
|
||||
event: z.literal('error'),
|
||||
}).describe('Error event during streaming.'))
|
||||
|
||||
export type StreamEventChatErrorZodType = z.infer<typeof zStreamEventChatError>
|
||||
|
||||
export const zStreamEventChatPing = zChunkChatEvent.and(z.object({
|
||||
event: z.literal('ping'),
|
||||
}).describe('Ping event to keep connection alive.'))
|
||||
|
||||
export type StreamEventChatPingZodType = z.infer<typeof zStreamEventChatPing>
|
||||
|
||||
/**
|
||||
* Model usage information.
|
||||
*/
|
||||
export const zUsage = z.object({
|
||||
prompt_tokens: z.number().int().optional(),
|
||||
prompt_unit_price: z.string().optional(),
|
||||
prompt_price_unit: z.string().optional(),
|
||||
prompt_price: z.string().optional(),
|
||||
completion_tokens: z.number().int().optional(),
|
||||
completion_unit_price: z.string().optional(),
|
||||
completion_price_unit: z.string().optional(),
|
||||
completion_price: z.string().optional(),
|
||||
total_tokens: z.number().int().optional(),
|
||||
total_price: z.string().optional(),
|
||||
currency: z.string().optional(),
|
||||
latency: z.number().optional(),
|
||||
}).describe('Model usage information.')
|
||||
|
||||
export type UsageZodType = z.infer<typeof zUsage>
|
||||
|
||||
/**
|
||||
* Citation and Attribution information for a resource.
|
||||
*/
|
||||
export const zRetrieverResource = z.object({
|
||||
position: z.number().int().describe('Position of the resource in the list.').optional(),
|
||||
dataset_id: z.string().uuid().describe('ID of the dataset.').optional(),
|
||||
dataset_name: z.string().describe('Name of the dataset.').optional(),
|
||||
document_id: z.string().uuid().describe('ID of the document.').optional(),
|
||||
document_name: z.string().describe('Name of the document.').optional(),
|
||||
segment_id: z.string().uuid().describe('ID of the specific segment within the document.').optional(),
|
||||
score: z.number().describe('Relevance score of the resource.').optional(),
|
||||
content: z.string().describe('Content snippet from the resource.').optional(),
|
||||
}).describe('Citation and Attribution information for a resource.')
|
||||
|
||||
export type RetrieverResourceZodType = z.infer<typeof zRetrieverResource>
|
||||
|
||||
/**
|
||||
* Response object for blocking mode chat completion.
|
||||
*/
|
||||
export const zChatCompletionResponse = z.object({
|
||||
event: z.string().describe('Event type, fixed as `message`.').optional(),
|
||||
task_id: z.string().uuid().describe('Task ID for request tracking and stop response API.').optional(),
|
||||
id: z.string().uuid().describe('Unique ID of this response/message event.').optional(),
|
||||
message_id: z.string().uuid().describe('Unique message ID.').optional(),
|
||||
conversation_id: z.string().uuid().describe('Conversation ID.').optional(),
|
||||
mode: z.string().describe('App mode, fixed as `chat`.').optional(),
|
||||
answer: z.string().describe('Complete response content.').optional(),
|
||||
metadata: z.object({
|
||||
usage: zUsage.optional(),
|
||||
retriever_resources: z.array(zRetrieverResource).optional(),
|
||||
}).optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Message creation timestamp (Unix epoch seconds).').optional(),
|
||||
}).describe('Response object for blocking mode chat completion.')
|
||||
|
||||
export type ChatCompletionResponseZodType = z.infer<typeof zChatCompletionResponse>
|
||||
|
||||
export const zStreamEventChatMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
metadata: z.object({
|
||||
usage: zUsage.optional(),
|
||||
retriever_resources: z.array(zRetrieverResource).optional(),
|
||||
}),
|
||||
event: z.literal('message_end'),
|
||||
}).describe('Message end event, streaming has ended.'))
|
||||
|
||||
export type StreamEventChatMessageEndZodType = z.infer<typeof zStreamEventChatMessageEnd>
|
||||
|
||||
export const zFileUploadResponse = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
name: z.string().optional(),
|
||||
size: z.number().int().optional(),
|
||||
extension: z.string().optional(),
|
||||
mime_type: z.string().optional(),
|
||||
created_by: z.string().uuid().optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type FileUploadResponseZodType = z.infer<typeof zFileUploadResponse>
|
||||
|
||||
export const zMessageFeedbackRequest = z.object({
|
||||
rating: z.enum(['like', 'dislike']).nullable().optional(),
|
||||
user: z.string(),
|
||||
content: z.string().optional(),
|
||||
})
|
||||
|
||||
export type MessageFeedbackRequestZodType = z.infer<typeof zMessageFeedbackRequest>
|
||||
|
||||
export const zFeedbackItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
app_id: z.string().uuid().optional(),
|
||||
conversation_id: z.string().uuid().optional(),
|
||||
message_id: z.string().uuid().optional(),
|
||||
rating: z.enum(['like', 'dislike']).nullable().optional(),
|
||||
content: z.string().optional(),
|
||||
from_source: z.string().optional(),
|
||||
from_end_user_id: z.string().uuid().optional(),
|
||||
from_account_id: z.union([
|
||||
z.string().uuid(),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
created_at: z.string().datetime().optional(),
|
||||
updated_at: z.string().datetime().optional(),
|
||||
})
|
||||
|
||||
export type FeedbackItemZodType = z.infer<typeof zFeedbackItem>
|
||||
|
||||
export const zAppFeedbacksResponse = z.object({
|
||||
data: z.array(zFeedbackItem).optional(),
|
||||
})
|
||||
|
||||
export type AppFeedbacksResponseZodType = z.infer<typeof zAppFeedbacksResponse>
|
||||
|
||||
export const zSuggestedQuestionsResponse = z.object({
|
||||
result: z.string().optional(),
|
||||
data: z.array(z.string()).optional(),
|
||||
})
|
||||
|
||||
export type SuggestedQuestionsResponseZodType = z.infer<typeof zSuggestedQuestionsResponse>
|
||||
|
||||
export const zMessageFileItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
type: z.string().describe('File type, e.g., \'image\'.').optional(),
|
||||
url: z.string().describe('Preview image URL.').optional(),
|
||||
belongs_to: z.enum(['user', 'assistant']).describe('Who this file belongs to.').optional(),
|
||||
})
|
||||
|
||||
export type MessageFileItemZodType = z.infer<typeof zMessageFileItem>
|
||||
|
||||
export const zAgentThoughtItem = z.object({
|
||||
id: z.string().uuid().describe('Agent thought ID.').optional(),
|
||||
message_id: z.string().uuid().describe('Unique message ID this thought belongs to.').optional(),
|
||||
position: z.number().int().describe('Position of this thought.').optional(),
|
||||
thought: z.string().describe('What LLM is thinking.').optional(),
|
||||
tool: z.string().describe('Tools called, split by \';\'.').optional(),
|
||||
tool_input: z.string().describe('Input of tools in JSON format.').optional(),
|
||||
observation: z.string().describe('Response from tool calls.').optional(),
|
||||
files: z.array(z.string().uuid()).describe('File IDs related to this thought (from example, Markdown text says \'message_files\').').optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(),
|
||||
})
|
||||
|
||||
export type AgentThoughtItemZodType = z.infer<typeof zAgentThoughtItem>
|
||||
|
||||
export const zConversationMessageItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
conversation_id: z.string().uuid().optional(),
|
||||
inputs: z.record(z.unknown()).optional(),
|
||||
query: z.string().optional(),
|
||||
answer: z.string().optional(),
|
||||
message_files: z.array(zMessageFileItem).optional(),
|
||||
feedback: z.union([
|
||||
z.object({
|
||||
rating: z.enum(['like', 'dislike']).optional(),
|
||||
}),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
retriever_resources: z.array(zRetrieverResource).optional(),
|
||||
agent_thoughts: z.array(zAgentThoughtItem).optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type ConversationMessageItemZodType = z.infer<typeof zConversationMessageItem>
|
||||
|
||||
export const zConversationHistoryResponse = z.object({
|
||||
limit: z.number().int().optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
data: z.array(zConversationMessageItem).optional(),
|
||||
})
|
||||
|
||||
export type ConversationHistoryResponseZodType = z.infer<typeof zConversationHistoryResponse>
|
||||
|
||||
export const zConversationListItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
name: z.string().optional(),
|
||||
inputs: z.record(z.unknown()).optional(),
|
||||
status: z.string().optional(),
|
||||
introduction: z.string().optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type ConversationListItemZodType = z.infer<typeof zConversationListItem>
|
||||
|
||||
export const zConversationsListResponse = z.object({
|
||||
limit: z.number().int().optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
data: z.array(zConversationListItem).optional(),
|
||||
})
|
||||
|
||||
export type ConversationsListResponseZodType = z.infer<typeof zConversationsListResponse>
|
||||
|
||||
export const zConversationRenameRequest = z.object({
|
||||
name: z.string().describe('(Optional) The name of the conversation. Omit if auto_generate is true.').optional(),
|
||||
auto_generate: z.boolean().describe('(Optional) Automatically generate the title. Default false.').optional().default(false),
|
||||
user: z.string().describe('The user identifier.'),
|
||||
})
|
||||
|
||||
export type ConversationRenameRequestZodType = z.infer<typeof zConversationRenameRequest>
|
||||
|
||||
export const zConversationRenameResponse = zConversationListItem
|
||||
|
||||
export type ConversationRenameResponseZodType = z.infer<typeof zConversationRenameResponse>
|
||||
|
||||
export const zConversationVariableItem = z.object({
|
||||
id: z.string().uuid().describe('Variable ID.').optional(),
|
||||
name: z.string().describe('Variable name.').optional(),
|
||||
value_type: z.string().describe('Variable type (string, number, object, json, etc.).').optional(),
|
||||
value: z.string().describe('Variable value (can be a JSON string for complex types).').optional(),
|
||||
description: z.string().describe('Variable description.').optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(),
|
||||
updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Last update timestamp.').optional(),
|
||||
})
|
||||
|
||||
export type ConversationVariableItemZodType = z.infer<typeof zConversationVariableItem>
|
||||
|
||||
export const zConversationVariablesResponse = z.object({
|
||||
limit: z.number().int().describe('Number of items per page.').optional(),
|
||||
has_more: z.boolean().describe('Whether there is a next page.').optional(),
|
||||
data: z.array(zConversationVariableItem).optional(),
|
||||
})
|
||||
|
||||
export type ConversationVariablesResponseZodType = z.infer<typeof zConversationVariablesResponse>
|
||||
|
||||
export const zAudioToTextRequest = z.object({
|
||||
file: z.string().describe('Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB.'),
|
||||
user: z.string().describe('User identifier.'),
|
||||
})
|
||||
|
||||
export type AudioToTextRequestZodType = z.infer<typeof zAudioToTextRequest>
|
||||
|
||||
export const zAudioToTextResponse = z.object({
|
||||
text: z.string().describe('Output text from speech recognition.').optional(),
|
||||
})
|
||||
|
||||
export type AudioToTextResponseZodType = z.infer<typeof zAudioToTextResponse>
|
||||
|
||||
/**
|
||||
* Requires `user`. Provide either `message_id` or `text`.
|
||||
*/
|
||||
export const zTextToAudioFormRequest = z.object({
|
||||
message_id: z.string().uuid().describe('Message ID (priority if both text and message_id provided).').optional(),
|
||||
text: z.string().describe('Speech content.').optional(),
|
||||
user: z.string().describe('User identifier.'),
|
||||
}).describe('Requires `user`. Provide either `message_id` or `text`.')
|
||||
|
||||
export type TextToAudioFormRequestZodType = z.infer<typeof zTextToAudioFormRequest>
|
||||
|
||||
export const zAppInfoResponse = z.object({
|
||||
name: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
})
|
||||
|
||||
export type AppInfoResponseZodType = z.infer<typeof zAppInfoResponse>
|
||||
|
||||
export const zTextInputControl = z.object({
|
||||
label: z.string(),
|
||||
variable: z.string(),
|
||||
required: z.boolean(),
|
||||
default: z.string().optional(),
|
||||
})
|
||||
|
||||
export type TextInputControlZodType = z.infer<typeof zTextInputControl>
|
||||
|
||||
export const zTextInputControlWrapper = z.object({
|
||||
'text-input': zTextInputControl,
|
||||
})
|
||||
|
||||
export type TextInputControlWrapperZodType = z.infer<typeof zTextInputControlWrapper>
|
||||
|
||||
export const zParagraphControl = z.object({
|
||||
label: z.string(),
|
||||
variable: z.string(),
|
||||
required: z.boolean(),
|
||||
default: z.string().optional(),
|
||||
})
|
||||
|
||||
export type ParagraphControlZodType = z.infer<typeof zParagraphControl>
|
||||
|
||||
export const zParagraphControlWrapper = z.object({
|
||||
paragraph: zParagraphControl,
|
||||
})
|
||||
|
||||
export type ParagraphControlWrapperZodType = z.infer<typeof zParagraphControlWrapper>
|
||||
|
||||
export const zSelectControl = z.object({
|
||||
label: z.string(),
|
||||
variable: z.string(),
|
||||
required: z.boolean(),
|
||||
default: z.string().optional(),
|
||||
options: z.array(z.string()),
|
||||
})
|
||||
|
||||
export type SelectControlZodType = z.infer<typeof zSelectControl>
|
||||
|
||||
export const zSelectControlWrapper = z.object({
|
||||
select: zSelectControl,
|
||||
})
|
||||
|
||||
export type SelectControlWrapperZodType = z.infer<typeof zSelectControlWrapper>
|
||||
|
||||
export const zUserInputFormItem = z.union([
|
||||
zTextInputControlWrapper,
|
||||
zParagraphControlWrapper,
|
||||
zSelectControlWrapper,
|
||||
])
|
||||
|
||||
export type UserInputFormItemZodType = z.infer<typeof zUserInputFormItem>
|
||||
|
||||
export const zChatAppParametersResponse = z.object({
|
||||
opening_statement: z.string().optional(),
|
||||
suggested_questions: z.array(z.string()).optional(),
|
||||
suggested_questions_after_answer: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
speech_to_text: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
text_to_speech: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
voice: z.string().optional(),
|
||||
language: z.string().optional(),
|
||||
autoPlay: z.enum(['enabled', 'disabled']).optional(),
|
||||
}).optional(),
|
||||
retriever_resource: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
annotation_reply: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
user_input_form: z.array(zUserInputFormItem).optional(),
|
||||
file_upload: z.object({
|
||||
image: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
number_limits: z.number().int().optional(),
|
||||
detail: z.string().optional(),
|
||||
transfer_methods: z.array(z.enum(['remote_url', 'local_file'])).optional(),
|
||||
}).optional(),
|
||||
}).optional(),
|
||||
system_parameters: z.object({
|
||||
file_size_limit: z.number().int().optional(),
|
||||
image_file_size_limit: z.number().int().optional(),
|
||||
audio_file_size_limit: z.number().int().optional(),
|
||||
video_file_size_limit: z.number().int().optional(),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type ChatAppParametersResponseZodType = z.infer<typeof zChatAppParametersResponse>
|
||||
|
||||
export const zToolIconDetail = z.object({
|
||||
background: z.string().describe('Background color in hex format.').optional(),
|
||||
content: z.string().describe('Emoji content.').optional(),
|
||||
})
|
||||
|
||||
export type ToolIconDetailZodType = z.infer<typeof zToolIconDetail>
|
||||
|
||||
export const zAppMetaResponse = z.object({
|
||||
tool_icons: z.record(z.union([
|
||||
z.string().describe('URL of the icon.'),
|
||||
zToolIconDetail,
|
||||
])).describe('Tool icons. Keys are tool names.').optional(),
|
||||
})
|
||||
|
||||
export type AppMetaResponseZodType = z.infer<typeof zAppMetaResponse>
|
||||
|
||||
export const zWebAppSettingsResponse = z.object({
|
||||
title: z.string().optional(),
|
||||
chat_color_theme: z.string().optional(),
|
||||
chat_color_theme_inverted: z.boolean().optional(),
|
||||
icon_type: z.enum(['emoji', 'image']).optional(),
|
||||
icon: z.string().optional(),
|
||||
icon_background: z.string().optional(),
|
||||
icon_url: z.union([
|
||||
z.string(),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
description: z.string().optional(),
|
||||
copyright: z.string().optional(),
|
||||
privacy_policy: z.string().optional(),
|
||||
custom_disclaimer: z.string().optional(),
|
||||
default_language: z.string().optional(),
|
||||
show_workflow_steps: z.boolean().optional(),
|
||||
use_icon_as_answer_icon: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export type WebAppSettingsResponseZodType = z.infer<typeof zWebAppSettingsResponse>
|
||||
|
||||
export const zAnnotationItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
question: z.string().optional(),
|
||||
answer: z.string().optional(),
|
||||
hit_count: z.number().int().optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type AnnotationItemZodType = z.infer<typeof zAnnotationItem>
|
||||
|
||||
export const zAnnotationListResponse = z.object({
|
||||
data: z.array(zAnnotationItem).optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
limit: z.number().int().optional(),
|
||||
total: z.number().int().optional(),
|
||||
page: z.number().int().optional(),
|
||||
})
|
||||
|
||||
export type AnnotationListResponseZodType = z.infer<typeof zAnnotationListResponse>
|
||||
|
||||
export const zCreateAnnotationRequest = z.object({
|
||||
question: z.string(),
|
||||
answer: z.string(),
|
||||
})
|
||||
|
||||
export type CreateAnnotationRequestZodType = z.infer<typeof zCreateAnnotationRequest>
|
||||
|
||||
export const zUpdateAnnotationRequest = z.object({
|
||||
question: z.string(),
|
||||
answer: z.string(),
|
||||
})
|
||||
|
||||
export type UpdateAnnotationRequestZodType = z.infer<typeof zUpdateAnnotationRequest>
|
||||
|
||||
export const zInitialAnnotationReplySettingsRequest = z.object({
|
||||
embedding_provider_name: z.string().describe('Specified embedding model provider name (Optional).').optional(),
|
||||
embedding_model_name: z.string().describe('Specified embedding model name (Optional).').optional(),
|
||||
score_threshold: z.number().describe('Similarity threshold for matching annotated replies.'),
|
||||
})
|
||||
|
||||
export type InitialAnnotationReplySettingsRequestZodType = z.infer<typeof zInitialAnnotationReplySettingsRequest>
|
||||
|
||||
export const zInitialAnnotationReplySettingsResponse = z.object({
|
||||
job_id: z.string().uuid().optional(),
|
||||
job_status: z.string().optional(),
|
||||
})
|
||||
|
||||
export type InitialAnnotationReplySettingsResponseZodType = z.infer<typeof zInitialAnnotationReplySettingsResponse>
|
||||
|
||||
export const zInitialAnnotationReplySettingsStatusResponse = z.object({
|
||||
job_id: z.string().uuid().optional(),
|
||||
job_status: z.string().optional(),
|
||||
error_msg: z.union([
|
||||
z.string(),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
})
|
||||
|
||||
export type InitialAnnotationReplySettingsStatusResponseZodType = z.infer<typeof zInitialAnnotationReplySettingsStatusResponse>
|
||||
|
||||
export const zErrorResponse = z.object({
|
||||
status: z.number().int().optional(),
|
||||
code: z.string().optional(),
|
||||
message: z.string().optional(),
|
||||
})
|
||||
|
||||
export type ErrorResponseZodType = z.infer<typeof zErrorResponse>
|
||||
17
web/gen/zod/models/agent.gen.ts
Normal file
17
web/gen/zod/models/agent.gen.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zAgentThoughtItem = z.object({
|
||||
id: z.string().uuid().describe('Agent thought ID.').optional(),
|
||||
message_id: z.string().uuid().describe('Unique message ID this thought belongs to.').optional(),
|
||||
position: z.number().int().describe('Position of this thought.').optional(),
|
||||
thought: z.string().describe('What LLM is thinking.').optional(),
|
||||
tool: z.string().describe('Tools called, split by \';\'.').optional(),
|
||||
tool_input: z.string().describe('Input of tools in JSON format.').optional(),
|
||||
observation: z.string().describe('Response from tool calls.').optional(),
|
||||
files: z.array(z.string().uuid()).describe('File IDs related to this thought (from example, Markdown text says \'message_files\').').optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(),
|
||||
})
|
||||
|
||||
export type AgentThoughtItemZodType = z.infer<typeof zAgentThoughtItem>
|
||||
23
web/gen/zod/models/annotation.gen.ts
Normal file
23
web/gen/zod/models/annotation.gen.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zAnnotationItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
question: z.string().optional(),
|
||||
answer: z.string().optional(),
|
||||
hit_count: z.number().int().optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type AnnotationItemZodType = z.infer<typeof zAnnotationItem>
|
||||
|
||||
export const zAnnotationListResponse = z.object({
|
||||
data: z.array(zAnnotationItem).optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
limit: z.number().int().optional(),
|
||||
total: z.number().int().optional(),
|
||||
page: z.number().int().optional(),
|
||||
})
|
||||
|
||||
export type AnnotationListResponseZodType = z.infer<typeof zAnnotationListResponse>
|
||||
29
web/gen/zod/models/app.gen.ts
Normal file
29
web/gen/zod/models/app.gen.ts
Normal file
@ -0,0 +1,29 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zFeedbackItem } from './feedback.gen'
|
||||
import { zToolIconDetail } from './tool.gen'
|
||||
|
||||
export const zAppFeedbacksResponse = z.object({
|
||||
data: z.array(zFeedbackItem).optional(),
|
||||
})
|
||||
|
||||
export type AppFeedbacksResponseZodType = z.infer<typeof zAppFeedbacksResponse>
|
||||
|
||||
export const zAppInfoResponse = z.object({
|
||||
name: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
})
|
||||
|
||||
export type AppInfoResponseZodType = z.infer<typeof zAppInfoResponse>
|
||||
|
||||
export const zAppMetaResponse = z.object({
|
||||
tool_icons: z.record(z.union([
|
||||
z.string().describe('URL of the icon.'),
|
||||
zToolIconDetail,
|
||||
])).describe('Tool icons. Keys are tool names.').optional(),
|
||||
})
|
||||
|
||||
export type AppMetaResponseZodType = z.infer<typeof zAppMetaResponse>
|
||||
16
web/gen/zod/models/audio.gen.ts
Normal file
16
web/gen/zod/models/audio.gen.ts
Normal file
@ -0,0 +1,16 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zAudioToTextRequest = z.object({
|
||||
file: z.string().describe('Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB.'),
|
||||
user: z.string().describe('User identifier.'),
|
||||
})
|
||||
|
||||
export type AudioToTextRequestZodType = z.infer<typeof zAudioToTextRequest>
|
||||
|
||||
export const zAudioToTextResponse = z.object({
|
||||
text: z.string().describe('Output text from speech recognition.').optional(),
|
||||
})
|
||||
|
||||
export type AudioToTextResponseZodType = z.infer<typeof zAudioToTextResponse>
|
||||
80
web/gen/zod/models/chat.gen.ts
Normal file
80
web/gen/zod/models/chat.gen.ts
Normal file
@ -0,0 +1,80 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zInputFileObject } from './input.gen'
|
||||
import { zRetrieverResource } from './retriever.gen'
|
||||
import { zUsage } from './usage.gen'
|
||||
import { zUserInputFormItem } from './user.gen'
|
||||
|
||||
export const zChatRequest = z.object({
|
||||
query: z.string().describe('User Input/Question content.'),
|
||||
inputs: z.record(z.unknown()).describe('Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.').optional().default({}),
|
||||
response_mode: z.enum(['streaming', 'blocking']).describe('Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.').optional(),
|
||||
user: z.string().describe('User identifier, unique within the application. **Note**: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.'),
|
||||
conversation_id: z.string().describe('Conversation ID to continue a conversation. Pass the previous message\'s conversation_id.').optional(),
|
||||
files: z.array(zInputFileObject).describe('File list (images) for Vision-capable models.').optional(),
|
||||
auto_generate_name: z.boolean().describe('Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.').optional().default(true),
|
||||
})
|
||||
|
||||
export type ChatRequestZodType = z.infer<typeof zChatRequest>
|
||||
|
||||
/**
|
||||
* Response object for blocking mode chat completion.
|
||||
*/
|
||||
export const zChatCompletionResponse = z.object({
|
||||
event: z.string().describe('Event type, fixed as `message`.').optional(),
|
||||
task_id: z.string().uuid().describe('Task ID for request tracking and stop response API.').optional(),
|
||||
id: z.string().uuid().describe('Unique ID of this response/message event.').optional(),
|
||||
message_id: z.string().uuid().describe('Unique message ID.').optional(),
|
||||
conversation_id: z.string().uuid().describe('Conversation ID.').optional(),
|
||||
mode: z.string().describe('App mode, fixed as `chat`.').optional(),
|
||||
answer: z.string().describe('Complete response content.').optional(),
|
||||
metadata: z.object({
|
||||
usage: zUsage.optional(),
|
||||
retriever_resources: z.array(zRetrieverResource).optional(),
|
||||
}).optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Message creation timestamp (Unix epoch seconds).').optional(),
|
||||
}).describe('Response object for blocking mode chat completion.')
|
||||
|
||||
export type ChatCompletionResponseZodType = z.infer<typeof zChatCompletionResponse>
|
||||
|
||||
export const zChatAppParametersResponse = z.object({
|
||||
opening_statement: z.string().optional(),
|
||||
suggested_questions: z.array(z.string()).optional(),
|
||||
suggested_questions_after_answer: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
speech_to_text: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
text_to_speech: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
voice: z.string().optional(),
|
||||
language: z.string().optional(),
|
||||
autoPlay: z.enum(['enabled', 'disabled']).optional(),
|
||||
}).optional(),
|
||||
retriever_resource: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
annotation_reply: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
}).optional(),
|
||||
user_input_form: z.array(zUserInputFormItem).optional(),
|
||||
file_upload: z.object({
|
||||
image: z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
number_limits: z.number().int().optional(),
|
||||
detail: z.string().optional(),
|
||||
transfer_methods: z.array(z.enum(['remote_url', 'local_file'])).optional(),
|
||||
}).optional(),
|
||||
}).optional(),
|
||||
system_parameters: z.object({
|
||||
file_size_limit: z.number().int().optional(),
|
||||
image_file_size_limit: z.number().int().optional(),
|
||||
audio_file_size_limit: z.number().int().optional(),
|
||||
video_file_size_limit: z.number().int().optional(),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export type ChatAppParametersResponseZodType = z.infer<typeof zChatAppParametersResponse>
|
||||
23
web/gen/zod/models/chunk.gen.ts
Normal file
23
web/gen/zod/models/chunk.gen.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
/**
|
||||
* Base schema for Server-Sent Event chunks in streaming mode.
|
||||
*/
|
||||
export const zChunkChatEvent = z.object({
|
||||
event: z.enum([
|
||||
'message',
|
||||
'agent_message',
|
||||
'tts_message',
|
||||
'tts_message_end',
|
||||
'agent_thought',
|
||||
'message_file',
|
||||
'message_end',
|
||||
'message_replace',
|
||||
'error',
|
||||
'ping',
|
||||
]).describe('The type of event.'),
|
||||
}).describe('Base schema for Server-Sent Event chunks in streaming mode.')
|
||||
|
||||
export type ChunkChatEventZodType = z.infer<typeof zChunkChatEvent>
|
||||
79
web/gen/zod/models/conversation.gen.ts
Normal file
79
web/gen/zod/models/conversation.gen.ts
Normal file
@ -0,0 +1,79 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zAgentThoughtItem } from './agent.gen'
|
||||
import { zMessageFileItem } from './message.gen'
|
||||
import { zRetrieverResource } from './retriever.gen'
|
||||
|
||||
export const zConversationMessageItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
conversation_id: z.string().uuid().optional(),
|
||||
inputs: z.record(z.unknown()).optional(),
|
||||
query: z.string().optional(),
|
||||
answer: z.string().optional(),
|
||||
message_files: z.array(zMessageFileItem).optional(),
|
||||
feedback: z.union([
|
||||
z.object({
|
||||
rating: z.enum(['like', 'dislike']).optional(),
|
||||
}),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
retriever_resources: z.array(zRetrieverResource).optional(),
|
||||
agent_thoughts: z.array(zAgentThoughtItem).optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type ConversationMessageItemZodType = z.infer<typeof zConversationMessageItem>
|
||||
|
||||
export const zConversationHistoryResponse = z.object({
|
||||
limit: z.number().int().optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
data: z.array(zConversationMessageItem).optional(),
|
||||
})
|
||||
|
||||
export type ConversationHistoryResponseZodType = z.infer<typeof zConversationHistoryResponse>
|
||||
|
||||
export const zConversationListItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
name: z.string().optional(),
|
||||
inputs: z.record(z.unknown()).optional(),
|
||||
status: z.string().optional(),
|
||||
introduction: z.string().optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type ConversationListItemZodType = z.infer<typeof zConversationListItem>
|
||||
|
||||
export const zConversationRenameRequest = z.object({
|
||||
name: z.string().describe('(Optional) The name of the conversation. Omit if auto_generate is true.').optional(),
|
||||
auto_generate: z.boolean().describe('(Optional) Automatically generate the title. Default false.').optional().default(false),
|
||||
user: z.string().describe('The user identifier.'),
|
||||
})
|
||||
|
||||
export type ConversationRenameRequestZodType = z.infer<typeof zConversationRenameRequest>
|
||||
|
||||
export const zConversationRenameResponse = zConversationListItem
|
||||
|
||||
export type ConversationRenameResponseZodType = z.infer<typeof zConversationRenameResponse>
|
||||
|
||||
export const zConversationVariableItem = z.object({
|
||||
id: z.string().uuid().describe('Variable ID.').optional(),
|
||||
name: z.string().describe('Variable name.').optional(),
|
||||
value_type: z.string().describe('Variable type (string, number, object, json, etc.).').optional(),
|
||||
value: z.string().describe('Variable value (can be a JSON string for complex types).').optional(),
|
||||
description: z.string().describe('Variable description.').optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(),
|
||||
updated_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Last update timestamp.').optional(),
|
||||
})
|
||||
|
||||
export type ConversationVariableItemZodType = z.infer<typeof zConversationVariableItem>
|
||||
|
||||
export const zConversationVariablesResponse = z.object({
|
||||
limit: z.number().int().describe('Number of items per page.').optional(),
|
||||
has_more: z.boolean().describe('Whether there is a next page.').optional(),
|
||||
data: z.array(zConversationVariableItem).optional(),
|
||||
})
|
||||
|
||||
export type ConversationVariablesResponseZodType = z.infer<typeof zConversationVariablesResponse>
|
||||
13
web/gen/zod/models/conversations.gen.ts
Normal file
13
web/gen/zod/models/conversations.gen.ts
Normal file
@ -0,0 +1,13 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zConversationListItem } from './conversation.gen'
|
||||
|
||||
export const zConversationsListResponse = z.object({
|
||||
limit: z.number().int().optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
data: z.array(zConversationListItem).optional(),
|
||||
})
|
||||
|
||||
export type ConversationsListResponseZodType = z.infer<typeof zConversationsListResponse>
|
||||
10
web/gen/zod/models/create.gen.ts
Normal file
10
web/gen/zod/models/create.gen.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zCreateAnnotationRequest = z.object({
|
||||
question: z.string(),
|
||||
answer: z.string(),
|
||||
})
|
||||
|
||||
export type CreateAnnotationRequestZodType = z.infer<typeof zCreateAnnotationRequest>
|
||||
11
web/gen/zod/models/error.gen.ts
Normal file
11
web/gen/zod/models/error.gen.ts
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zErrorResponse = z.object({
|
||||
status: z.number().int().optional(),
|
||||
code: z.string().optional(),
|
||||
message: z.string().optional(),
|
||||
})
|
||||
|
||||
export type ErrorResponseZodType = z.infer<typeof zErrorResponse>
|
||||
22
web/gen/zod/models/feedback.gen.ts
Normal file
22
web/gen/zod/models/feedback.gen.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zFeedbackItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
app_id: z.string().uuid().optional(),
|
||||
conversation_id: z.string().uuid().optional(),
|
||||
message_id: z.string().uuid().optional(),
|
||||
rating: z.enum(['like', 'dislike']).nullable().optional(),
|
||||
content: z.string().optional(),
|
||||
from_source: z.string().optional(),
|
||||
from_end_user_id: z.string().uuid().optional(),
|
||||
from_account_id: z.union([
|
||||
z.string().uuid(),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
created_at: z.string().datetime().optional(),
|
||||
updated_at: z.string().datetime().optional(),
|
||||
})
|
||||
|
||||
export type FeedbackItemZodType = z.infer<typeof zFeedbackItem>
|
||||
15
web/gen/zod/models/file.gen.ts
Normal file
15
web/gen/zod/models/file.gen.ts
Normal file
@ -0,0 +1,15 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zFileUploadResponse = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
name: z.string().optional(),
|
||||
size: z.number().int().optional(),
|
||||
extension: z.string().optional(),
|
||||
mime_type: z.string().optional(),
|
||||
created_by: z.string().uuid().optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
||||
})
|
||||
|
||||
export type FileUploadResponseZodType = z.infer<typeof zFileUploadResponse>
|
||||
29
web/gen/zod/models/initial.gen.ts
Normal file
29
web/gen/zod/models/initial.gen.ts
Normal file
@ -0,0 +1,29 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zInitialAnnotationReplySettingsRequest = z.object({
|
||||
embedding_provider_name: z.string().describe('Specified embedding model provider name (Optional).').optional(),
|
||||
embedding_model_name: z.string().describe('Specified embedding model name (Optional).').optional(),
|
||||
score_threshold: z.number().describe('Similarity threshold for matching annotated replies.'),
|
||||
})
|
||||
|
||||
export type InitialAnnotationReplySettingsRequestZodType = z.infer<typeof zInitialAnnotationReplySettingsRequest>
|
||||
|
||||
export const zInitialAnnotationReplySettingsResponse = z.object({
|
||||
job_id: z.string().uuid().optional(),
|
||||
job_status: z.string().optional(),
|
||||
})
|
||||
|
||||
export type InitialAnnotationReplySettingsResponseZodType = z.infer<typeof zInitialAnnotationReplySettingsResponse>
|
||||
|
||||
export const zInitialAnnotationReplySettingsStatusResponse = z.object({
|
||||
job_id: z.string().uuid().optional(),
|
||||
job_status: z.string().optional(),
|
||||
error_msg: z.union([
|
||||
z.string(),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
})
|
||||
|
||||
export type InitialAnnotationReplySettingsStatusResponseZodType = z.infer<typeof zInitialAnnotationReplySettingsStatusResponse>
|
||||
21
web/gen/zod/models/input.gen.ts
Normal file
21
web/gen/zod/models/input.gen.ts
Normal file
@ -0,0 +1,21 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zInputFileObject = z.intersection(z.union([
|
||||
z.object({
|
||||
transfer_method: z.enum(['remote_url']).optional(),
|
||||
url: z.string(),
|
||||
}),
|
||||
z.object({
|
||||
transfer_method: z.enum(['local_file']).optional(),
|
||||
upload_file_id: z.string(),
|
||||
}),
|
||||
]), z.object({
|
||||
type: z.enum(['image']).describe('Supported type: `image`.'),
|
||||
transfer_method: z.enum(['remote_url', 'local_file']).describe('Transfer method, `remote_url` for image URL / `local_file` for file upload'),
|
||||
url: z.string().describe('Image URL (when the transfer method is `remote_url`)').optional(),
|
||||
upload_file_id: z.string().describe('Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)').optional(),
|
||||
}))
|
||||
|
||||
export type InputFileObjectZodType = z.infer<typeof zInputFileObject>
|
||||
20
web/gen/zod/models/message.gen.ts
Normal file
20
web/gen/zod/models/message.gen.ts
Normal file
@ -0,0 +1,20 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zMessageFeedbackRequest = z.object({
|
||||
rating: z.enum(['like', 'dislike']).nullable().optional(),
|
||||
user: z.string(),
|
||||
content: z.string().optional(),
|
||||
})
|
||||
|
||||
export type MessageFeedbackRequestZodType = z.infer<typeof zMessageFeedbackRequest>
|
||||
|
||||
export const zMessageFileItem = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
type: z.string().describe('File type, e.g., \'image\'.').optional(),
|
||||
url: z.string().describe('Preview image URL.').optional(),
|
||||
belongs_to: z.enum(['user', 'assistant']).describe('Who this file belongs to.').optional(),
|
||||
})
|
||||
|
||||
export type MessageFileItemZodType = z.infer<typeof zMessageFileItem>
|
||||
18
web/gen/zod/models/paragraph.gen.ts
Normal file
18
web/gen/zod/models/paragraph.gen.ts
Normal file
@ -0,0 +1,18 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zParagraphControl = z.object({
|
||||
label: z.string(),
|
||||
variable: z.string(),
|
||||
required: z.boolean(),
|
||||
default: z.string().optional(),
|
||||
})
|
||||
|
||||
export type ParagraphControlZodType = z.infer<typeof zParagraphControl>
|
||||
|
||||
export const zParagraphControlWrapper = z.object({
|
||||
paragraph: zParagraphControl,
|
||||
})
|
||||
|
||||
export type ParagraphControlWrapperZodType = z.infer<typeof zParagraphControlWrapper>
|
||||
19
web/gen/zod/models/retriever.gen.ts
Normal file
19
web/gen/zod/models/retriever.gen.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
/**
|
||||
* Citation and Attribution information for a resource.
|
||||
*/
|
||||
export const zRetrieverResource = z.object({
|
||||
position: z.number().int().describe('Position of the resource in the list.').optional(),
|
||||
dataset_id: z.string().uuid().describe('ID of the dataset.').optional(),
|
||||
dataset_name: z.string().describe('Name of the dataset.').optional(),
|
||||
document_id: z.string().uuid().describe('ID of the document.').optional(),
|
||||
document_name: z.string().describe('Name of the document.').optional(),
|
||||
segment_id: z.string().uuid().describe('ID of the specific segment within the document.').optional(),
|
||||
score: z.number().describe('Relevance score of the resource.').optional(),
|
||||
content: z.string().describe('Content snippet from the resource.').optional(),
|
||||
}).describe('Citation and Attribution information for a resource.')
|
||||
|
||||
export type RetrieverResourceZodType = z.infer<typeof zRetrieverResource>
|
||||
19
web/gen/zod/models/select.gen.ts
Normal file
19
web/gen/zod/models/select.gen.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zSelectControl = z.object({
|
||||
label: z.string(),
|
||||
variable: z.string(),
|
||||
required: z.boolean(),
|
||||
default: z.string().optional(),
|
||||
options: z.array(z.string()),
|
||||
})
|
||||
|
||||
export type SelectControlZodType = z.infer<typeof zSelectControl>
|
||||
|
||||
export const zSelectControlWrapper = z.object({
|
||||
select: zSelectControl,
|
||||
})
|
||||
|
||||
export type SelectControlWrapperZodType = z.infer<typeof zSelectControlWrapper>
|
||||
100
web/gen/zod/models/stream.gen.ts
Normal file
100
web/gen/zod/models/stream.gen.ts
Normal file
@ -0,0 +1,100 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zChunkChatEvent } from './chunk.gen'
|
||||
import { zRetrieverResource } from './retriever.gen'
|
||||
import { zUsage } from './usage.gen'
|
||||
|
||||
export const zStreamEventBase = z.object({
|
||||
task_id: z.string().uuid().describe('Task ID.').optional(),
|
||||
message_id: z.string().uuid().describe('Unique message ID.').optional(),
|
||||
conversation_id: z.string().uuid().describe('Conversation ID.').optional(),
|
||||
created_at: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).describe('Creation timestamp.').optional(),
|
||||
})
|
||||
|
||||
export type StreamEventBaseZodType = z.infer<typeof zStreamEventBase>
|
||||
|
||||
export const zStreamEventChatMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
answer: z.string().describe('LLM returned text chunk.'),
|
||||
event: z.literal('message'),
|
||||
}))
|
||||
|
||||
export type StreamEventChatMessageZodType = z.infer<typeof zStreamEventChatMessage>
|
||||
|
||||
export const zStreamEventChatAgentMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
answer: z.string().describe('LLM returned text chunk (Agent mode).'),
|
||||
event: z.literal('agent_message'),
|
||||
}))
|
||||
|
||||
export type StreamEventChatAgentMessageZodType = z.infer<typeof zStreamEventChatAgentMessage>
|
||||
|
||||
export const zStreamEventChatTtsMessage = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
audio: z.string().describe('Base64 encoded audio chunk.'),
|
||||
event: z.literal('tts_message'),
|
||||
}).describe('TTS audio stream event (base64 encoded Mp3). Available if auto-play enabled.'))
|
||||
|
||||
export type StreamEventChatTtsMessageZodType = z.infer<typeof zStreamEventChatTtsMessage>
|
||||
|
||||
export const zStreamEventChatTtsMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
audio: z.string().describe('Empty string for end event.'),
|
||||
event: z.literal('tts_message_end'),
|
||||
}).describe('TTS audio stream end event.'))
|
||||
|
||||
export type StreamEventChatTtsMessageEndZodType = z.infer<typeof zStreamEventChatTtsMessageEnd>
|
||||
|
||||
export const zStreamEventChatAgentThought = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
id: z.string().uuid().describe('Agent thought ID.'),
|
||||
position: z.number().int().describe('Position of this thought in the sequence for the message.'),
|
||||
thought: z.string().describe('What LLM is thinking.').optional(),
|
||||
observation: z.string().describe('Response from tool calls.').optional(),
|
||||
tool: z.string().describe('List of tools called, split by \';\'.').optional(),
|
||||
tool_input: z.string().describe('Input of tools in JSON format. Example: {"dalle3": {"prompt": "a cute cat"}}.').optional(),
|
||||
message_files: z.array(z.string().uuid()).describe('File IDs of files related to this thought (e.g., generated by a tool).').optional(),
|
||||
event: z.literal('agent_thought'),
|
||||
}).describe('Agent thought, LLM thinking, tool call details (Agent mode).'))
|
||||
|
||||
export type StreamEventChatAgentThoughtZodType = z.infer<typeof zStreamEventChatAgentThought>
|
||||
|
||||
export const zStreamEventChatMessageFile = zChunkChatEvent.and(z.object({
|
||||
id: z.string().uuid().describe('File unique ID.'),
|
||||
type: z.enum(['image']).describe('File type, currently only \'image\'.'),
|
||||
belongs_to: z.enum(['assistant']).describe('Who this file belongs to, always \'assistant\' here.'),
|
||||
url: z.string().describe('Remote URL of the file.'),
|
||||
conversation_id: z.string().uuid().describe('Conversation ID.'),
|
||||
event: z.literal('message_file'),
|
||||
}).describe('Message file event, a new file created by a tool.'))
|
||||
|
||||
export type StreamEventChatMessageFileZodType = z.infer<typeof zStreamEventChatMessageFile>
|
||||
|
||||
export const zStreamEventChatMessageReplace = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
answer: z.string().describe('Replacement content.'),
|
||||
event: z.literal('message_replace'),
|
||||
}).describe('Message content replacement event (e.g., due to content moderation).'))
|
||||
|
||||
export type StreamEventChatMessageReplaceZodType = z.infer<typeof zStreamEventChatMessageReplace>
|
||||
|
||||
export const zStreamEventChatError = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
status: z.number().int().describe('HTTP status code.'),
|
||||
code: z.string().describe('Error code.'),
|
||||
message: z.string().describe('Error message.'),
|
||||
event: z.literal('error'),
|
||||
}).describe('Error event during streaming.'))
|
||||
|
||||
export type StreamEventChatErrorZodType = z.infer<typeof zStreamEventChatError>
|
||||
|
||||
export const zStreamEventChatPing = zChunkChatEvent.and(z.object({
|
||||
event: z.literal('ping'),
|
||||
}).describe('Ping event to keep connection alive.'))
|
||||
|
||||
export type StreamEventChatPingZodType = z.infer<typeof zStreamEventChatPing>
|
||||
|
||||
export const zStreamEventChatMessageEnd = zChunkChatEvent.and(zStreamEventBase).and(z.object({
|
||||
metadata: z.object({
|
||||
usage: zUsage.optional(),
|
||||
retriever_resources: z.array(zRetrieverResource).optional(),
|
||||
}),
|
||||
event: z.literal('message_end'),
|
||||
}).describe('Message end event, streaming has ended.'))
|
||||
|
||||
export type StreamEventChatMessageEndZodType = z.infer<typeof zStreamEventChatMessageEnd>
|
||||
10
web/gen/zod/models/suggested.gen.ts
Normal file
10
web/gen/zod/models/suggested.gen.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zSuggestedQuestionsResponse = z.object({
|
||||
result: z.string().optional(),
|
||||
data: z.array(z.string()).optional(),
|
||||
})
|
||||
|
||||
export type SuggestedQuestionsResponseZodType = z.infer<typeof zSuggestedQuestionsResponse>
|
||||
29
web/gen/zod/models/text.gen.ts
Normal file
29
web/gen/zod/models/text.gen.ts
Normal file
@ -0,0 +1,29 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
/**
|
||||
* Requires `user`. Provide either `message_id` or `text`.
|
||||
*/
|
||||
export const zTextToAudioFormRequest = z.object({
|
||||
message_id: z.string().uuid().describe('Message ID (priority if both text and message_id provided).').optional(),
|
||||
text: z.string().describe('Speech content.').optional(),
|
||||
user: z.string().describe('User identifier.'),
|
||||
}).describe('Requires `user`. Provide either `message_id` or `text`.')
|
||||
|
||||
export type TextToAudioFormRequestZodType = z.infer<typeof zTextToAudioFormRequest>
|
||||
|
||||
export const zTextInputControl = z.object({
|
||||
label: z.string(),
|
||||
variable: z.string(),
|
||||
required: z.boolean(),
|
||||
default: z.string().optional(),
|
||||
})
|
||||
|
||||
export type TextInputControlZodType = z.infer<typeof zTextInputControl>
|
||||
|
||||
export const zTextInputControlWrapper = z.object({
|
||||
'text-input': zTextInputControl,
|
||||
})
|
||||
|
||||
export type TextInputControlWrapperZodType = z.infer<typeof zTextInputControlWrapper>
|
||||
10
web/gen/zod/models/tool.gen.ts
Normal file
10
web/gen/zod/models/tool.gen.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zToolIconDetail = z.object({
|
||||
background: z.string().describe('Background color in hex format.').optional(),
|
||||
content: z.string().describe('Emoji content.').optional(),
|
||||
})
|
||||
|
||||
export type ToolIconDetailZodType = z.infer<typeof zToolIconDetail>
|
||||
10
web/gen/zod/models/update.gen.ts
Normal file
10
web/gen/zod/models/update.gen.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zUpdateAnnotationRequest = z.object({
|
||||
question: z.string(),
|
||||
answer: z.string(),
|
||||
})
|
||||
|
||||
export type UpdateAnnotationRequestZodType = z.infer<typeof zUpdateAnnotationRequest>
|
||||
23
web/gen/zod/models/usage.gen.ts
Normal file
23
web/gen/zod/models/usage.gen.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
/**
|
||||
* Model usage information.
|
||||
*/
|
||||
export const zUsage = z.object({
|
||||
prompt_tokens: z.number().int().optional(),
|
||||
prompt_unit_price: z.string().optional(),
|
||||
prompt_price_unit: z.string().optional(),
|
||||
prompt_price: z.string().optional(),
|
||||
completion_tokens: z.number().int().optional(),
|
||||
completion_unit_price: z.string().optional(),
|
||||
completion_price_unit: z.string().optional(),
|
||||
completion_price: z.string().optional(),
|
||||
total_tokens: z.number().int().optional(),
|
||||
total_price: z.string().optional(),
|
||||
currency: z.string().optional(),
|
||||
latency: z.number().optional(),
|
||||
}).describe('Model usage information.')
|
||||
|
||||
export type UsageZodType = z.infer<typeof zUsage>
|
||||
15
web/gen/zod/models/user.gen.ts
Normal file
15
web/gen/zod/models/user.gen.ts
Normal file
@ -0,0 +1,15 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
import { zParagraphControlWrapper } from './paragraph.gen'
|
||||
import { zSelectControlWrapper } from './select.gen'
|
||||
import { zTextInputControlWrapper } from './text.gen'
|
||||
|
||||
export const zUserInputFormItem = z.union([
|
||||
zTextInputControlWrapper,
|
||||
zParagraphControlWrapper,
|
||||
zSelectControlWrapper,
|
||||
])
|
||||
|
||||
export type UserInputFormItemZodType = z.infer<typeof zUserInputFormItem>
|
||||
25
web/gen/zod/models/web.gen.ts
Normal file
25
web/gen/zod/models/web.gen.ts
Normal file
@ -0,0 +1,25 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export const zWebAppSettingsResponse = z.object({
|
||||
title: z.string().optional(),
|
||||
chat_color_theme: z.string().optional(),
|
||||
chat_color_theme_inverted: z.boolean().optional(),
|
||||
icon_type: z.enum(['emoji', 'image']).optional(),
|
||||
icon: z.string().optional(),
|
||||
icon_background: z.string().optional(),
|
||||
icon_url: z.union([
|
||||
z.string(),
|
||||
z.null(),
|
||||
]).optional(),
|
||||
description: z.string().optional(),
|
||||
copyright: z.string().optional(),
|
||||
privacy_policy: z.string().optional(),
|
||||
custom_disclaimer: z.string().optional(),
|
||||
default_language: z.string().optional(),
|
||||
show_workflow_steps: z.boolean().optional(),
|
||||
use_icon_as_answer_icon: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export type WebAppSettingsResponseZodType = z.infer<typeof zWebAppSettingsResponse>
|
||||
@ -24,6 +24,22 @@ function getApiSegment(path: readonly (string | number)[] | undefined): string |
|
||||
return apiPath.split('/').filter(Boolean)[0]
|
||||
}
|
||||
|
||||
// Extract schema name prefix from path array
|
||||
// e.g., ["components", "schemas", "ChatRequest"] → "chat"
|
||||
// e.g., ["components", "schemas", "StreamEventBase"] → "stream"
|
||||
// e.g., ["components", "schemas", "ErrorResponse"] → "error"
|
||||
function getSchemaPrefix(path: readonly (string | number)[] | undefined): string | undefined {
|
||||
if (!path || path[0] !== 'components' || path[1] !== 'schemas')
|
||||
return undefined
|
||||
const schemaName = path[2]
|
||||
if (typeof schemaName !== 'string')
|
||||
return undefined
|
||||
// Split PascalCase into words and take the first word
|
||||
// e.g., "ChatRequest" → ["Chat", "Request"] → "chat"
|
||||
const match = schemaName.match(/^[A-Z][a-z]*/)
|
||||
return match?.[0]?.toLowerCase()
|
||||
}
|
||||
|
||||
// Get file path based on symbol metadata (mixed strategy)
|
||||
function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined {
|
||||
const meta = symbol.meta
|
||||
@ -33,7 +49,8 @@ function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined {
|
||||
// Handle typescript plugin symbols
|
||||
if (meta.tool === 'typescript') {
|
||||
if (meta.resource === 'definition') {
|
||||
return 'types/models'
|
||||
const prefix = getSchemaPrefix(meta.path)
|
||||
return `types/models/${prefix ?? 'common'}`
|
||||
}
|
||||
if (meta.resource === 'operation') {
|
||||
const segment = getApiSegment(meta.path)
|
||||
@ -45,7 +62,8 @@ function getFilePath(symbol: { meta?: SymbolMeta }): string | undefined {
|
||||
// Handle zod plugin symbols
|
||||
if (meta.tool === 'zod') {
|
||||
if (meta.resource === 'definition') {
|
||||
return 'zod/models'
|
||||
const prefix = getSchemaPrefix(meta.path)
|
||||
return `zod/models/${prefix ?? 'common'}`
|
||||
}
|
||||
if (meta.resource === 'operation') {
|
||||
const segment = getApiSegment(meta.path)
|
||||
|
||||
Reference in New Issue
Block a user