librechat-data-provider 0.7.83 → 0.7.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/package.json +3 -1
- package/specs/bedrock.spec.ts +114 -0
- package/specs/web.spec.ts +903 -0
- package/src/api-endpoints.ts +2 -0
- package/src/bedrock.ts +4 -1
- package/src/config.ts +87 -14
- package/src/data-service.ts +8 -0
- package/src/file-config.ts +6 -0
- package/src/generate.ts +3 -3
- package/src/index.ts +4 -0
- package/src/keys.ts +1 -0
- package/src/mcp.ts +13 -6
- package/src/parameterSettings.ts +726 -0
- package/src/permissions.ts +10 -0
- package/src/roles.ts +8 -0
- package/src/schemas.ts +11 -2
- package/src/types/assistants.ts +2 -0
- package/src/types/files.ts +1 -0
- package/src/types/mutations.ts +21 -1
- package/src/types/queries.ts +5 -1
- package/src/types/web.ts +593 -0
- package/src/types.ts +8 -2
- package/src/utils.ts +10 -0
- package/src/web.ts +271 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../src/types/assistants.ts","../../src/schemas.ts","../../src/models.ts","../../src/file-config.ts","../../src/types/files.ts","../../src/utils.ts","../../src/mcp.ts","../../src/config.ts","../../src/api-endpoints.ts","../../src/request.ts","../../src/headers-helpers.ts","../../src/data-service.ts","../../src/keys.ts","../../src/react-query/react-query-service.ts"],"sourcesContent":["import type { OpenAPIV3 } from 'openapi-types';\nimport type { AssistantsEndpoint, AgentProvider } from 'src/schemas';\nimport type { ContentTypes } from './runs';\nimport type { Agents } from './agents';\nimport type { TFile } from './files';\nimport { ArtifactModes } from 'src/artifacts';\n\nexport type Schema = OpenAPIV3.SchemaObject & { description?: string };\nexport type Reference = OpenAPIV3.ReferenceObject & { description?: string };\n\nexport type Metadata = {\n avatar?: string;\n author?: string;\n} & {\n [key: string]: unknown;\n};\n\nexport enum Tools {\n execute_code = 'execute_code',\n code_interpreter = 'code_interpreter',\n file_search = 'file_search',\n retrieval = 'retrieval',\n function = 'function',\n}\n\nexport enum EToolResources {\n code_interpreter = 'code_interpreter',\n execute_code = 'execute_code',\n file_search = 'file_search',\n image_edit = 'image_edit',\n ocr = 'ocr',\n}\n\nexport type Tool = {\n [type: string]: Tools;\n};\n\nexport type FunctionTool = {\n type: Tools;\n function?: {\n description: string;\n name: string;\n parameters: Record<string, unknown>;\n strict?: boolean;\n additionalProperties?: boolean; // must be false if strict is true https://platform.openai.com/docs/guides/structured-outputs/some-type-specific-keywords-are-not-yet-supported\n };\n};\n\n/**\n * A set of resources that are used by the assistant's tools. The resources are\n * specific to the type of tool. For example, the `code_interpreter` tool requires\n * a list of file IDs, while the `file_search` tool requires a list of vector store\n * IDs.\n */\nexport interface ToolResources {\n code_interpreter?: CodeInterpreterResource;\n file_search?: FileSearchResource;\n}\nexport interface CodeInterpreterResource {\n /**\n * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made\n * available to the `code_interpreter`` tool. There can be a maximum of 20 files\n * associated with the tool.\n */\n file_ids?: Array<string>;\n}\n\nexport interface FileSearchResource {\n /**\n * The ID of the\n * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)\n * attached to this assistant. There can be a maximum of 1 vector store attached to\n * the assistant.\n */\n vector_store_ids?: Array<string>;\n}\n\n/* Assistant types */\n\nexport type Assistant = {\n id: string;\n created_at: number;\n description: string | null;\n file_ids?: string[];\n instructions: string | null;\n conversation_starters?: string[];\n metadata: Metadata | null;\n model: string;\n name: string | null;\n object: string;\n tools?: FunctionTool[];\n tool_resources?: ToolResources;\n};\n\nexport type TAssistantsMap = Record<AssistantsEndpoint, Record<string, Assistant>>;\n\nexport type AssistantCreateParams = {\n model: string;\n description?: string | null;\n file_ids?: string[];\n instructions?: string | null;\n conversation_starters?: string[];\n metadata?: Metadata | null;\n name?: string | null;\n tools?: Array<FunctionTool | string>;\n endpoint: AssistantsEndpoint;\n version: number | string;\n append_current_datetime?: boolean;\n};\n\nexport type AssistantUpdateParams = {\n model?: string;\n description?: string | null;\n file_ids?: string[];\n instructions?: string | null;\n conversation_starters?: string[] | null;\n metadata?: Metadata | null;\n name?: string | null;\n tools?: Array<FunctionTool | string>;\n tool_resources?: ToolResources;\n endpoint: AssistantsEndpoint;\n append_current_datetime?: boolean;\n};\n\nexport type AssistantListParams = {\n limit?: number;\n before?: string | null;\n after?: string | null;\n order?: 'asc' | 'desc';\n endpoint: AssistantsEndpoint;\n};\n\nexport type AssistantListResponse = {\n object: string;\n data: Assistant[];\n first_id: string;\n last_id: string;\n has_more: boolean;\n};\n\nexport type File = {\n file_id: string;\n id?: string;\n temp_file_id?: string;\n bytes: number;\n created_at: number;\n filename: string;\n object: string;\n purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';\n};\n\n/* Agent types */\n\nexport type AgentParameterValue = number | string | null;\n\nexport type AgentModelParameters = {\n model?: string;\n temperature: AgentParameterValue;\n maxContextTokens: AgentParameterValue;\n max_context_tokens: AgentParameterValue;\n max_output_tokens: AgentParameterValue;\n top_p: AgentParameterValue;\n frequency_penalty: AgentParameterValue;\n presence_penalty: AgentParameterValue;\n};\n\nexport interface AgentBaseResource {\n /**\n * A list of file IDs made available to the tool.\n */\n file_ids?: Array<string>;\n /**\n * A list of files already fetched.\n */\n files?: Array<TFile>;\n}\n\nexport interface AgentToolResources {\n [EToolResources.image_edit]?: AgentBaseResource;\n [EToolResources.execute_code]?: ExecuteCodeResource;\n [EToolResources.file_search]?: AgentFileResource;\n [EToolResources.ocr]?: AgentBaseResource;\n}\n/**\n * A resource for the execute_code tool.\n * Contains file IDs made available to the tool (max 20 files) and already fetched files.\n */\nexport type ExecuteCodeResource = AgentBaseResource;\n\nexport interface AgentFileResource extends AgentBaseResource {\n /**\n * The ID of the vector store attached to this agent. There\n * can be a maximum of 1 vector store attached to the agent.\n */\n vector_store_ids?: Array<string>;\n}\n\nexport type Agent = {\n id: string;\n name: string | null;\n author?: string | null;\n /** The original custom endpoint name, lowercased */\n endpoint?: string | null;\n authorName?: string | null;\n description: string | null;\n created_at: number;\n avatar: AgentAvatar | null;\n instructions: string | null;\n additional_instructions?: string | null;\n tools?: string[];\n projectIds?: string[];\n tool_kwargs?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n provider: AgentProvider;\n model: string | null;\n model_parameters: AgentModelParameters;\n conversation_starters?: string[];\n isCollaborative?: boolean;\n tool_resources?: AgentToolResources;\n agent_ids?: string[];\n end_after_tools?: boolean;\n hide_sequential_outputs?: boolean;\n artifacts?: ArtifactModes;\n recursion_limit?: number;\n};\n\nexport type TAgentsMap = Record<string, Agent | undefined>;\n\nexport type AgentCreateParams = {\n name?: string | null;\n description?: string | null;\n avatar?: AgentAvatar | null;\n file_ids?: string[];\n instructions?: string | null;\n tools?: Array<FunctionTool | string>;\n provider: AgentProvider;\n model: string | null;\n model_parameters: AgentModelParameters;\n} & Pick<\n Agent,\n 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit'\n>;\n\nexport type AgentUpdateParams = {\n name?: string | null;\n description?: string | null;\n avatar?: AgentAvatar | null;\n file_ids?: string[];\n instructions?: string | null;\n tools?: Array<FunctionTool | string>;\n tool_resources?: ToolResources;\n provider?: AgentProvider;\n model?: string | null;\n model_parameters?: AgentModelParameters;\n projectIds?: string[];\n removeProjectIds?: string[];\n isCollaborative?: boolean;\n} & Pick<\n Agent,\n 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit'\n>;\n\nexport type AgentListParams = {\n limit?: number;\n before?: string | null;\n after?: string | null;\n order?: 'asc' | 'desc';\n provider?: AgentProvider;\n};\n\nexport type AgentListResponse = {\n object: string;\n data: Agent[];\n first_id: string;\n last_id: string;\n has_more: boolean;\n};\n\nexport type AgentFile = {\n file_id: string;\n id?: string;\n temp_file_id?: string;\n bytes: number;\n created_at: number;\n filename: string;\n object: string;\n purpose: 'fine-tune' | 'fine-tune-results' | 'agents' | 'agents_output';\n};\n\n/**\n * Details of the Code Interpreter tool call the run step was involved in.\n * Includes the tool call ID, the code interpreter definition, and the type of tool call.\n */\nexport type CodeToolCall = {\n id: string; // The ID of the tool call.\n code_interpreter: {\n input: string; // The input to the Code Interpreter tool call.\n outputs: Array<Record<string, unknown>>; // The outputs from the Code Interpreter tool call.\n };\n type: 'code_interpreter'; // The type of tool call, always 'code_interpreter'.\n};\n\n/**\n * Details of a Function tool call the run step was involved in.\n * Includes the tool call ID, the function definition, and the type of tool call.\n */\nexport type FunctionToolCall = {\n id: string; // The ID of the tool call object.\n function: {\n arguments: string; // The arguments passed to the function.\n name: string; // The name of the function.\n output: string | null; // The output of the function, null if not submitted.\n };\n type: 'function'; // The type of tool call, always 'function'.\n};\n\n/**\n * Details of a Retrieval tool call the run step was involved in.\n * Includes the tool call ID and the type of tool call.\n */\nexport type RetrievalToolCall = {\n id: string; // The ID of the tool call object.\n retrieval: unknown; // An empty object for now.\n type: 'retrieval'; // The type of tool call, always 'retrieval'.\n};\n\n/**\n * Details of a Retrieval tool call the run step was involved in.\n * Includes the tool call ID and the type of tool call.\n */\nexport type FileSearchToolCall = {\n id: string; // The ID of the tool call object.\n file_search: unknown; // An empty object for now.\n type: 'file_search'; // The type of tool call, always 'retrieval'.\n};\n\n/**\n * Details of the tool calls involved in a run step.\n * Can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`.\n */\nexport type ToolCallsStepDetails = {\n tool_calls: Array<CodeToolCall | RetrievalToolCall | FileSearchToolCall | FunctionToolCall>; // An array of tool calls the run step was involved in.\n type: 'tool_calls'; // Always 'tool_calls'.\n};\n\nexport type ImageFile = TFile & {\n /**\n * The [File](https://platform.openai.com/docs/api-reference/files) ID of the image\n * in the message content.\n */\n file_id: string;\n filename: string;\n filepath: string;\n height: number;\n width: number;\n /**\n * Prompt used to generate the image if applicable.\n */\n prompt?: string;\n /**\n * Additional metadata used to generate or about the image/tool_call.\n */\n metadata?: Record<string, unknown>;\n};\n\n// FileCitation.ts\nexport type FileCitation = {\n end_index: number;\n file_citation: FileCitationDetails;\n start_index: number;\n text: string;\n type: 'file_citation';\n};\n\nexport type FileCitationDetails = {\n file_id: string;\n quote: string;\n};\n\nexport type FilePath = {\n end_index: number;\n file_path: FilePathDetails;\n start_index: number;\n text: string;\n type: 'file_path';\n};\n\nexport type FilePathDetails = {\n file_id: string;\n};\n\nexport type Text = {\n annotations?: Array<FileCitation | FilePath>;\n value: string;\n};\n\nexport enum AnnotationTypes {\n FILE_CITATION = 'file_citation',\n FILE_PATH = 'file_path',\n}\n\nexport enum StepStatus {\n IN_PROGRESS = 'in_progress',\n CANCELLED = 'cancelled',\n FAILED = 'failed',\n COMPLETED = 'completed',\n EXPIRED = 'expired',\n}\n\nexport enum MessageContentTypes {\n TEXT = 'text',\n IMAGE_FILE = 'image_file',\n}\n\n//enum for RunStatus\n// The status of the run: queued, in_progress, requires_action, cancelling, cancelled, failed, completed, or expired.\nexport enum RunStatus {\n QUEUED = 'queued',\n IN_PROGRESS = 'in_progress',\n REQUIRES_ACTION = 'requires_action',\n CANCELLING = 'cancelling',\n CANCELLED = 'cancelled',\n FAILED = 'failed',\n COMPLETED = 'completed',\n EXPIRED = 'expired',\n}\n\nexport type PartMetadata = {\n progress?: number;\n asset_pointer?: string;\n status?: string;\n action?: boolean;\n auth?: string;\n expires_at?: number;\n};\n\nexport type ContentPart = (\n | CodeToolCall\n | RetrievalToolCall\n | FileSearchToolCall\n | FunctionToolCall\n | Agents.AgentToolCall\n | ImageFile\n | Text\n) &\n PartMetadata;\n\nexport type TMessageContentParts =\n | { type: ContentTypes.ERROR; text?: string | (Text & PartMetadata); error?: string }\n | { type: ContentTypes.THINK; think: string | (Text & PartMetadata) }\n | { type: ContentTypes.TEXT; text: string | (Text & PartMetadata); tool_call_ids?: string[] }\n | {\n type: ContentTypes.TOOL_CALL;\n tool_call: (\n | CodeToolCall\n | RetrievalToolCall\n | FileSearchToolCall\n | FunctionToolCall\n | Agents.AgentToolCall\n ) &\n PartMetadata;\n }\n | { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }\n | Agents.AgentUpdate\n | Agents.MessageContentImageUrl;\n\nexport type StreamContentData = TMessageContentParts & {\n /** The index of the current content part */\n index: number;\n /** The current text content was already served but edited to replace elements therein */\n edited?: boolean;\n};\n\nexport type TContentData = StreamContentData & {\n messageId: string;\n conversationId: string;\n userMessageId: string;\n thread_id: string;\n stream?: boolean;\n};\n\nexport const actionDelimiter = '_action_';\nexport const actionDomainSeparator = '---';\nexport const hostImageIdSuffix = '_host_copy';\nexport const hostImageNamePrefix = 'host_copy_';\n\nexport enum AuthTypeEnum {\n ServiceHttp = 'service_http',\n OAuth = 'oauth',\n None = 'none',\n}\n\nexport enum AuthorizationTypeEnum {\n Bearer = 'bearer',\n Basic = 'basic',\n Custom = 'custom',\n}\n\nexport enum TokenExchangeMethodEnum {\n DefaultPost = 'default_post',\n BasicAuthHeader = 'basic_auth_header',\n}\n\nexport type ActionAuth = {\n authorization_type?: AuthorizationTypeEnum;\n custom_auth_header?: string;\n type?: AuthTypeEnum;\n authorization_content_type?: string;\n authorization_url?: string;\n client_url?: string;\n scope?: string;\n token_exchange_method?: TokenExchangeMethodEnum;\n};\n\nexport type ActionMetadata = {\n api_key?: string;\n auth?: ActionAuth;\n domain?: string;\n privacy_policy_url?: string;\n raw_spec?: string;\n oauth_client_id?: string;\n oauth_client_secret?: string;\n};\n\nexport type ActionMetadataRuntime = ActionMetadata & {\n oauth_access_token?: string;\n oauth_refresh_token?: string;\n oauth_token_expires_at?: Date;\n};\n\n/* Assistant types */\n\nexport type Action = {\n action_id: string;\n type?: string;\n settings?: Record<string, unknown>;\n metadata: ActionMetadata;\n version: number | string;\n} & ({ assistant_id: string; agent_id?: never } | { assistant_id?: never; agent_id: string });\n\nexport type AssistantAvatar = {\n filepath: string;\n source: string;\n};\n\nexport type AssistantDocument = {\n user: string;\n assistant_id: string;\n conversation_starters?: string[];\n avatar?: AssistantAvatar;\n access_level?: number;\n file_ids?: string[];\n actions?: string[];\n createdAt?: Date;\n updatedAt?: Date;\n append_current_datetime?: boolean;\n};\n\n/* Agent types */\n\nexport type AgentAvatar = {\n filepath: string;\n source: string;\n};\n\nexport enum FilePurpose {\n Vision = 'vision',\n FineTune = 'fine-tune',\n FineTuneResults = 'fine-tune-results',\n Assistants = 'assistants',\n AssistantsOutput = 'assistants_output',\n}\n\nexport const defaultOrderQuery: {\n order: 'desc';\n limit: 100;\n} = {\n order: 'desc',\n limit: 100,\n};\n\nexport enum AssistantStreamEvents {\n ThreadCreated = 'thread.created',\n ThreadRunCreated = 'thread.run.created',\n ThreadRunQueued = 'thread.run.queued',\n ThreadRunInProgress = 'thread.run.in_progress',\n ThreadRunRequiresAction = 'thread.run.requires_action',\n ThreadRunCompleted = 'thread.run.completed',\n ThreadRunFailed = 'thread.run.failed',\n ThreadRunCancelling = 'thread.run.cancelling',\n ThreadRunCancelled = 'thread.run.cancelled',\n ThreadRunExpired = 'thread.run.expired',\n ThreadRunStepCreated = 'thread.run.step.created',\n ThreadRunStepInProgress = 'thread.run.step.in_progress',\n ThreadRunStepCompleted = 'thread.run.step.completed',\n ThreadRunStepFailed = 'thread.run.step.failed',\n ThreadRunStepCancelled = 'thread.run.step.cancelled',\n ThreadRunStepExpired = 'thread.run.step.expired',\n ThreadRunStepDelta = 'thread.run.step.delta',\n ThreadMessageCreated = 'thread.message.created',\n ThreadMessageInProgress = 'thread.message.in_progress',\n ThreadMessageCompleted = 'thread.message.completed',\n ThreadMessageIncomplete = 'thread.message.incomplete',\n ThreadMessageDelta = 'thread.message.delta',\n ErrorEvent = 'error',\n}\n","import { z } from 'zod';\nimport { Tools } from './types/assistants';\nimport type { TMessageContentParts, FunctionTool, FunctionToolCall } from './types/assistants';\nimport type { TEphemeralAgent } from './types';\nimport type { TFile } from './types/files';\n\nexport const isUUID = z.string().uuid();\n\nexport enum AuthType {\n OVERRIDE_AUTH = 'override_auth',\n USER_PROVIDED = 'user_provided',\n SYSTEM_DEFINED = 'system_defined',\n}\n\nexport const authTypeSchema = z.nativeEnum(AuthType);\n\nexport enum EModelEndpoint {\n azureOpenAI = 'azureOpenAI',\n openAI = 'openAI',\n google = 'google',\n anthropic = 'anthropic',\n assistants = 'assistants',\n azureAssistants = 'azureAssistants',\n agents = 'agents',\n custom = 'custom',\n bedrock = 'bedrock',\n /** @deprecated */\n chatGPTBrowser = 'chatGPTBrowser',\n /** @deprecated */\n gptPlugins = 'gptPlugins',\n}\n\nexport const paramEndpoints = new Set<EModelEndpoint | string>([\n EModelEndpoint.agents,\n EModelEndpoint.openAI,\n EModelEndpoint.bedrock,\n EModelEndpoint.azureOpenAI,\n EModelEndpoint.anthropic,\n EModelEndpoint.custom,\n EModelEndpoint.google,\n]);\n\nexport enum BedrockProviders {\n AI21 = 'ai21',\n Amazon = 'amazon',\n Anthropic = 'anthropic',\n Cohere = 'cohere',\n Meta = 'meta',\n MistralAI = 'mistral',\n StabilityAI = 'stability',\n DeepSeek = 'deepseek',\n}\n\nexport const getModelKey = (endpoint: EModelEndpoint | string, model: string) => {\n if (endpoint === EModelEndpoint.bedrock) {\n const parts = model.split('.');\n const provider = [parts[0], parts[1]].find((part) =>\n Object.values(BedrockProviders).includes(part as BedrockProviders),\n );\n return (provider ?? parts[0]) as BedrockProviders;\n }\n return model;\n};\n\nexport const getSettingsKeys = (endpoint: EModelEndpoint | string, model: string) => {\n const endpointKey = endpoint;\n const modelKey = getModelKey(endpointKey, model);\n const combinedKey = `${endpointKey}-${modelKey}`;\n return [combinedKey, endpointKey];\n};\n\nexport type AssistantsEndpoint = EModelEndpoint.assistants | EModelEndpoint.azureAssistants;\n\nexport const isAssistantsEndpoint = (_endpoint?: AssistantsEndpoint | null | string): boolean => {\n const endpoint = _endpoint ?? '';\n if (!endpoint) {\n return false;\n }\n return endpoint.toLowerCase().endsWith(EModelEndpoint.assistants);\n};\n\nexport type AgentProvider = Exclude<keyof typeof EModelEndpoint, EModelEndpoint.agents> | string;\n\nexport const isAgentsEndpoint = (_endpoint?: EModelEndpoint.agents | null | string): boolean => {\n const endpoint = _endpoint ?? '';\n if (!endpoint) {\n return false;\n }\n return endpoint === EModelEndpoint.agents;\n};\n\nexport const isEphemeralAgent = (\n endpoint?: EModelEndpoint.agents | null | string,\n ephemeralAgent?: TEphemeralAgent | null,\n) => {\n if (!ephemeralAgent) {\n return false;\n }\n if (isAgentsEndpoint(endpoint)) {\n return false;\n }\n const hasMCPSelected = (ephemeralAgent?.mcp?.length ?? 0) > 0;\n const hasCodeSelected = (ephemeralAgent?.execute_code ?? false) === true;\n return hasMCPSelected || hasCodeSelected;\n};\n\nexport const isParamEndpoint = (\n endpoint: EModelEndpoint | string,\n endpointType?: EModelEndpoint | string,\n): boolean => {\n if (paramEndpoints.has(endpoint)) {\n return true;\n }\n\n if (endpointType != null) {\n return paramEndpoints.has(endpointType);\n }\n\n return false;\n};\n\nexport enum ImageDetail {\n low = 'low',\n auto = 'auto',\n high = 'high',\n}\n\nexport enum ReasoningEffort {\n low = 'low',\n medium = 'medium',\n high = 'high',\n}\n\nexport const imageDetailNumeric = {\n [ImageDetail.low]: 0,\n [ImageDetail.auto]: 1,\n [ImageDetail.high]: 2,\n};\n\nexport const imageDetailValue = {\n 0: ImageDetail.low,\n 1: ImageDetail.auto,\n 2: ImageDetail.high,\n};\n\nexport const eImageDetailSchema = z.nativeEnum(ImageDetail);\nexport const eReasoningEffortSchema = z.nativeEnum(ReasoningEffort);\n\nexport const defaultAssistantFormValues = {\n assistant: '',\n id: '',\n name: '',\n description: '',\n instructions: '',\n conversation_starters: [],\n model: '',\n functions: [],\n code_interpreter: false,\n image_vision: false,\n retrieval: false,\n append_current_datetime: false,\n};\n\nexport const defaultAgentFormValues = {\n agent: {},\n id: '',\n name: '',\n description: '',\n instructions: '',\n model: '',\n model_parameters: {},\n tools: [],\n provider: {},\n projectIds: [],\n artifacts: '',\n isCollaborative: false,\n recursion_limit: undefined,\n [Tools.execute_code]: false,\n [Tools.file_search]: false,\n};\n\nexport const ImageVisionTool: FunctionTool = {\n type: Tools.function,\n [Tools.function]: {\n name: 'image_vision',\n description: 'Get detailed text descriptions for all current image attachments.',\n parameters: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n};\n\nexport const isImageVisionTool = (tool: FunctionTool | FunctionToolCall) =>\n tool.type === 'function' && tool.function?.name === ImageVisionTool.function?.name;\n\nexport const openAISettings = {\n model: {\n default: 'gpt-4o-mini' as const,\n },\n temperature: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n top_p: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n presence_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n frequency_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n resendFiles: {\n default: true as const,\n },\n maxContextTokens: {\n default: undefined,\n },\n max_tokens: {\n default: undefined,\n },\n imageDetail: {\n default: ImageDetail.auto as const,\n min: 0 as const,\n max: 2 as const,\n step: 1 as const,\n },\n};\n\nexport const googleSettings = {\n model: {\n default: 'gemini-1.5-flash-latest' as const,\n },\n maxOutputTokens: {\n min: 1 as const,\n max: 64000 as const,\n step: 1 as const,\n default: 8192 as const,\n },\n temperature: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n topP: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 0.95 as const,\n },\n topK: {\n min: 1 as const,\n max: 40 as const,\n step: 1 as const,\n default: 40 as const,\n },\n};\n\nconst ANTHROPIC_MAX_OUTPUT = 128000 as const;\nconst DEFAULT_MAX_OUTPUT = 8192 as const;\nconst LEGACY_ANTHROPIC_MAX_OUTPUT = 4096 as const;\nexport const anthropicSettings = {\n model: {\n default: 'claude-3-5-sonnet-latest' as const,\n },\n temperature: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n promptCache: {\n default: true as const,\n },\n thinking: {\n default: true as const,\n },\n thinkingBudget: {\n min: 1024 as const,\n step: 100 as const,\n max: 200000 as const,\n default: 2000 as const,\n },\n maxOutputTokens: {\n min: 1 as const,\n max: ANTHROPIC_MAX_OUTPUT,\n step: 1 as const,\n default: DEFAULT_MAX_OUTPUT,\n reset: (modelName: string) => {\n if (/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) {\n return DEFAULT_MAX_OUTPUT;\n }\n\n return 4096;\n },\n set: (value: number, modelName: string) => {\n if (\n !(/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) &&\n value > LEGACY_ANTHROPIC_MAX_OUTPUT\n ) {\n return LEGACY_ANTHROPIC_MAX_OUTPUT;\n }\n\n return value;\n },\n },\n topP: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 0.7 as const,\n },\n topK: {\n min: 1 as const,\n max: 40 as const,\n step: 1 as const,\n default: 5 as const,\n },\n resendFiles: {\n default: true as const,\n },\n maxContextTokens: {\n default: undefined,\n },\n legacy: {\n maxOutputTokens: {\n min: 1 as const,\n max: LEGACY_ANTHROPIC_MAX_OUTPUT,\n step: 1 as const,\n default: LEGACY_ANTHROPIC_MAX_OUTPUT,\n },\n },\n};\n\nexport const agentsSettings = {\n model: {\n default: 'gpt-3.5-turbo-test' as const,\n },\n temperature: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n top_p: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n presence_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n frequency_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n resendFiles: {\n default: true as const,\n },\n maxContextTokens: {\n default: undefined,\n },\n max_tokens: {\n default: undefined,\n },\n imageDetail: {\n default: ImageDetail.auto as const,\n },\n};\n\nexport const endpointSettings = {\n [EModelEndpoint.openAI]: openAISettings,\n [EModelEndpoint.google]: googleSettings,\n [EModelEndpoint.anthropic]: anthropicSettings,\n [EModelEndpoint.agents]: agentsSettings,\n [EModelEndpoint.bedrock]: agentsSettings,\n};\n\nconst google = endpointSettings[EModelEndpoint.google];\n\nexport const eModelEndpointSchema = z.nativeEnum(EModelEndpoint);\n\nexport const extendedModelEndpointSchema = z.union([eModelEndpointSchema, z.string()]);\n\nexport const tPluginAuthConfigSchema = z.object({\n authField: z.string(),\n label: z.string(),\n description: z.string(),\n});\n\nexport type TPluginAuthConfig = z.infer<typeof tPluginAuthConfigSchema>;\n\nexport const tPluginSchema = z.object({\n name: z.string(),\n pluginKey: z.string(),\n description: z.string(),\n icon: z.string().optional(),\n authConfig: z.array(tPluginAuthConfigSchema).optional(),\n authenticated: z.boolean().optional(),\n chatMenu: z.boolean().optional(),\n isButton: z.boolean().optional(),\n toolkit: z.boolean().optional(),\n});\n\nexport type TPlugin = z.infer<typeof tPluginSchema>;\n\nexport type TInput = {\n inputStr: string;\n};\n\nexport type TResPlugin = {\n plugin: string;\n input: string;\n thought: string;\n loading?: boolean;\n outputs?: string;\n latest?: string;\n inputs?: TInput[];\n};\n\nexport const tExampleSchema = z.object({\n input: z.object({\n content: z.string(),\n }),\n output: z.object({\n content: z.string(),\n }),\n});\n\nexport type TExample = z.infer<typeof tExampleSchema>;\n\nexport enum EAgent {\n functions = 'functions',\n classic = 'classic',\n}\n\nexport const agentOptionSettings = {\n model: {\n default: 'gpt-4o-mini',\n },\n temperature: {\n min: 0,\n max: 1,\n step: 0.01,\n default: 0,\n },\n agent: {\n default: EAgent.functions,\n options: [EAgent.functions, EAgent.classic],\n },\n skipCompletion: {\n default: true,\n },\n};\n\nexport const eAgentOptionsSchema = z.nativeEnum(EAgent);\n\nexport const tAgentOptionsSchema = z.object({\n agent: z.string().default(EAgent.functions),\n skipCompletion: z.boolean().default(agentOptionSettings.skipCompletion.default),\n model: z.string(),\n temperature: z.number().default(agentOptionSettings.temperature.default),\n});\n\nexport const tMessageSchema = z.object({\n messageId: z.string(),\n endpoint: z.string().optional(),\n clientId: z.string().nullable().optional(),\n conversationId: z.string().nullable(),\n parentMessageId: z.string().nullable(),\n responseMessageId: z.string().nullable().optional(),\n overrideParentMessageId: z.string().nullable().optional(),\n bg: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),\n sender: z.string().optional(),\n text: z.string(),\n generation: z.string().nullable().optional(),\n isCreatedByUser: z.boolean(),\n error: z.boolean().optional(),\n clientTimestamp: z.string().optional(),\n createdAt: z\n .string()\n .optional()\n .default(() => new Date().toISOString()),\n updatedAt: z\n .string()\n .optional()\n .default(() => new Date().toISOString()),\n current: z.boolean().optional(),\n unfinished: z.boolean().optional(),\n searchResult: z.boolean().optional(),\n finish_reason: z.string().optional(),\n /* assistant */\n thread_id: z.string().optional(),\n /* frontend components */\n iconURL: z.string().nullable().optional(),\n});\n\nexport type TAttachmentMetadata = { messageId: string; toolCallId: string };\nexport type TAttachment =\n | (TFile & TAttachmentMetadata)\n | (Pick<TFile, 'filename' | 'filepath' | 'conversationId'> & {\n expiresAt: number;\n } & TAttachmentMetadata);\n\nexport type TMessage = z.input<typeof tMessageSchema> & {\n children?: TMessage[];\n plugin?: TResPlugin | null;\n plugins?: TResPlugin[];\n content?: TMessageContentParts[];\n files?: Partial<TFile>[];\n depth?: number;\n siblingIndex?: number;\n attachments?: TAttachment[];\n clientTimestamp?: string;\n};\n\nexport const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {\n if (typeof val === 'string') {\n return val.trim() === '' ? undefined : parseFloat(val);\n }\n return val;\n});\n\ntype DocumentTypeValue =\n | null\n | boolean\n | number\n | string\n | DocumentTypeValue[]\n | { [key: string]: DocumentTypeValue };\n\nconst DocumentType: z.ZodType<DocumentTypeValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.boolean(),\n z.number(),\n z.string(),\n z.array(z.lazy(() => DocumentType)),\n z.record(z.lazy(() => DocumentType)),\n ]),\n);\n\nexport const tConversationSchema = z.object({\n conversationId: z.string().nullable(),\n endpoint: eModelEndpointSchema.nullable(),\n endpointType: eModelEndpointSchema.nullable().optional(),\n isArchived: z.boolean().optional(),\n title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),\n user: z.string().optional(),\n messages: z.array(z.string()).optional(),\n tools: z.union([z.array(tPluginSchema), z.array(z.string())]).optional(),\n modelLabel: z.string().nullable().optional(),\n userLabel: z.string().optional(),\n model: z.string().nullable().optional(),\n promptPrefix: z.string().nullable().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n topK: z.number().optional(),\n top_p: z.number().optional(),\n frequency_penalty: z.number().optional(),\n presence_penalty: z.number().optional(),\n parentMessageId: z.string().optional(),\n maxOutputTokens: coerceNumber.optional(),\n maxContextTokens: coerceNumber.optional(),\n max_tokens: coerceNumber.optional(),\n /* Anthropic */\n promptCache: z.boolean().optional(),\n system: z.string().optional(),\n thinking: z.boolean().optional(),\n thinkingBudget: coerceNumber.optional(),\n /* artifacts */\n artifacts: z.string().optional(),\n /* google */\n context: z.string().nullable().optional(),\n examples: z.array(tExampleSchema).optional(),\n /* DB */\n tags: z.array(z.string()).optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n /* Files */\n resendFiles: z.boolean().optional(),\n file_ids: z.array(z.string()).optional(),\n /* vision */\n imageDetail: eImageDetailSchema.optional(),\n /* OpenAI: o1 only */\n reasoning_effort: eReasoningEffortSchema.optional(),\n /* assistant */\n assistant_id: z.string().optional(),\n /* agents */\n agent_id: z.string().optional(),\n /* AWS Bedrock */\n region: z.string().optional(),\n maxTokens: coerceNumber.optional(),\n additionalModelRequestFields: DocumentType.optional(),\n /* assistants */\n instructions: z.string().optional(),\n additional_instructions: z.string().optional(),\n append_current_datetime: z.boolean().optional(),\n /** Used to overwrite active conversation settings when saving a Preset */\n presetOverride: z.record(z.unknown()).optional(),\n stop: z.array(z.string()).optional(),\n /* frontend components */\n greeting: z.string().optional(),\n spec: z.string().nullable().optional(),\n iconURL: z.string().nullable().optional(),\n /* temporary chat */\n expiredAt: z.string().nullable().optional(),\n /** @deprecated */\n resendImages: z.boolean().optional(),\n /** @deprecated */\n agentOptions: tAgentOptionsSchema.nullable().optional(),\n /** @deprecated Prefer `modelLabel` over `chatGptLabel` */\n chatGptLabel: z.string().nullable().optional(),\n});\n\nexport const tPresetSchema = tConversationSchema\n .omit({\n conversationId: true,\n createdAt: true,\n updatedAt: true,\n title: true,\n })\n .merge(\n z.object({\n conversationId: z.string().nullable().optional(),\n presetId: z.string().nullable().optional(),\n title: z.string().nullable().optional(),\n defaultPreset: z.boolean().optional(),\n order: z.number().optional(),\n endpoint: extendedModelEndpointSchema.nullable(),\n }),\n );\n\nexport const tConvoUpdateSchema = tConversationSchema.merge(\n z.object({\n endpoint: extendedModelEndpointSchema.nullable(),\n createdAt: z.string().optional(),\n updatedAt: z.string().optional(),\n }),\n);\n\nexport const tQueryParamsSchema = tConversationSchema\n .pick({\n // librechat settings\n /** The model spec to be used */\n spec: true,\n /** The AI context window, overrides the system-defined window as determined by `model` value */\n maxContextTokens: true,\n /**\n * Whether or not to re-submit files from previous messages on subsequent messages\n * */\n resendFiles: true,\n /**\n * @endpoints openAI, custom, azureOpenAI\n *\n * System parameter that only affects the above endpoints.\n * Image detail for re-sizing according to OpenAI spec, defaults to `auto`\n * */\n imageDetail: true,\n /**\n * AKA Custom Instructions, dynamically added to chat history as a system message;\n * for `bedrock` endpoint, this is used as the `system` model param if the provider uses it;\n * for `assistants` endpoint, this is used as the `additional_instructions` model param:\n * https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_instructions\n * ; otherwise, a message with `system` role is added to the chat history\n */\n promptPrefix: true,\n // Model parameters\n /** @endpoints openAI, custom, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock */\n model: true,\n /** @endpoints openAI, custom, azureOpenAI, google, anthropic, bedrock */\n temperature: true,\n /** @endpoints openAI, custom, azureOpenAI */\n presence_penalty: true,\n /** @endpoints openAI, custom, azureOpenAI */\n frequency_penalty: true,\n /** @endpoints openAI, custom, azureOpenAI */\n stop: true,\n /** @endpoints openAI, custom, azureOpenAI */\n top_p: true,\n /** @endpoints openAI, custom, azureOpenAI */\n max_tokens: true,\n /** @endpoints google, anthropic, bedrock */\n topP: true,\n /** @endpoints google, anthropic */\n topK: true,\n /** @endpoints google, anthropic */\n maxOutputTokens: true,\n /** @endpoints anthropic */\n promptCache: true,\n thinking: true,\n thinkingBudget: true,\n /** @endpoints bedrock */\n region: true,\n /** @endpoints bedrock */\n maxTokens: true,\n /** @endpoints agents */\n agent_id: true,\n /** @endpoints assistants, azureAssistants */\n assistant_id: true,\n /** @endpoints assistants, azureAssistants */\n append_current_datetime: true,\n /**\n * @endpoints assistants, azureAssistants\n *\n * Overrides existing assistant instructions, only used for the current run:\n * https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-instructions\n * */\n instructions: true,\n })\n .merge(\n z.object({\n /** @endpoints openAI, custom, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock, agents */\n endpoint: extendedModelEndpointSchema.nullable(),\n }),\n );\n\nexport type TPreset = z.infer<typeof tPresetSchema>;\n\nexport type TSetOption = (\n param: number | string,\n) => (newValue: number | string | boolean | string[] | Partial<TPreset>) => void;\n\nexport type TConversation = z.infer<typeof tConversationSchema> & {\n presetOverride?: Partial<TPreset>;\n disableParams?: boolean;\n};\n\nexport const tSharedLinkSchema = z.object({\n conversationId: z.string(),\n shareId: z.string(),\n messages: z.array(z.string()),\n isPublic: z.boolean(),\n title: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nexport type TSharedLink = z.infer<typeof tSharedLinkSchema>;\n\nexport const tConversationTagSchema = z.object({\n _id: z.string(),\n user: z.string(),\n tag: z.string(),\n description: z.string().optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n count: z.number(),\n position: z.number(),\n});\nexport type TConversationTag = z.infer<typeof tConversationTagSchema>;\n\nexport const googleBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n promptPrefix: true,\n examples: true,\n temperature: true,\n maxOutputTokens: true,\n artifacts: true,\n topP: true,\n topK: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n});\n\nexport const googleSchema = googleBaseSchema\n .transform((obj: Partial<TConversation>) => removeNullishValues(obj))\n .catch(() => ({}));\n\n/**\n * TODO: Map the following fields:\n - presence_penalty -> presencePenalty\n - frequency_penalty -> frequencyPenalty\n - stop -> stopSequences\n */\nexport const googleGenConfigSchema = z\n .object({\n maxOutputTokens: coerceNumber.optional(),\n temperature: coerceNumber.optional(),\n topP: coerceNumber.optional(),\n topK: coerceNumber.optional(),\n presencePenalty: coerceNumber.optional(),\n frequencyPenalty: coerceNumber.optional(),\n stopSequences: z.array(z.string()).optional(),\n })\n .strip()\n .optional();\n\nconst gptPluginsBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n chatGptLabel: true,\n promptPrefix: true,\n temperature: true,\n artifacts: true,\n top_p: true,\n presence_penalty: true,\n frequency_penalty: true,\n tools: true,\n agentOptions: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n});\n\nexport const gptPluginsSchema = gptPluginsBaseSchema\n .transform((obj) => {\n const result = {\n ...obj,\n model: obj.model ?? 'gpt-3.5-turbo',\n chatGptLabel: obj.chatGptLabel ?? obj.modelLabel ?? null,\n promptPrefix: obj.promptPrefix ?? null,\n temperature: obj.temperature ?? 0.8,\n top_p: obj.top_p ?? 1,\n presence_penalty: obj.presence_penalty ?? 0,\n frequency_penalty: obj.frequency_penalty ?? 0,\n tools: obj.tools ?? [],\n agentOptions: obj.agentOptions ?? {\n agent: EAgent.functions,\n skipCompletion: true,\n model: 'gpt-3.5-turbo',\n temperature: 0,\n },\n iconURL: obj.iconURL ?? undefined,\n greeting: obj.greeting ?? undefined,\n spec: obj.spec ?? undefined,\n maxContextTokens: obj.maxContextTokens ?? undefined,\n };\n\n if (obj.modelLabel != null && obj.modelLabel !== '') {\n result.modelLabel = null;\n }\n\n return result;\n })\n .catch(() => ({\n model: 'gpt-3.5-turbo',\n chatGptLabel: null,\n promptPrefix: null,\n temperature: 0.8,\n top_p: 1,\n presence_penalty: 0,\n frequency_penalty: 0,\n tools: [],\n agentOptions: {\n agent: EAgent.functions,\n skipCompletion: true,\n model: 'gpt-3.5-turbo',\n temperature: 0,\n },\n iconURL: undefined,\n greeting: undefined,\n spec: undefined,\n maxContextTokens: undefined,\n }));\n\nexport function removeNullishValues<T extends Record<string, unknown>>(\n obj: T,\n removeEmptyStrings?: boolean,\n): Partial<T> {\n const newObj: Partial<T> = { ...obj };\n\n (Object.keys(newObj) as Array<keyof T>).forEach((key) => {\n const value = newObj[key];\n if (value === undefined || value === null) {\n delete newObj[key];\n }\n if (removeEmptyStrings && typeof value === 'string' && value === '') {\n delete newObj[key];\n }\n });\n\n return newObj;\n}\n\nconst assistantBaseSchema = tConversationSchema.pick({\n model: true,\n assistant_id: true,\n instructions: true,\n artifacts: true,\n promptPrefix: true,\n iconURL: true,\n greeting: true,\n spec: true,\n append_current_datetime: true,\n});\n\nexport const assistantSchema = assistantBaseSchema\n .transform((obj) => ({\n ...obj,\n model: obj.model ?? openAISettings.model.default,\n assistant_id: obj.assistant_id ?? undefined,\n instructions: obj.instructions ?? undefined,\n promptPrefix: obj.promptPrefix ?? null,\n iconURL: obj.iconURL ?? undefined,\n greeting: obj.greeting ?? undefined,\n spec: obj.spec ?? undefined,\n append_current_datetime: obj.append_current_datetime ?? false,\n }))\n .catch(() => ({\n model: openAISettings.model.default,\n assistant_id: undefined,\n instructions: undefined,\n promptPrefix: null,\n iconURL: undefined,\n greeting: undefined,\n spec: undefined,\n append_current_datetime: false,\n }));\n\nconst compactAssistantBaseSchema = tConversationSchema.pick({\n model: true,\n assistant_id: true,\n instructions: true,\n promptPrefix: true,\n artifacts: true,\n iconURL: true,\n greeting: true,\n spec: true,\n});\n\nexport const compactAssistantSchema = compactAssistantBaseSchema\n .transform((obj) => removeNullishValues(obj))\n .catch(() => ({}));\n\nexport const agentsBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n temperature: true,\n top_p: true,\n presence_penalty: true,\n frequency_penalty: true,\n resendFiles: true,\n imageDetail: true,\n agent_id: true,\n instructions: true,\n promptPrefix: true,\n iconURL: true,\n greeting: true,\n maxContextTokens: true,\n});\n\nexport const agentsSchema = agentsBaseSchema\n .transform((obj) => ({\n ...obj,\n model: obj.model ?? agentsSettings.model.default,\n modelLabel: obj.modelLabel ?? null,\n temperature: obj.temperature ?? 1,\n top_p: obj.top_p ?? 1,\n presence_penalty: obj.presence_penalty ?? 0,\n frequency_penalty: obj.frequency_penalty ?? 0,\n resendFiles:\n typeof obj.resendFiles === 'boolean' ? obj.resendFiles : agentsSettings.resendFiles.default,\n imageDetail: obj.imageDetail ?? ImageDetail.auto,\n agent_id: obj.agent_id ?? undefined,\n instructions: obj.instructions ?? undefined,\n promptPrefix: obj.promptPrefix ?? null,\n iconURL: obj.iconURL ?? undefined,\n greeting: obj.greeting ?? undefined,\n maxContextTokens: obj.maxContextTokens ?? undefined,\n }))\n .catch(() => ({\n model: agentsSettings.model.default,\n modelLabel: null,\n temperature: 1,\n top_p: 1,\n presence_penalty: 0,\n frequency_penalty: 0,\n resendFiles: agentsSettings.resendFiles.default,\n imageDetail: ImageDetail.auto,\n agent_id: undefined,\n instructions: undefined,\n promptPrefix: null,\n iconURL: undefined,\n greeting: undefined,\n maxContextTokens: undefined,\n }));\n\nexport const openAIBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n chatGptLabel: true,\n promptPrefix: true,\n temperature: true,\n top_p: true,\n presence_penalty: true,\n frequency_penalty: true,\n resendFiles: true,\n artifacts: true,\n imageDetail: true,\n stop: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n max_tokens: true,\n reasoning_effort: true,\n});\n\nexport const openAISchema = openAIBaseSchema\n .transform((obj: Partial<TConversation>) => removeNullishValues(obj))\n .catch(() => ({}));\n\nexport const compactGoogleSchema = googleBaseSchema\n .transform((obj) => {\n const newObj: Partial<TConversation> = { ...obj };\n if (newObj.temperature === google.temperature.default) {\n delete newObj.temperature;\n }\n if (newObj.maxOutputTokens === google.maxOutputTokens.default) {\n delete newObj.maxOutputTokens;\n }\n if (newObj.topP === google.topP.default) {\n delete newObj.topP;\n }\n if (newObj.topK === google.topK.default) {\n delete newObj.topK;\n }\n\n return removeNullishValues(newObj);\n })\n .catch(() => ({}));\n\nexport const anthropicBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n promptPrefix: true,\n temperature: true,\n maxOutputTokens: true,\n topP: true,\n topK: true,\n resendFiles: true,\n promptCache: true,\n thinking: true,\n thinkingBudget: true,\n artifacts: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n});\n\nexport const anthropicSchema = anthropicBaseSchema\n .transform((obj) => removeNullishValues(obj))\n .catch(() => ({}));\n\nexport const compactPluginsSchema = gptPluginsBaseSchema\n .transform((obj) => {\n const newObj: Partial<TConversation> = { ...obj };\n if (newObj.modelLabel === null) {\n delete newObj.modelLabel;\n }\n if (newObj.chatGptLabel === null) {\n delete newObj.chatGptLabel;\n }\n if (newObj.promptPrefix === null) {\n delete newObj.promptPrefix;\n }\n if (newObj.temperature === 0.8) {\n delete newObj.temperature;\n }\n if (newObj.top_p === 1) {\n delete newObj.top_p;\n }\n if (newObj.presence_penalty === 0) {\n delete newObj.presence_penalty;\n }\n if (newObj.frequency_penalty === 0) {\n delete newObj.frequency_penalty;\n }\n if (newObj.tools?.length === 0) {\n delete newObj.tools;\n }\n\n if (\n newObj.agentOptions &&\n newObj.agentOptions.agent === EAgent.functions &&\n newObj.agentOptions.skipCompletion === true &&\n newObj.agentOptions.model === 'gpt-3.5-turbo' &&\n newObj.agentOptions.temperature === 0\n ) {\n delete newObj.agentOptions;\n }\n\n return removeNullishValues(newObj);\n })\n .catch(() => ({}));\n\nexport const tBannerSchema = z.object({\n bannerId: z.string(),\n message: z.string(),\n displayFrom: z.string(),\n displayTo: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n isPublic: z.boolean(),\n});\nexport type TBanner = z.infer<typeof tBannerSchema>;\n\nexport const compactAgentsBaseSchema = tConversationSchema.pick({\n spec: true,\n // model: true,\n iconURL: true,\n greeting: true,\n agent_id: true,\n instructions: true,\n additional_instructions: true,\n});\n\nexport const compactAgentsSchema = compactAgentsBaseSchema\n .transform((obj) => removeNullishValues(obj))\n .catch(() => ({}));\n","import { z } from 'zod';\nimport type { TPreset } from './schemas';\nimport {\n EModelEndpoint,\n tPresetSchema,\n eModelEndpointSchema,\n AuthType,\n authTypeSchema,\n} from './schemas';\n\nexport type TModelSpec = {\n name: string;\n label: string;\n preset: TPreset;\n order?: number;\n default?: boolean;\n description?: string;\n showIconInMenu?: boolean;\n showIconInHeader?: boolean;\n iconURL?: string | EModelEndpoint; // Allow using project-included icons\n authType?: AuthType;\n};\n\nexport const tModelSpecSchema = z.object({\n name: z.string(),\n label: z.string(),\n preset: tPresetSchema,\n order: z.number().optional(),\n default: z.boolean().optional(),\n description: z.string().optional(),\n showIconInMenu: z.boolean().optional(),\n showIconInHeader: z.boolean().optional(),\n iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),\n authType: authTypeSchema.optional(),\n});\n\nexport const specsConfigSchema = z.object({\n enforce: z.boolean().default(false),\n prioritize: z.boolean().default(true),\n list: z.array(tModelSpecSchema).min(1),\n addedEndpoints: z.array(z.union([z.string(), eModelEndpointSchema])).optional(),\n});\n\nexport type TSpecsConfig = z.infer<typeof specsConfigSchema>;\n","/* eslint-disable max-len */\nimport { z } from 'zod';\nimport { EModelEndpoint } from './schemas';\nimport type { FileConfig, EndpointFileConfig } from './types/files';\n\nexport const supportsFiles = {\n [EModelEndpoint.openAI]: true,\n [EModelEndpoint.google]: true,\n [EModelEndpoint.assistants]: true,\n [EModelEndpoint.azureAssistants]: true,\n [EModelEndpoint.agents]: true,\n [EModelEndpoint.azureOpenAI]: true,\n [EModelEndpoint.anthropic]: true,\n [EModelEndpoint.custom]: true,\n [EModelEndpoint.bedrock]: true,\n};\n\nexport const excelFileTypes = [\n 'application/vnd.ms-excel',\n 'application/msexcel',\n 'application/x-msexcel',\n 'application/x-ms-excel',\n 'application/x-excel',\n 'application/x-dos_ms_excel',\n 'application/xls',\n 'application/x-xls',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n];\n\nexport const fullMimeTypesList = [\n 'text/x-c',\n 'text/x-c++',\n 'application/csv',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/html',\n 'text/x-java',\n 'application/json',\n 'text/markdown',\n 'application/pdf',\n 'text/x-php',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'text/x-python',\n 'text/x-script.python',\n 'text/x-ruby',\n 'text/x-tex',\n 'text/plain',\n 'text/css',\n 'text/vtt',\n 'image/jpeg',\n 'text/javascript',\n 'image/gif',\n 'image/png',\n 'application/x-tar',\n 'application/typescript',\n 'application/xml',\n 'application/zip',\n 'image/svg',\n 'image/svg+xml',\n ...excelFileTypes,\n];\n\nexport const codeInterpreterMimeTypesList = [\n 'text/x-c',\n 'text/x-c++',\n 'application/csv',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/html',\n 'text/x-java',\n 'application/json',\n 'text/markdown',\n 'application/pdf',\n 'text/x-php',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'text/x-python',\n 'text/x-script.python',\n 'text/x-ruby',\n 'text/x-tex',\n 'text/plain',\n 'text/css',\n 'image/jpeg',\n 'text/javascript',\n 'image/gif',\n 'image/png',\n 'application/x-tar',\n 'application/typescript',\n 'application/xml',\n 'application/zip',\n ...excelFileTypes,\n];\n\nexport const retrievalMimeTypesList = [\n 'text/x-c',\n 'text/x-c++',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/html',\n 'text/x-java',\n 'application/json',\n 'text/markdown',\n 'application/pdf',\n 'text/x-php',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'text/x-python',\n 'text/x-script.python',\n 'text/x-ruby',\n 'text/x-tex',\n 'text/plain',\n];\n\nexport const imageExtRegex = /\\.(jpg|jpeg|png|gif|webp)$/i;\n\nexport const excelMimeTypes =\n /^application\\/(vnd\\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\\.openxmlformats-officedocument\\.spreadsheetml\\.sheet)$/;\n\nexport const textMimeTypes =\n /^(text\\/(x-c|x-csharp|tab-separated-values|x-c\\+\\+|x-java|html|markdown|x-php|x-python|x-script\\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv))$/;\n\nexport const applicationMimeTypes =\n /^(application\\/(epub\\+zip|csv|json|pdf|x-tar|typescript|vnd\\.openxmlformats-officedocument\\.(wordprocessingml\\.document|presentationml\\.presentation|spreadsheetml\\.sheet)|xml|zip))$/;\n\nexport const imageMimeTypes = /^image\\/(jpeg|gif|png|webp)$/;\n\nexport const supportedMimeTypes = [\n textMimeTypes,\n excelMimeTypes,\n applicationMimeTypes,\n imageMimeTypes,\n /** Supported by LC Code Interpreter PAI */\n /^image\\/(svg|svg\\+xml)$/,\n];\n\nexport const codeInterpreterMimeTypes = [\n textMimeTypes,\n excelMimeTypes,\n applicationMimeTypes,\n imageMimeTypes,\n];\n\nexport const codeTypeMapping: { [key: string]: string } = {\n c: 'text/x-c',\n cs: 'text/x-csharp',\n cpp: 'text/x-c++',\n md: 'text/markdown',\n php: 'text/x-php',\n py: 'text/x-python',\n rb: 'text/x-ruby',\n tex: 'text/x-tex',\n js: 'text/javascript',\n sh: 'application/x-sh',\n ts: 'application/typescript',\n tar: 'application/x-tar',\n zip: 'application/zip',\n yml: 'application/x-yaml',\n yaml: 'application/x-yaml',\n log: 'text/plain',\n tsv: 'text/tab-separated-values',\n};\n\nexport const retrievalMimeTypes = [\n /^(text\\/(x-c|x-c\\+\\+|html|x-java|markdown|x-php|x-python|x-script\\.python|x-ruby|x-tex|plain|vtt|xml))$/,\n /^(application\\/(json|pdf|vnd\\.openxmlformats-officedocument\\.(wordprocessingml\\.document|presentationml\\.presentation)))$/,\n];\n\nexport const megabyte = 1024 * 1024;\n/** Helper function to get megabytes value */\nexport const mbToBytes = (mb: number): number => mb * megabyte;\n\nconst defaultSizeLimit = mbToBytes(512);\nconst assistantsFileConfig = {\n fileLimit: 10,\n fileSizeLimit: defaultSizeLimit,\n totalSizeLimit: defaultSizeLimit,\n supportedMimeTypes,\n disabled: false,\n};\n\nexport const fileConfig = {\n endpoints: {\n [EModelEndpoint.assistants]: assistantsFileConfig,\n [EModelEndpoint.azureAssistants]: assistantsFileConfig,\n [EModelEndpoint.agents]: assistantsFileConfig,\n default: {\n fileLimit: 10,\n fileSizeLimit: defaultSizeLimit,\n totalSizeLimit: defaultSizeLimit,\n supportedMimeTypes,\n disabled: false,\n },\n },\n serverFileSizeLimit: defaultSizeLimit,\n avatarSizeLimit: mbToBytes(2),\n checkType: function (fileType: string, supportedTypes: RegExp[] = supportedMimeTypes) {\n return supportedTypes.some((regex) => regex.test(fileType));\n },\n};\n\nconst supportedMimeTypesSchema = z\n .array(z.any())\n .optional()\n .refine(\n (mimeTypes) => {\n if (!mimeTypes) {\n return true;\n }\n return mimeTypes.every(\n (mimeType) => mimeType instanceof RegExp || typeof mimeType === 'string',\n );\n },\n {\n message: 'Each mimeType must be a string or a RegExp object.',\n },\n );\n\nexport const endpointFileConfigSchema = z.object({\n disabled: z.boolean().optional(),\n fileLimit: z.number().min(0).optional(),\n fileSizeLimit: z.number().min(0).optional(),\n totalSizeLimit: z.number().min(0).optional(),\n supportedMimeTypes: supportedMimeTypesSchema.optional(),\n});\n\nexport const fileConfigSchema = z.object({\n endpoints: z.record(endpointFileConfigSchema).optional(),\n serverFileSizeLimit: z.number().min(0).optional(),\n avatarSizeLimit: z.number().min(0).optional(),\n});\n\n/** Helper function to safely convert string patterns to RegExp objects */\nexport const convertStringsToRegex = (patterns: string[]): RegExp[] =>\n patterns.reduce((acc: RegExp[], pattern) => {\n try {\n const regex = new RegExp(pattern);\n acc.push(regex);\n } catch (error) {\n console.error(`Invalid regex pattern \"${pattern}\" skipped.`, error);\n }\n return acc;\n }, []);\n\nexport function mergeFileConfig(dynamic: z.infer<typeof fileConfigSchema> | undefined): FileConfig {\n const mergedConfig = fileConfig as FileConfig;\n if (!dynamic) {\n return mergedConfig;\n }\n\n if (dynamic.serverFileSizeLimit !== undefined) {\n mergedConfig.serverFileSizeLimit = mbToBytes(dynamic.serverFileSizeLimit);\n }\n\n if (dynamic.avatarSizeLimit !== undefined) {\n mergedConfig.avatarSizeLimit = mbToBytes(dynamic.avatarSizeLimit);\n }\n\n if (!dynamic.endpoints) {\n return mergedConfig;\n }\n\n for (const key in dynamic.endpoints) {\n const dynamicEndpoint = (dynamic.endpoints as Record<string, EndpointFileConfig>)[key];\n\n if (!mergedConfig.endpoints[key]) {\n mergedConfig.endpoints[key] = {};\n }\n\n const mergedEndpoint = mergedConfig.endpoints[key];\n\n if (dynamicEndpoint.disabled === true) {\n mergedEndpoint.disabled = true;\n mergedEndpoint.fileLimit = 0;\n mergedEndpoint.fileSizeLimit = 0;\n mergedEndpoint.totalSizeLimit = 0;\n mergedEndpoint.supportedMimeTypes = [];\n continue;\n }\n\n if (dynamicEndpoint.fileSizeLimit !== undefined) {\n mergedEndpoint.fileSizeLimit = mbToBytes(dynamicEndpoint.fileSizeLimit);\n }\n\n if (dynamicEndpoint.totalSizeLimit !== undefined) {\n mergedEndpoint.totalSizeLimit = mbToBytes(dynamicEndpoint.totalSizeLimit);\n }\n\n const configKeys = ['fileLimit'] as const;\n configKeys.forEach((field) => {\n if (dynamicEndpoint[field] !== undefined) {\n mergedEndpoint[field] = dynamicEndpoint[field];\n }\n });\n\n if (dynamicEndpoint.supportedMimeTypes) {\n mergedEndpoint.supportedMimeTypes = convertStringsToRegex(\n dynamicEndpoint.supportedMimeTypes as unknown as string[],\n );\n }\n }\n\n return mergedConfig;\n}\n","import { EToolResources } from './assistants';\n\nexport enum FileSources {\n local = 'local',\n firebase = 'firebase',\n azure = 'azure',\n azure_blob = 'azure_blob',\n openai = 'openai',\n s3 = 's3',\n vectordb = 'vectordb',\n execute_code = 'execute_code',\n mistral_ocr = 'mistral_ocr',\n text = 'text',\n}\n\nexport const checkOpenAIStorage = (source: string) =>\n source === FileSources.openai || source === FileSources.azure;\n\nexport enum FileContext {\n avatar = 'avatar',\n unknown = 'unknown',\n agents = 'agents',\n assistants = 'assistants',\n execute_code = 'execute_code',\n image_generation = 'image_generation',\n assistants_output = 'assistants_output',\n message_attachment = 'message_attachment',\n filename = 'filename',\n updatedAt = 'updatedAt',\n source = 'source',\n filterSource = 'filterSource',\n context = 'context',\n bytes = 'bytes',\n}\n\nexport type EndpointFileConfig = {\n disabled?: boolean;\n fileLimit?: number;\n fileSizeLimit?: number;\n totalSizeLimit?: number;\n supportedMimeTypes?: RegExp[];\n};\n\nexport type FileConfig = {\n endpoints: {\n [key: string]: EndpointFileConfig;\n };\n serverFileSizeLimit?: number;\n avatarSizeLimit?: number;\n checkType?: (fileType: string, supportedTypes: RegExp[]) => boolean;\n};\n\nexport type TFile = {\n _id?: string;\n __v?: number;\n user: string;\n conversationId?: string;\n message?: string;\n file_id: string;\n temp_file_id?: string;\n bytes: number;\n embedded: boolean;\n filename: string;\n filepath: string;\n object: 'file';\n type: string;\n usage: number;\n context?: FileContext;\n source?: FileSources;\n filterSource?: FileSources;\n width?: number;\n height?: number;\n expiresAt?: string | Date;\n preview?: string;\n metadata?: { fileIdentifier?: string };\n createdAt?: string | Date;\n updatedAt?: string | Date;\n};\n\nexport type TFileUpload = TFile & {\n temp_file_id: string;\n};\n\nexport type AvatarUploadResponse = {\n url: string;\n};\n\nexport type SpeechToTextResponse = {\n text: string;\n};\n\nexport type VoiceResponse = string[];\n\nexport type UploadMutationOptions = {\n onSuccess?: (data: TFileUpload, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type UploadAvatarOptions = {\n onSuccess?: (data: AvatarUploadResponse, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type SpeechToTextOptions = {\n onSuccess?: (data: SpeechToTextResponse, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type TextToSpeechOptions = {\n onSuccess?: (data: ArrayBuffer, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type VoiceOptions = {\n onSuccess?: (data: VoiceResponse, variables: unknown, context?: unknown) => void;\n onMutate?: () => void | Promise<unknown>;\n onError?: (error: unknown, variables: unknown, context?: unknown) => void;\n};\n\nexport type DeleteFilesResponse = {\n message: string;\n result: Record<string, unknown>;\n};\n\nexport type BatchFile = {\n file_id: string;\n filepath: string;\n embedded: boolean;\n source: FileSources;\n};\n\nexport type DeleteFilesBody = {\n files: BatchFile[];\n agent_id?: string;\n assistant_id?: string;\n tool_resource?: EToolResources;\n};\n\nexport type DeleteMutationOptions = {\n onSuccess?: (data: DeleteFilesResponse, variables: DeleteFilesBody, context?: unknown) => void;\n onMutate?: (variables: DeleteFilesBody) => void | Promise<unknown>;\n onError?: (error: unknown, variables: DeleteFilesBody, context?: unknown) => void;\n};\n","export const envVarRegex = /^\\${(.+)}$/;\n\n/** Extracts the value of an environment variable from a string. */\nexport function extractEnvVariable(value: string) {\n if (!value) {\n return value;\n }\n\n // Trim the input\n const trimmed = value.trim();\n\n // Special case: if it's just a single environment variable\n const singleMatch = trimmed.match(envVarRegex);\n if (singleMatch) {\n const varName = singleMatch[1];\n return process.env[varName] || trimmed;\n }\n\n // For multiple variables, process them using a regex loop\n const regex = /\\${([^}]+)}/g;\n let result = trimmed;\n\n // First collect all matches and their positions\n const matches = [];\n let match;\n while ((match = regex.exec(trimmed)) !== null) {\n matches.push({\n fullMatch: match[0],\n varName: match[1],\n index: match.index,\n });\n }\n\n // Process matches in reverse order to avoid position shifts\n for (let i = matches.length - 1; i >= 0; i--) {\n const { fullMatch, varName, index } = matches[i];\n const envValue = process.env[varName] || fullMatch;\n\n // Replace at exact position\n result = result.substring(0, index) + envValue + result.substring(index + fullMatch.length);\n }\n\n return result;\n}\n","import { z } from 'zod';\nimport { extractEnvVariable } from './utils';\n\nconst BaseOptionsSchema = z.object({\n iconPath: z.string().optional(),\n timeout: z.number().optional(),\n initTimeout: z.number().optional(),\n /** Controls visibility in chat dropdown menu (MCPSelect) */\n chatMenu: z.boolean().optional(),\n});\n\nexport const StdioOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('stdio').optional(),\n /**\n * The executable to run to start the server.\n */\n command: z.string(),\n /**\n * Command line arguments to pass to the executable.\n */\n args: z.array(z.string()),\n /**\n * The environment to use when spawning the process.\n *\n * If not specified, the result of getDefaultEnvironment() will be used.\n * Environment variables can be referenced using ${VAR_NAME} syntax.\n */\n env: z\n .record(z.string(), z.string())\n .optional()\n .transform((env) => {\n if (!env) {\n return env;\n }\n\n const processedEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(env)) {\n processedEnv[key] = extractEnvVariable(value);\n }\n return processedEnv;\n }),\n /**\n * How to handle stderr of the child process. This matches the semantics of Node's `child_process.spawn`.\n *\n * @type {import('node:child_process').IOType | import('node:stream').Stream | number}\n *\n * The default is \"inherit\", meaning messages to stderr will be printed to the parent process's stderr.\n */\n stderr: z.any().optional(),\n});\n\nexport const WebSocketOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('websocket').optional(),\n url: z\n .string()\n .url()\n .refine(\n (val) => {\n const protocol = new URL(val).protocol;\n return protocol === 'ws:' || protocol === 'wss:';\n },\n {\n message: 'WebSocket URL must start with ws:// or wss://',\n },\n ),\n});\n\nexport const SSEOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('sse').optional(),\n headers: z.record(z.string(), z.string()).optional(),\n url: z\n .string()\n .url()\n .refine(\n (val) => {\n const protocol = new URL(val).protocol;\n return protocol !== 'ws:' && protocol !== 'wss:';\n },\n {\n message: 'SSE URL must not start with ws:// or wss://',\n },\n ),\n});\n\nexport const StreamableHTTPOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('streamable-http'),\n headers: z.record(z.string(), z.string()).optional(),\n url: z\n .string()\n .url()\n .refine(\n (val) => {\n const protocol = new URL(val).protocol;\n return protocol !== 'ws:' && protocol !== 'wss:';\n },\n {\n message: 'Streamable HTTP URL must not start with ws:// or wss://',\n },\n ),\n});\n\nexport const MCPOptionsSchema = z.union([\n StdioOptionsSchema,\n WebSocketOptionsSchema,\n SSEOptionsSchema,\n StreamableHTTPOptionsSchema,\n]);\n\nexport const MCPServersSchema = z.record(z.string(), MCPOptionsSchema);\n\nexport type MCPOptions = z.infer<typeof MCPOptionsSchema>;\n\n/**\n * Recursively processes an object to replace environment variables in string values\n * @param {MCPOptions} obj - The object to process\n * @param {string} [userId] - The user ID\n * @returns {MCPOptions} - The processed object with environment variables replaced\n */\nexport function processMCPEnv(obj: Readonly<MCPOptions>, userId?: string): MCPOptions {\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n const newObj: MCPOptions = structuredClone(obj);\n\n if ('env' in newObj && newObj.env) {\n const processedEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(newObj.env)) {\n processedEnv[key] = extractEnvVariable(value);\n }\n newObj.env = processedEnv;\n } else if ('headers' in newObj && newObj.headers) {\n const processedHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(newObj.headers)) {\n if (value === '{{LIBRECHAT_USER_ID}}' && userId != null && userId) {\n processedHeaders[key] = userId;\n continue;\n }\n processedHeaders[key] = extractEnvVariable(value);\n }\n newObj.headers = processedHeaders;\n }\n\n return newObj;\n}\n","import { z } from 'zod';\nimport type { ZodError } from 'zod';\nimport type { TModelsConfig } from './types';\nimport { EModelEndpoint, eModelEndpointSchema } from './schemas';\nimport { specsConfigSchema, TSpecsConfig } from './models';\nimport { fileConfigSchema } from './file-config';\nimport { FileSources } from './types/files';\nimport { MCPServersSchema } from './mcp';\n\nexport const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord'];\n\nexport const defaultRetrievalModels = [\n 'gpt-4o',\n 'o1-preview-2024-09-12',\n 'o1-preview',\n 'o1-mini-2024-09-12',\n 'o1-mini',\n 'o3-mini',\n 'chatgpt-4o-latest',\n 'gpt-4o-2024-05-13',\n 'gpt-4o-2024-08-06',\n 'gpt-4o-mini',\n 'gpt-4o-mini-2024-07-18',\n 'gpt-4-turbo-preview',\n 'gpt-3.5-turbo-0125',\n 'gpt-4-0125-preview',\n 'gpt-4-1106-preview',\n 'gpt-3.5-turbo-1106',\n 'gpt-3.5-turbo-0125',\n 'gpt-4-turbo',\n 'gpt-4-0125',\n 'gpt-4-1106',\n];\n\nexport const excludedKeys = new Set([\n 'conversationId',\n 'title',\n 'iconURL',\n 'greeting',\n 'endpoint',\n 'endpointType',\n 'createdAt',\n 'updatedAt',\n 'expiredAt',\n 'messages',\n 'isArchived',\n 'tags',\n 'user',\n '__v',\n '_id',\n 'tools',\n 'model',\n 'files',\n 'spec',\n 'disableParams',\n]);\n\nexport enum SettingsViews {\n default = 'default',\n advanced = 'advanced',\n}\n\nexport const fileSourceSchema = z.nativeEnum(FileSources);\n\n// Helper type to extract the shape of the Zod object schema\ntype SchemaShape<T> = T extends z.ZodObject<infer U> ? U : never;\n\n// Helper type to determine the default value or undefined based on whether the field has a default\ntype DefaultValue<T> =\n T extends z.ZodDefault<z.ZodTypeAny> ? ReturnType<T['_def']['defaultValue']> : undefined;\n\n// Extract default values or undefined from the schema shape\ntype ExtractDefaults<T> = {\n [P in keyof T]: DefaultValue<T[P]>;\n};\n\nexport type SchemaDefaults<T> = ExtractDefaults<SchemaShape<T>>;\n\nexport type TConfigDefaults = SchemaDefaults<typeof configSchema>;\n\nexport function getSchemaDefaults<Schema extends z.AnyZodObject>(\n schema: Schema,\n): ExtractDefaults<SchemaShape<Schema>> {\n const shape = schema.shape;\n const entries = Object.entries(shape).map(([key, value]) => {\n if (value instanceof z.ZodDefault) {\n // Extract default value if it exists\n return [key, value._def.defaultValue()];\n }\n return [key, undefined];\n });\n\n // Create the object with the right types\n return Object.fromEntries(entries) as ExtractDefaults<SchemaShape<Schema>>;\n}\n\nexport const modelConfigSchema = z\n .object({\n deploymentName: z.string().optional(),\n version: z.string().optional(),\n assistants: z.boolean().optional(),\n })\n .or(z.boolean());\n\nexport type TAzureModelConfig = z.infer<typeof modelConfigSchema>;\n\nexport const azureBaseSchema = z.object({\n apiKey: z.string(),\n serverless: z.boolean().optional(),\n instanceName: z.string().optional(),\n deploymentName: z.string().optional(),\n assistants: z.boolean().optional(),\n addParams: z.record(z.any()).optional(),\n dropParams: z.array(z.string()).optional(),\n forcePrompt: z.boolean().optional(),\n version: z.string().optional(),\n baseURL: z.string().optional(),\n additionalHeaders: z.record(z.any()).optional(),\n});\n\nexport type TAzureBaseSchema = z.infer<typeof azureBaseSchema>;\n\nexport const azureGroupSchema = z\n .object({\n group: z.string(),\n models: z.record(z.string(), modelConfigSchema),\n })\n .required()\n .and(azureBaseSchema);\n\nexport const azureGroupConfigsSchema = z.array(azureGroupSchema).min(1);\nexport type TAzureGroup = z.infer<typeof azureGroupSchema>;\nexport type TAzureGroups = z.infer<typeof azureGroupConfigsSchema>;\nexport type TAzureModelMapSchema = {\n // deploymentName?: string;\n // version?: string;\n group: string;\n};\n\nexport type TAzureModelGroupMap = Record<string, TAzureModelMapSchema | undefined>;\nexport type TAzureGroupMap = Record<\n string,\n (TAzureBaseSchema & { models: Record<string, TAzureModelConfig | undefined> }) | undefined\n>;\n\nexport type TValidatedAzureConfig = {\n modelNames: string[];\n modelGroupMap: TAzureModelGroupMap;\n groupMap: TAzureGroupMap;\n};\n\nexport type TAzureConfigValidationResult = TValidatedAzureConfig & {\n isValid: boolean;\n errors: (ZodError | string)[];\n};\n\nexport enum Capabilities {\n code_interpreter = 'code_interpreter',\n image_vision = 'image_vision',\n retrieval = 'retrieval',\n actions = 'actions',\n tools = 'tools',\n}\n\nexport enum AgentCapabilities {\n hide_sequential_outputs = 'hide_sequential_outputs',\n end_after_tools = 'end_after_tools',\n execute_code = 'execute_code',\n file_search = 'file_search',\n artifacts = 'artifacts',\n actions = 'actions',\n tools = 'tools',\n chain = 'chain',\n ocr = 'ocr',\n}\n\nexport const defaultAssistantsVersion = {\n [EModelEndpoint.assistants]: 2,\n [EModelEndpoint.azureAssistants]: 1,\n};\n\nexport const baseEndpointSchema = z.object({\n streamRate: z.number().optional(),\n baseURL: z.string().optional(),\n titlePrompt: z.string().optional(),\n titleModel: z.string().optional(),\n});\n\nexport type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;\n\nexport const bedrockEndpointSchema = baseEndpointSchema.merge(\n z.object({\n availableRegions: z.array(z.string()).optional(),\n }),\n);\n\nexport const assistantEndpointSchema = baseEndpointSchema.merge(\n z.object({\n /* assistants specific */\n disableBuilder: z.boolean().optional(),\n pollIntervalMs: z.number().optional(),\n timeoutMs: z.number().optional(),\n version: z.union([z.string(), z.number()]).default(2),\n supportedIds: z.array(z.string()).min(1).optional(),\n excludedIds: z.array(z.string()).min(1).optional(),\n privateAssistants: z.boolean().optional(),\n retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),\n capabilities: z\n .array(z.nativeEnum(Capabilities))\n .optional()\n .default([\n Capabilities.code_interpreter,\n Capabilities.image_vision,\n Capabilities.retrieval,\n Capabilities.actions,\n Capabilities.tools,\n ]),\n /* general */\n apiKey: z.string().optional(),\n models: z\n .object({\n default: z.array(z.string()).min(1),\n fetch: z.boolean().optional(),\n userIdQuery: z.boolean().optional(),\n })\n .optional(),\n titleConvo: z.boolean().optional(),\n titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),\n headers: z.record(z.any()).optional(),\n }),\n);\n\nexport type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;\n\nexport const agentsEndpointSChema = baseEndpointSchema.merge(\n z.object({\n /* agents specific */\n recursionLimit: z.number().optional(),\n disableBuilder: z.boolean().optional(),\n maxRecursionLimit: z.number().optional(),\n allowedProviders: z.array(z.union([z.string(), eModelEndpointSchema])).optional(),\n capabilities: z\n .array(z.nativeEnum(AgentCapabilities))\n .optional()\n .default([\n AgentCapabilities.execute_code,\n AgentCapabilities.file_search,\n AgentCapabilities.artifacts,\n AgentCapabilities.actions,\n AgentCapabilities.tools,\n AgentCapabilities.ocr,\n AgentCapabilities.chain,\n ]),\n }),\n);\n\nexport type TAgentsEndpoint = z.infer<typeof agentsEndpointSChema>;\n\nexport const endpointSchema = baseEndpointSchema.merge(\n z.object({\n name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, {\n message: `Value cannot be one of the default endpoint (EModelEndpoint) values: ${Object.values(\n EModelEndpoint,\n ).join(', ')}`,\n }),\n apiKey: z.string(),\n baseURL: z.string(),\n models: z.object({\n default: z.array(z.string()).min(1),\n fetch: z.boolean().optional(),\n userIdQuery: z.boolean().optional(),\n }),\n titleConvo: z.boolean().optional(),\n titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),\n summarize: z.boolean().optional(),\n summaryModel: z.string().optional(),\n forcePrompt: z.boolean().optional(),\n modelDisplayLabel: z.string().optional(),\n headers: z.record(z.any()).optional(),\n addParams: z.record(z.any()).optional(),\n dropParams: z.array(z.string()).optional(),\n customOrder: z.number().optional(),\n directEndpoint: z.boolean().optional(),\n titleMessageRole: z.string().optional(),\n }),\n);\n\nexport type TEndpoint = z.infer<typeof endpointSchema>;\n\nexport const azureEndpointSchema = z\n .object({\n groups: azureGroupConfigsSchema,\n plugins: z.boolean().optional(),\n assistants: z.boolean().optional(),\n })\n .and(\n endpointSchema\n .pick({\n streamRate: true,\n titleConvo: true,\n titleMethod: true,\n titleModel: true,\n summarize: true,\n summaryModel: true,\n customOrder: true,\n })\n .partial(),\n );\n\nexport type TAzureConfig = Omit<z.infer<typeof azureEndpointSchema>, 'groups'> &\n TAzureConfigValidationResult;\n\nconst ttsOpenaiSchema = z.object({\n url: z.string().optional(),\n apiKey: z.string(),\n model: z.string(),\n voices: z.array(z.string()),\n});\n\nconst ttsAzureOpenAISchema = z.object({\n instanceName: z.string(),\n apiKey: z.string(),\n deploymentName: z.string(),\n apiVersion: z.string(),\n model: z.string(),\n voices: z.array(z.string()),\n});\n\nconst ttsElevenLabsSchema = z.object({\n url: z.string().optional(),\n websocketUrl: z.string().optional(),\n apiKey: z.string(),\n model: z.string(),\n voices: z.array(z.string()),\n voice_settings: z\n .object({\n similarity_boost: z.number().optional(),\n stability: z.number().optional(),\n style: z.number().optional(),\n use_speaker_boost: z.boolean().optional(),\n })\n .optional(),\n pronunciation_dictionary_locators: z.array(z.string()).optional(),\n});\n\nconst ttsLocalaiSchema = z.object({\n url: z.string(),\n apiKey: z.string().optional(),\n voices: z.array(z.string()),\n backend: z.string(),\n});\n\nconst ttsSchema = z.object({\n openai: ttsOpenaiSchema.optional(),\n azureOpenAI: ttsAzureOpenAISchema.optional(),\n elevenlabs: ttsElevenLabsSchema.optional(),\n localai: ttsLocalaiSchema.optional(),\n});\n\nconst sttOpenaiSchema = z.object({\n url: z.string().optional(),\n apiKey: z.string(),\n model: z.string(),\n});\n\nconst sttAzureOpenAISchema = z.object({\n instanceName: z.string(),\n apiKey: z.string(),\n deploymentName: z.string(),\n apiVersion: z.string(),\n});\n\nconst sttSchema = z.object({\n openai: sttOpenaiSchema.optional(),\n azureOpenAI: sttAzureOpenAISchema.optional(),\n});\n\nconst speechTab = z\n .object({\n conversationMode: z.boolean().optional(),\n advancedMode: z.boolean().optional(),\n speechToText: z\n .boolean()\n .optional()\n .or(\n z.object({\n engineSTT: z.string().optional(),\n languageSTT: z.string().optional(),\n autoTranscribeAudio: z.boolean().optional(),\n decibelValue: z.number().optional(),\n autoSendText: z.number().optional(),\n }),\n )\n .optional(),\n textToSpeech: z\n .boolean()\n .optional()\n .or(\n z.object({\n engineTTS: z.string().optional(),\n voice: z.string().optional(),\n languageTTS: z.string().optional(),\n automaticPlayback: z.boolean().optional(),\n playbackRate: z.number().optional(),\n cacheTTS: z.boolean().optional(),\n }),\n )\n .optional(),\n })\n .optional();\n\nexport enum RateLimitPrefix {\n FILE_UPLOAD = 'FILE_UPLOAD',\n IMPORT = 'IMPORT',\n TTS = 'TTS',\n STT = 'STT',\n}\n\nexport const rateLimitSchema = z.object({\n fileUploads: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n conversationsImport: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n tts: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n stt: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n});\n\nexport enum EImageOutputType {\n PNG = 'png',\n WEBP = 'webp',\n JPEG = 'jpeg',\n}\n\nconst termsOfServiceSchema = z.object({\n externalUrl: z.string().optional(),\n openNewTab: z.boolean().optional(),\n modalAcceptance: z.boolean().optional(),\n modalTitle: z.string().optional(),\n modalContent: z.string().or(z.array(z.string())).optional(),\n});\n\nexport type TTermsOfService = z.infer<typeof termsOfServiceSchema>;\n\nexport const intefaceSchema = z\n .object({\n privacyPolicy: z\n .object({\n externalUrl: z.string().optional(),\n openNewTab: z.boolean().optional(),\n })\n .optional(),\n termsOfService: termsOfServiceSchema.optional(),\n customWelcome: z.string().optional(),\n endpointsMenu: z.boolean().optional(),\n modelSelect: z.boolean().optional(),\n parameters: z.boolean().optional(),\n sidePanel: z.boolean().optional(),\n multiConvo: z.boolean().optional(),\n bookmarks: z.boolean().optional(),\n presets: z.boolean().optional(),\n prompts: z.boolean().optional(),\n agents: z.boolean().optional(),\n temporaryChat: z.boolean().optional(),\n runCode: z.boolean().optional(),\n })\n .default({\n endpointsMenu: true,\n modelSelect: true,\n parameters: true,\n sidePanel: true,\n presets: true,\n multiConvo: true,\n bookmarks: true,\n prompts: true,\n agents: true,\n temporaryChat: true,\n runCode: true,\n });\n\nexport type TInterfaceConfig = z.infer<typeof intefaceSchema>;\nexport type TBalanceConfig = z.infer<typeof balanceSchema>;\n\nexport const turnstileOptionsSchema = z\n .object({\n language: z.string().default('auto'),\n size: z.enum(['normal', 'compact', 'flexible', 'invisible']).default('normal'),\n })\n .default({\n language: 'auto',\n size: 'normal',\n });\n\nexport const turnstileSchema = z.object({\n siteKey: z.string(),\n options: turnstileOptionsSchema.optional(),\n});\n\nexport type TTurnstileConfig = z.infer<typeof turnstileSchema>;\n\nexport type TStartupConfig = {\n appTitle: string;\n socialLogins?: string[];\n interface?: TInterfaceConfig;\n turnstile?: TTurnstileConfig;\n balance?: TBalanceConfig;\n discordLoginEnabled: boolean;\n facebookLoginEnabled: boolean;\n githubLoginEnabled: boolean;\n googleLoginEnabled: boolean;\n openidLoginEnabled: boolean;\n appleLoginEnabled: boolean;\n openidLabel: string;\n openidImageUrl: string;\n openidAutoRedirect: boolean;\n /** LDAP Auth Configuration */\n ldap?: {\n /** LDAP enabled */\n enabled: boolean;\n /** Whether LDAP uses username vs. email */\n username?: boolean;\n };\n serverDomain: string;\n emailLoginEnabled: boolean;\n registrationEnabled: boolean;\n socialLoginEnabled: boolean;\n passwordResetEnabled: boolean;\n emailEnabled: boolean;\n showBirthdayIcon: boolean;\n helpAndFaqURL: string;\n customFooter?: string;\n modelSpecs?: TSpecsConfig;\n sharedLinksEnabled: boolean;\n publicSharedLinksEnabled: boolean;\n analyticsGtmId?: string;\n instanceProjectId: string;\n bundlerURL?: string;\n staticBundlerURL?: string;\n};\n\nexport enum OCRStrategy {\n MISTRAL_OCR = 'mistral_ocr',\n CUSTOM_OCR = 'custom_ocr',\n}\n\nexport const ocrSchema = z.object({\n mistralModel: z.string().optional(),\n apiKey: z.string().optional().default('OCR_API_KEY'),\n baseURL: z.string().optional().default('OCR_BASEURL'),\n strategy: z.nativeEnum(OCRStrategy).default(OCRStrategy.MISTRAL_OCR),\n});\n\nexport const balanceSchema = z.object({\n enabled: z.boolean().optional().default(false),\n startBalance: z.number().optional().default(20000),\n autoRefillEnabled: z.boolean().optional().default(false),\n refillIntervalValue: z.number().optional().default(30),\n refillIntervalUnit: z\n .enum(['seconds', 'minutes', 'hours', 'days', 'weeks', 'months'])\n .optional()\n .default('days'),\n refillAmount: z.number().optional().default(10000),\n});\n\nexport const configSchema = z.object({\n version: z.string(),\n cache: z.boolean().default(true),\n ocr: ocrSchema.optional(),\n secureImageLinks: z.boolean().optional(),\n imageOutputType: z.nativeEnum(EImageOutputType).default(EImageOutputType.PNG),\n includedTools: z.array(z.string()).optional(),\n filteredTools: z.array(z.string()).optional(),\n mcpServers: MCPServersSchema.optional(),\n interface: intefaceSchema,\n turnstile: turnstileSchema.optional(),\n fileStrategy: fileSourceSchema.default(FileSources.local),\n actions: z\n .object({\n allowedDomains: z.array(z.string()).optional(),\n })\n .optional(),\n registration: z\n .object({\n socialLogins: z.array(z.string()).optional(),\n allowedDomains: z.array(z.string()).optional(),\n })\n .default({ socialLogins: defaultSocialLogins }),\n balance: balanceSchema.optional(),\n speech: z\n .object({\n tts: ttsSchema.optional(),\n stt: sttSchema.optional(),\n speechTab: speechTab.optional(),\n })\n .optional(),\n rateLimits: rateLimitSchema.optional(),\n fileConfig: fileConfigSchema.optional(),\n modelSpecs: specsConfigSchema.optional(),\n endpoints: z\n .object({\n all: baseEndpointSchema.optional(),\n [EModelEndpoint.openAI]: baseEndpointSchema.optional(),\n [EModelEndpoint.google]: baseEndpointSchema.optional(),\n [EModelEndpoint.anthropic]: baseEndpointSchema.optional(),\n [EModelEndpoint.gptPlugins]: baseEndpointSchema.optional(),\n [EModelEndpoint.azureOpenAI]: azureEndpointSchema.optional(),\n [EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),\n [EModelEndpoint.assistants]: assistantEndpointSchema.optional(),\n [EModelEndpoint.agents]: agentsEndpointSChema.optional(),\n [EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),\n [EModelEndpoint.bedrock]: baseEndpointSchema.optional(),\n })\n .strict()\n .refine((data) => Object.keys(data).length > 0, {\n message: 'At least one `endpoints` field must be provided.',\n })\n .optional(),\n});\n\nexport const getConfigDefaults = () => getSchemaDefaults(configSchema);\n\nexport type TCustomConfig = z.infer<typeof configSchema>;\n\nexport type TProviderSchema =\n | z.infer<typeof ttsOpenaiSchema>\n | z.infer<typeof ttsElevenLabsSchema>\n | z.infer<typeof ttsLocalaiSchema>\n | undefined;\n\nexport enum KnownEndpoints {\n anyscale = 'anyscale',\n apipie = 'apipie',\n cohere = 'cohere',\n fireworks = 'fireworks',\n deepseek = 'deepseek',\n groq = 'groq',\n huggingface = 'huggingface',\n mistral = 'mistral',\n mlx = 'mlx',\n ollama = 'ollama',\n openrouter = 'openrouter',\n perplexity = 'perplexity',\n shuttleai = 'shuttleai',\n 'together.ai' = 'together.ai',\n unify = 'unify',\n xai = 'xai',\n}\n\nexport enum FetchTokenConfig {\n openrouter = KnownEndpoints.openrouter,\n}\n\nexport const defaultEndpoints: EModelEndpoint[] = [\n EModelEndpoint.openAI,\n EModelEndpoint.assistants,\n EModelEndpoint.azureAssistants,\n EModelEndpoint.azureOpenAI,\n EModelEndpoint.agents,\n EModelEndpoint.chatGPTBrowser,\n EModelEndpoint.gptPlugins,\n EModelEndpoint.google,\n EModelEndpoint.anthropic,\n EModelEndpoint.custom,\n EModelEndpoint.bedrock,\n];\n\nexport const alternateName = {\n [EModelEndpoint.openAI]: 'OpenAI',\n [EModelEndpoint.assistants]: 'Assistants',\n [EModelEndpoint.agents]: 'Agents',\n [EModelEndpoint.azureAssistants]: 'Azure Assistants',\n [EModelEndpoint.azureOpenAI]: 'Azure OpenAI',\n [EModelEndpoint.chatGPTBrowser]: 'ChatGPT',\n [EModelEndpoint.gptPlugins]: 'Plugins',\n [EModelEndpoint.google]: 'Google',\n [EModelEndpoint.anthropic]: 'Anthropic',\n [EModelEndpoint.custom]: 'Custom',\n [EModelEndpoint.bedrock]: 'AWS Bedrock',\n [KnownEndpoints.ollama]: 'Ollama',\n [KnownEndpoints.deepseek]: 'DeepSeek',\n [KnownEndpoints.xai]: 'xAI',\n};\n\nconst sharedOpenAIModels = [\n 'gpt-4o-mini',\n 'gpt-4o',\n 'gpt-4.5-preview',\n 'gpt-4.5-preview-2025-02-27',\n 'gpt-3.5-turbo',\n 'gpt-3.5-turbo-0125',\n 'gpt-4-turbo',\n 'gpt-4-turbo-2024-04-09',\n 'gpt-4-0125-preview',\n 'gpt-4-turbo-preview',\n 'gpt-4-1106-preview',\n 'gpt-3.5-turbo-1106',\n 'gpt-3.5-turbo-16k-0613',\n 'gpt-3.5-turbo-16k',\n 'gpt-4',\n 'gpt-4-0314',\n 'gpt-4-32k-0314',\n 'gpt-4-0613',\n 'gpt-3.5-turbo-0613',\n];\n\nconst sharedAnthropicModels = [\n 'claude-3-7-sonnet-latest',\n 'claude-3-7-sonnet-20250219',\n 'claude-3-5-haiku-20241022',\n 'claude-3-5-sonnet-20241022',\n 'claude-3-5-sonnet-20240620',\n 'claude-3-5-sonnet-latest',\n 'claude-3-opus-20240229',\n 'claude-3-sonnet-20240229',\n 'claude-3-haiku-20240307',\n 'claude-2.1',\n 'claude-2',\n 'claude-1.2',\n 'claude-1',\n 'claude-1-100k',\n 'claude-instant-1',\n 'claude-instant-1-100k',\n];\n\nexport const bedrockModels = [\n 'anthropic.claude-3-5-sonnet-20241022-v2:0',\n 'anthropic.claude-3-5-sonnet-20240620-v1:0',\n 'anthropic.claude-3-5-haiku-20241022-v1:0',\n 'anthropic.claude-3-haiku-20240307-v1:0',\n 'anthropic.claude-3-opus-20240229-v1:0',\n 'anthropic.claude-3-sonnet-20240229-v1:0',\n 'anthropic.claude-v2',\n 'anthropic.claude-v2:1',\n 'anthropic.claude-instant-v1',\n // 'cohere.command-text-v14', // no conversation history\n // 'cohere.command-light-text-v14', // no conversation history\n 'cohere.command-r-v1:0',\n 'cohere.command-r-plus-v1:0',\n 'meta.llama2-13b-chat-v1',\n 'meta.llama2-70b-chat-v1',\n 'meta.llama3-8b-instruct-v1:0',\n 'meta.llama3-70b-instruct-v1:0',\n 'meta.llama3-1-8b-instruct-v1:0',\n 'meta.llama3-1-70b-instruct-v1:0',\n 'meta.llama3-1-405b-instruct-v1:0',\n 'mistral.mistral-7b-instruct-v0:2',\n 'mistral.mixtral-8x7b-instruct-v0:1',\n 'mistral.mistral-large-2402-v1:0',\n 'mistral.mistral-large-2407-v1:0',\n 'mistral.mistral-small-2402-v1:0',\n 'ai21.jamba-instruct-v1:0',\n // 'ai21.j2-mid-v1', // no streaming\n // 'ai21.j2-ultra-v1', no conversation history\n 'amazon.titan-text-lite-v1',\n 'amazon.titan-text-express-v1',\n 'amazon.titan-text-premier-v1:0',\n];\n\nexport const defaultModels = {\n [EModelEndpoint.azureAssistants]: sharedOpenAIModels,\n [EModelEndpoint.assistants]: [...sharedOpenAIModels, 'chatgpt-4o-latest'],\n [EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)\n [EModelEndpoint.google]: [\n // Shared Google Models between Vertex AI & Gen AI\n // Gemini 2.0 Models\n 'gemini-2.0-flash-001',\n 'gemini-2.0-flash-exp',\n 'gemini-2.0-flash-lite',\n 'gemini-2.0-pro-exp-02-05',\n // Gemini 1.5 Models\n 'gemini-1.5-flash-001',\n 'gemini-1.5-flash-002',\n 'gemini-1.5-pro-001',\n 'gemini-1.5-pro-002',\n // Gemini 1.0 Models\n 'gemini-1.0-pro-001',\n ],\n [EModelEndpoint.anthropic]: sharedAnthropicModels,\n [EModelEndpoint.openAI]: [\n ...sharedOpenAIModels,\n 'chatgpt-4o-latest',\n 'gpt-4-vision-preview',\n 'gpt-3.5-turbo-instruct-0914',\n 'gpt-3.5-turbo-instruct',\n ],\n [EModelEndpoint.bedrock]: bedrockModels,\n};\n\nconst fitlerAssistantModels = (str: string) => {\n return /gpt-4|gpt-3\\\\.5/i.test(str) && !/vision|instruct/i.test(str);\n};\n\nconst openAIModels = defaultModels[EModelEndpoint.openAI];\n\nexport const initialModelsConfig: TModelsConfig = {\n initial: [],\n [EModelEndpoint.openAI]: openAIModels,\n [EModelEndpoint.assistants]: openAIModels.filter(fitlerAssistantModels),\n [EModelEndpoint.agents]: openAIModels, // TODO: Add agent models (agentsModels)\n [EModelEndpoint.gptPlugins]: openAIModels,\n [EModelEndpoint.azureOpenAI]: openAIModels,\n [EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],\n [EModelEndpoint.google]: defaultModels[EModelEndpoint.google],\n [EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],\n [EModelEndpoint.bedrock]: defaultModels[EModelEndpoint.bedrock],\n};\n\nexport const EndpointURLs: { [key in EModelEndpoint]: string } = {\n [EModelEndpoint.openAI]: `/api/ask/${EModelEndpoint.openAI}`,\n [EModelEndpoint.google]: `/api/ask/${EModelEndpoint.google}`,\n [EModelEndpoint.custom]: `/api/ask/${EModelEndpoint.custom}`,\n [EModelEndpoint.anthropic]: `/api/ask/${EModelEndpoint.anthropic}`,\n [EModelEndpoint.gptPlugins]: `/api/ask/${EModelEndpoint.gptPlugins}`,\n [EModelEndpoint.azureOpenAI]: `/api/ask/${EModelEndpoint.azureOpenAI}`,\n [EModelEndpoint.chatGPTBrowser]: `/api/ask/${EModelEndpoint.chatGPTBrowser}`,\n [EModelEndpoint.azureAssistants]: '/api/assistants/v1/chat',\n [EModelEndpoint.assistants]: '/api/assistants/v2/chat',\n [EModelEndpoint.agents]: `/api/${EModelEndpoint.agents}/chat`,\n [EModelEndpoint.bedrock]: `/api/${EModelEndpoint.bedrock}/chat`,\n};\n\nexport const modularEndpoints = new Set<EModelEndpoint | string>([\n EModelEndpoint.gptPlugins,\n EModelEndpoint.anthropic,\n EModelEndpoint.google,\n EModelEndpoint.openAI,\n EModelEndpoint.azureOpenAI,\n EModelEndpoint.custom,\n EModelEndpoint.agents,\n EModelEndpoint.bedrock,\n]);\n\nexport const supportsBalanceCheck = {\n [EModelEndpoint.custom]: true,\n [EModelEndpoint.openAI]: true,\n [EModelEndpoint.anthropic]: true,\n [EModelEndpoint.gptPlugins]: true,\n [EModelEndpoint.assistants]: true,\n [EModelEndpoint.agents]: true,\n [EModelEndpoint.azureAssistants]: true,\n [EModelEndpoint.azureOpenAI]: true,\n [EModelEndpoint.bedrock]: true,\n};\n\nexport const visionModels = [\n 'qwen-vl',\n 'grok-vision',\n 'grok-2-vision',\n 'grok-3',\n 'gpt-4o-mini',\n 'gpt-4o',\n 'gpt-4-turbo',\n 'gpt-4-vision',\n 'o4-mini',\n 'o3',\n 'o1',\n 'gpt-4.1',\n 'gpt-4.5',\n 'llava',\n 'llava-13b',\n 'gemini-pro-vision',\n 'claude-3',\n 'gemma',\n 'gemini-exp',\n 'gemini-1.5',\n 'gemini-2.0',\n 'gemini-2.5',\n 'gemini-3',\n 'moondream',\n 'llama3.2-vision',\n 'llama-3.2-11b-vision',\n 'llama-3-2-11b-vision',\n 'llama-3.2-90b-vision',\n 'llama-3-2-90b-vision',\n];\nexport enum VisionModes {\n generative = 'generative',\n agents = 'agents',\n}\n\nexport function validateVisionModel({\n model,\n additionalModels = [],\n availableModels,\n}: {\n model: string;\n additionalModels?: string[];\n availableModels?: string[];\n}) {\n if (!model) {\n return false;\n }\n\n if (model.includes('gpt-4-turbo-preview') || model.includes('o1-mini')) {\n return false;\n }\n\n if (availableModels && !availableModels.includes(model)) {\n return false;\n }\n\n return visionModels.concat(additionalModels).some((visionModel) => model.includes(visionModel));\n}\n\nexport const imageGenTools = new Set(['dalle', 'dall-e', 'stable-diffusion', 'flux']);\n\n/**\n * Enum for collections using infinite queries\n */\nexport enum InfiniteCollections {\n /**\n * Collection for Prompt Groups\n */\n PROMPT_GROUPS = 'promptGroups',\n /**\n * Collection for Shared Links\n */\n SHARED_LINKS = 'sharedLinks',\n}\n\n/**\n * Enum for time intervals\n */\nexport enum Time {\n ONE_HOUR = 3600000,\n THIRTY_MINUTES = 1800000,\n TEN_MINUTES = 600000,\n FIVE_MINUTES = 300000,\n TWO_MINUTES = 120000,\n ONE_MINUTE = 60000,\n THIRTY_SECONDS = 30000,\n}\n\n/**\n * Enum for cache keys.\n */\nexport enum CacheKeys {\n /**\n * Key for the config store namespace.\n */\n CONFIG_STORE = 'configStore',\n /**\n * Key for the config store namespace.\n */\n ROLES = 'roles',\n /**\n * Key for the plugins cache.\n */\n PLUGINS = 'plugins',\n /**\n * Key for the title generation cache.\n */\n GEN_TITLE = 'genTitle',\n /**\n /**\n * Key for the tools cache.\n */\n TOOLS = 'tools',\n /**\n * Key for the model config cache.\n */\n MODELS_CONFIG = 'modelsConfig',\n /**\n * Key for the model queries cache.\n */\n MODEL_QUERIES = 'modelQueries',\n /**\n * Key for the default startup config cache.\n */\n STARTUP_CONFIG = 'startupConfig',\n /**\n * Key for the default endpoint config cache.\n */\n ENDPOINT_CONFIG = 'endpointsConfig',\n /**\n * Key for accessing the model token config cache.\n */\n TOKEN_CONFIG = 'tokenConfig',\n /**\n * Key for the custom config cache.\n */\n CUSTOM_CONFIG = 'customConfig',\n /**\n * Key for accessing Abort Keys\n */\n ABORT_KEYS = 'abortKeys',\n /**\n * Key for the override config cache.\n */\n OVERRIDE_CONFIG = 'overrideConfig',\n /**\n * Key for the bans cache.\n */\n BANS = 'bans',\n /**\n * Key for the encoded domains cache.\n * Used by Azure OpenAI Assistants.\n */\n ENCODED_DOMAINS = 'encoded_domains',\n /**\n * Key for the cached audio run Ids.\n */\n AUDIO_RUNS = 'audioRuns',\n /**\n * Key for in-progress messages.\n */\n MESSAGES = 'messages',\n /**\n * Key for in-progress flow states.\n */\n FLOWS = 'flows',\n /**\n * Key for pending chat requests (concurrency check)\n */\n PENDING_REQ = 'pending_req',\n /**\n * Key for s3 check intervals per user\n */\n S3_EXPIRY_INTERVAL = 'S3_EXPIRY_INTERVAL',\n}\n\n/**\n * Enum for violation types, used to identify, log, and cache violations.\n */\nexport enum ViolationTypes {\n /**\n * File Upload Violations (exceeding limit).\n */\n FILE_UPLOAD_LIMIT = 'file_upload_limit',\n /**\n * Illegal Model Request (not available).\n */\n ILLEGAL_MODEL_REQUEST = 'illegal_model_request',\n /**\n * Token Limit Violation.\n */\n TOKEN_BALANCE = 'token_balance',\n /**\n * An issued ban.\n */\n BAN = 'ban',\n /**\n * TTS Request Limit Violation.\n */\n TTS_LIMIT = 'tts_limit',\n /**\n * STT Request Limit Violation.\n */\n STT_LIMIT = 'stt_limit',\n /**\n * Reset Password Limit Violation.\n */\n RESET_PASSWORD_LIMIT = 'reset_password_limit',\n /**\n * Verify Email Limit Violation.\n */\n VERIFY_EMAIL_LIMIT = 'verify_email_limit',\n /**\n * Verify Conversation Access violation.\n */\n CONVO_ACCESS = 'convo_access',\n /**\n * Tool Call Limit Violation.\n */\n TOOL_CALL_LIMIT = 'tool_call_limit',\n}\n\n/**\n * Enum for error message types that are not \"violations\" as above, used to identify client-facing errors.\n */\nexport enum ErrorTypes {\n /**\n * No User-provided Key.\n */\n NO_USER_KEY = 'no_user_key',\n /**\n * Expired User-provided Key.\n */\n EXPIRED_USER_KEY = 'expired_user_key',\n /**\n * Invalid User-provided Key.\n */\n INVALID_USER_KEY = 'invalid_user_key',\n /**\n * No Base URL Provided.\n */\n NO_BASE_URL = 'no_base_url',\n /**\n * Moderation error\n */\n MODERATION = 'moderation',\n /**\n * Prompt exceeds max length\n */\n INPUT_LENGTH = 'INPUT_LENGTH',\n /**\n * Invalid request error, API rejected request\n */\n INVALID_REQUEST = 'invalid_request_error',\n /**\n * Invalid action request error, likely not on list of allowed domains\n */\n INVALID_ACTION = 'invalid_action_error',\n /**\n * Invalid request error, API rejected request\n */\n NO_SYSTEM_MESSAGES = 'no_system_messages',\n /**\n * Google provider returned an error\n */\n GOOGLE_ERROR = 'google_error',\n /**\n * Invalid Agent Provider (excluded by Admin)\n */\n INVALID_AGENT_PROVIDER = 'invalid_agent_provider',\n}\n\n/**\n * Enum for authentication keys.\n */\nexport enum AuthKeys {\n /**\n * Key for the Service Account to use Vertex AI.\n */\n GOOGLE_SERVICE_KEY = 'GOOGLE_SERVICE_KEY',\n /**\n * API key to use Google Generative AI.\n *\n * Note: this is not for Environment Variables, but to access encrypted object values.\n */\n GOOGLE_API_KEY = 'GOOGLE_API_KEY',\n}\n\n/**\n * Enum for Image Detail Cost.\n *\n * **Low Res Fixed Cost:** `85`\n *\n * **High Res Calculation:**\n *\n * Number of `512px` Tiles * `170` + `85` (Additional Cost)\n */\nexport enum ImageDetailCost {\n /**\n * Low resolution is a fixed value.\n */\n LOW = 85,\n /**\n * High resolution Cost Per Tile\n */\n HIGH = 170,\n /**\n * Additional Cost added to High Resolution Total Cost\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n ADDITIONAL = 85,\n}\n\n/**\n * Tab values for Settings Dialog\n */\nexport enum SettingsTabValues {\n /**\n * Tab for General Settings\n */\n GENERAL = 'general',\n /**\n * Tab for Chat Settings\n */\n CHAT = 'chat',\n /**\n * Tab for Speech Settings\n */\n SPEECH = 'speech',\n /**\n * Tab for Beta Features\n */\n BETA = 'beta',\n /**\n * Tab for Data Controls\n */\n DATA = 'data',\n /**\n * Tab for Account Settings\n */\n ACCOUNT = 'account',\n /**\n * Chat input commands\n */\n COMMANDS = 'commands',\n}\n\nexport enum STTProviders {\n /**\n * Provider for OpenAI STT\n */\n OPENAI = 'openai',\n /**\n * Provider for Microsoft Azure STT\n */\n AZURE_OPENAI = 'azureOpenAI',\n}\n\nexport enum TTSProviders {\n /**\n * Provider for OpenAI TTS\n */\n OPENAI = 'openai',\n /**\n * Provider for Microsoft Azure OpenAI TTS\n */\n AZURE_OPENAI = 'azureOpenAI',\n /**\n * Provider for ElevenLabs TTS\n */\n ELEVENLABS = 'elevenlabs',\n /**\n * Provider for LocalAI TTS\n */\n LOCALAI = 'localai',\n}\n\n/** Enum for app-wide constants */\nexport enum Constants {\n /** Key for the app's version. */\n VERSION = 'v0.7.8',\n /** Key for the Custom Config's version (librechat.yaml). */\n CONFIG_VERSION = '1.2.5',\n /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */\n NO_PARENT = '00000000-0000-0000-0000-000000000000',\n /** Standard value for the initial conversationId before a request is sent */\n NEW_CONVO = 'new',\n /** Standard value for the temporary conversationId after a request is sent and before the server responds */\n PENDING_CONVO = 'PENDING',\n /** Standard value for the conversationId used for search queries */\n SEARCH = 'search',\n /** Fixed, encoded domain length for Azure OpenAI Assistants Function name parsing. */\n ENCODED_DOMAIN_LENGTH = 10,\n /** Identifier for using current_model in multi-model requests. */\n CURRENT_MODEL = 'current_model',\n /** Common divider for text values */\n COMMON_DIVIDER = '__',\n /** Max length for commands */\n COMMANDS_MAX_LENGTH = 56,\n /** Default Stream Rate (ms) */\n DEFAULT_STREAM_RATE = 1,\n /** Saved Tag */\n SAVED_TAG = 'Saved',\n /** Max number of Conversation starters for Agents/Assistants */\n MAX_CONVO_STARTERS = 4,\n /** Global/instance Project Name */\n GLOBAL_PROJECT_NAME = 'instance',\n /** Delimiter for MCP tools */\n mcp_delimiter = '_mcp_',\n /** Placeholder Agent ID for Ephemeral Agents */\n EPHEMERAL_AGENT_ID = 'ephemeral',\n}\n\nexport enum LocalStorageKeys {\n /** Key for the admin defined App Title */\n APP_TITLE = 'appTitle',\n /** Key for the last conversation setup. */\n LAST_CONVO_SETUP = 'lastConversationSetup',\n /** Key for the last selected model. */\n LAST_MODEL = 'lastSelectedModel',\n /** Key for the last selected tools. */\n LAST_TOOLS = 'lastSelectedTools',\n /** Key for the last selected spec by name*/\n LAST_SPEC = 'lastSelectedSpec',\n /** Key for temporary files to delete */\n FILES_TO_DELETE = 'filesToDelete',\n /** Prefix key for the last selected assistant ID by index */\n ASST_ID_PREFIX = 'assistant_id__',\n /** Prefix key for the last selected agent ID by index */\n AGENT_ID_PREFIX = 'agent_id__',\n /** Key for the last selected fork setting */\n FORK_SETTING = 'forkSetting',\n /** Key for remembering the last selected option, instead of manually selecting */\n REMEMBER_FORK_OPTION = 'rememberDefaultFork',\n /** Key for remembering the split at target fork option modifier */\n FORK_SPLIT_AT_TARGET = 'splitAtTarget',\n /** Key for saving text drafts */\n TEXT_DRAFT = 'textDraft_',\n /** Key for saving file drafts */\n FILES_DRAFT = 'filesDraft_',\n /** Key for last Selected Prompt Category */\n LAST_PROMPT_CATEGORY = 'lastPromptCategory',\n /** Key for rendering User Messages as Markdown */\n ENABLE_USER_MSG_MARKDOWN = 'enableUserMsgMarkdown',\n /** Key for displaying analysis tool code input */\n SHOW_ANALYSIS_CODE = 'showAnalysisCode',\n /** Last selected MCP values per conversation ID */\n LAST_MCP_ = 'LAST_MCP_',\n /** Last checked toggle for Code Interpreter API per conversation ID */\n LAST_CODE_TOGGLE_ = 'LAST_CODE_TOGGLE_',\n}\n\nexport enum ForkOptions {\n /** Key for direct path option */\n DIRECT_PATH = 'directPath',\n /** Key for including branches */\n INCLUDE_BRANCHES = 'includeBranches',\n /** Key for target level fork (default) */\n TARGET_LEVEL = 'targetLevel',\n /** Default option */\n DEFAULT = 'default',\n}\n\n/**\n * Enum for Cohere related constants\n */\nexport enum CohereConstants {\n /**\n * Cohere API Endpoint, for special handling\n */\n API_URL = 'https://api.cohere.ai/v1',\n /**\n * Role for \"USER\" messages\n */\n ROLE_USER = 'USER',\n /**\n * Role for \"SYSTEM\" messages\n */\n ROLE_SYSTEM = 'SYSTEM',\n /**\n * Role for \"CHATBOT\" messages\n */\n ROLE_CHATBOT = 'CHATBOT',\n /**\n * Title message as required by Cohere\n */\n TITLE_MESSAGE = 'TITLE:',\n}\n\nexport enum SystemCategories {\n ALL = 'sys__all__sys',\n MY_PROMPTS = 'sys__my__prompts__sys',\n NO_CATEGORY = 'sys__no__category__sys',\n SHARED_PROMPTS = 'sys__shared__prompts__sys',\n}\n\nexport const providerEndpointMap = {\n [EModelEndpoint.openAI]: EModelEndpoint.openAI,\n [EModelEndpoint.bedrock]: EModelEndpoint.bedrock,\n [EModelEndpoint.anthropic]: EModelEndpoint.anthropic,\n [EModelEndpoint.azureOpenAI]: EModelEndpoint.azureOpenAI,\n};\n\nexport const specialVariables = {\n current_date: true,\n current_user: true,\n iso_datetime: true,\n current_datetime: true,\n};\n\nexport type TSpecialVarLabel = `com_ui_special_var_${keyof typeof specialVariables}`;\n","import type { AssistantsEndpoint } from './schemas';\nimport * as q from './types/queries';\n\n// Testing this buildQuery function\nconst buildQuery = (params: Record<string, unknown>): string => {\n const query = Object.entries(params)\n .filter(([, value]) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return value !== undefined && value !== null && value !== '';\n })\n .map(([key, value]) => {\n if (Array.isArray(value)) {\n return value.map((v) => `${key}=${encodeURIComponent(v)}`).join('&');\n }\n return `${key}=${encodeURIComponent(String(value))}`;\n })\n .join('&');\n return query ? `?${query}` : '';\n};\n\nexport const health = () => '/health';\nexport const user = () => '/api/user';\n\nexport const balance = () => '/api/balance';\n\nexport const userPlugins = () => '/api/user/plugins';\n\nexport const deleteUser = () => '/api/user/delete';\n\nexport const messages = (params: q.MessagesListParams) => {\n const { conversationId, messageId, ...rest } = params;\n\n if (conversationId && messageId) {\n return `/api/messages/${conversationId}/${messageId}`;\n }\n\n if (conversationId) {\n return `/api/messages/${conversationId}`;\n }\n\n return `/api/messages${buildQuery(rest)}`;\n};\n\nconst shareRoot = '/api/share';\nexport const shareMessages = (shareId: string) => `${shareRoot}/${shareId}`;\nexport const getSharedLink = (conversationId: string) => `${shareRoot}/link/${conversationId}`;\nexport const getSharedLinks = (\n pageSize: number,\n isPublic: boolean,\n sortBy: 'title' | 'createdAt',\n sortDirection: 'asc' | 'desc',\n search?: string,\n cursor?: string,\n) =>\n `${shareRoot}?pageSize=${pageSize}&isPublic=${isPublic}&sortBy=${sortBy}&sortDirection=${sortDirection}${\n search ? `&search=${search}` : ''\n }${cursor ? `&cursor=${cursor}` : ''}`;\nexport const createSharedLink = (conversationId: string) => `${shareRoot}/${conversationId}`;\nexport const updateSharedLink = (shareId: string) => `${shareRoot}/${shareId}`;\n\nconst keysEndpoint = '/api/keys';\n\nexport const keys = () => keysEndpoint;\n\nexport const userKeyQuery = (name: string) => `${keysEndpoint}?name=${name}`;\n\nexport const revokeUserKey = (name: string) => `${keysEndpoint}/${name}`;\n\nexport const revokeAllUserKeys = () => `${keysEndpoint}?all=true`;\n\nexport const abortRequest = (endpoint: string) => `/api/ask/${endpoint}/abort`;\n\nexport const conversationsRoot = '/api/convos';\n\nexport const conversations = (params: q.ConversationListParams) => {\n return `${conversationsRoot}${buildQuery(params)}`;\n};\n\nexport const conversationById = (id: string) => `${conversationsRoot}/${id}`;\n\nexport const genTitle = () => `${conversationsRoot}/gen_title`;\n\nexport const updateConversation = () => `${conversationsRoot}/update`;\n\nexport const deleteConversation = () => `${conversationsRoot}`;\n\nexport const deleteAllConversation = () => `${conversationsRoot}/all`;\n\nexport const importConversation = () => `${conversationsRoot}/import`;\n\nexport const forkConversation = () => `${conversationsRoot}/fork`;\n\nexport const duplicateConversation = () => `${conversationsRoot}/duplicate`;\n\nexport const search = (q: string, cursor?: string | null) =>\n `/api/search?q=${q}${cursor ? `&cursor=${cursor}` : ''}`;\n\nexport const searchEnabled = () => '/api/search/enable';\n\nexport const presets = () => '/api/presets';\n\nexport const deletePreset = () => '/api/presets/delete';\n\nexport const aiEndpoints = () => '/api/endpoints';\n\nexport const endpointsConfigOverride = () => '/api/endpoints/config/override';\n\nexport const models = () => '/api/models';\n\nexport const tokenizer = () => '/api/tokenizer';\n\nexport const login = () => '/api/auth/login';\n\nexport const logout = () => '/api/auth/logout';\n\nexport const register = () => '/api/auth/register';\n\nexport const loginFacebook = () => '/api/auth/facebook';\n\nexport const loginGoogle = () => '/api/auth/google';\n\nexport const refreshToken = (retry?: boolean) =>\n `/api/auth/refresh${retry === true ? '?retry=true' : ''}`;\n\nexport const requestPasswordReset = () => '/api/auth/requestPasswordReset';\n\nexport const resetPassword = () => '/api/auth/resetPassword';\n\nexport const verifyEmail = () => '/api/user/verify';\n\nexport const resendVerificationEmail = () => '/api/user/verify/resend';\n\nexport const plugins = () => '/api/plugins';\n\nexport const config = () => '/api/config';\n\nexport const prompts = () => '/api/prompts';\n\nexport const assistants = ({\n path = '',\n options,\n version,\n endpoint,\n isAvatar,\n}: {\n path?: string;\n options?: object;\n endpoint?: AssistantsEndpoint;\n version: number | string;\n isAvatar?: boolean;\n}) => {\n let url = isAvatar === true ? `${images()}/assistants` : `/api/assistants/v${version}`;\n\n if (path && path !== '') {\n url += `/${path}`;\n }\n\n if (endpoint) {\n options = {\n ...(options ?? {}),\n endpoint,\n };\n }\n\n if (options && Object.keys(options).length > 0) {\n const queryParams = new URLSearchParams(options as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n\n return url;\n};\n\nexport const agents = ({ path = '', options }: { path?: string; options?: object }) => {\n let url = '/api/agents';\n\n if (path && path !== '') {\n url += `/${path}`;\n }\n\n if (options && Object.keys(options).length > 0) {\n const queryParams = new URLSearchParams(options as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n\n return url;\n};\n\nexport const files = () => '/api/files';\n\nexport const images = () => `${files()}/images`;\n\nexport const avatar = () => `${images()}/avatar`;\n\nexport const speech = () => `${files()}/speech`;\n\nexport const speechToText = () => `${speech()}/stt`;\n\nexport const textToSpeech = () => `${speech()}/tts`;\n\nexport const textToSpeechManual = () => `${textToSpeech()}/manual`;\n\nexport const textToSpeechVoices = () => `${textToSpeech()}/voices`;\n\nexport const getCustomConfigSpeech = () => `${speech()}/config/get`;\n\nexport const getPromptGroup = (_id: string) => `${prompts()}/groups/${_id}`;\n\nexport const getPromptGroupsWithFilters = (filter: object) => {\n let url = `${prompts()}/groups`;\n if (Object.keys(filter).length > 0) {\n const queryParams = new URLSearchParams(filter as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n return url;\n};\n\nexport const getPromptsWithFilters = (filter: object) => {\n let url = prompts();\n if (Object.keys(filter).length > 0) {\n const queryParams = new URLSearchParams(filter as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n return url;\n};\n\nexport const getPrompt = (_id: string) => `${prompts()}/${_id}`;\n\nexport const getRandomPrompts = (limit: number, skip: number) =>\n `${prompts()}/random?limit=${limit}&skip=${skip}`;\n\nexport const postPrompt = prompts;\n\nexport const updatePromptGroup = getPromptGroup;\n\nexport const updatePromptLabels = (_id: string) => `${getPrompt(_id)}/labels`;\n\nexport const updatePromptTag = (_id: string) => `${getPrompt(_id)}/tags/production`;\n\nexport const deletePromptGroup = getPromptGroup;\n\nexport const deletePrompt = ({ _id, groupId }: { _id: string; groupId: string }) => {\n return `${prompts()}/${_id}?groupId=${groupId}`;\n};\n\nexport const getCategories = () => '/api/categories';\n\nexport const getAllPromptGroups = () => `${prompts()}/all`;\n\n/* Roles */\nexport const roles = () => '/api/roles';\nexport const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;\nexport const updatePromptPermissions = (roleName: string) => `${getRole(roleName)}/prompts`;\nexport const updateAgentPermissions = (roleName: string) => `${getRole(roleName)}/agents`;\n\n/* Conversation Tags */\nexport const conversationTags = (tag?: string) =>\n `/api/tags${tag != null && tag ? `/${encodeURIComponent(tag)}` : ''}`;\n\nexport const conversationTagsList = (pageNumber: string, sort?: string, order?: string) =>\n `${conversationTags()}/list?pageNumber=${pageNumber}${sort ? `&sort=${sort}` : ''}${\n order ? `&order=${order}` : ''\n }`;\n\nexport const addTagToConversation = (conversationId: string) =>\n `${conversationTags()}/convo/${conversationId}`;\n\nexport const userTerms = () => '/api/user/terms';\nexport const acceptUserTerms = () => '/api/user/terms/accept';\nexport const banner = () => '/api/banner';\n\n// Two-Factor Endpoints\nexport const enableTwoFactor = () => '/api/auth/2fa/enable';\nexport const verifyTwoFactor = () => '/api/auth/2fa/verify';\nexport const confirmTwoFactor = () => '/api/auth/2fa/confirm';\nexport const disableTwoFactor = () => '/api/auth/2fa/disable';\nexport const regenerateBackupCodes = () => '/api/auth/2fa/backup/regenerate';\nexport const verifyTwoFactorTemp = () => '/api/auth/2fa/verify-temp';\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport axios, { AxiosError, AxiosRequestConfig } from 'axios';\nimport * as endpoints from './api-endpoints';\nimport { setTokenHeader } from './headers-helpers';\nimport type * as t from './types';\n\nasync function _get<T>(url: string, options?: AxiosRequestConfig): Promise<T> {\n const response = await axios.get(url, { ...options });\n return response.data;\n}\n\nasync function _getResponse<T>(url: string, options?: AxiosRequestConfig): Promise<T> {\n return await axios.get(url, { ...options });\n}\n\nasync function _post(url: string, data?: any) {\n const response = await axios.post(url, JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json' },\n });\n return response.data;\n}\n\nasync function _postMultiPart(url: string, formData: FormData, options?: AxiosRequestConfig) {\n const response = await axios.post(url, formData, {\n ...options,\n headers: { 'Content-Type': 'multipart/form-data' },\n });\n return response.data;\n}\n\nasync function _postTTS(url: string, formData: FormData, options?: AxiosRequestConfig) {\n const response = await axios.post(url, formData, {\n ...options,\n headers: { 'Content-Type': 'multipart/form-data' },\n responseType: 'arraybuffer',\n });\n return response.data;\n}\n\nasync function _put(url: string, data?: any) {\n const response = await axios.put(url, JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json' },\n });\n return response.data;\n}\n\nasync function _delete<T>(url: string): Promise<T> {\n const response = await axios.delete(url);\n return response.data;\n}\n\nasync function _deleteWithOptions<T>(url: string, options?: AxiosRequestConfig): Promise<T> {\n const response = await axios.delete(url, { ...options });\n return response.data;\n}\n\nasync function _patch(url: string, data?: any) {\n const response = await axios.patch(url, JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json' },\n });\n return response.data;\n}\n\nlet isRefreshing = false;\nlet failedQueue: { resolve: (value?: any) => void; reject: (reason?: any) => void }[] = [];\n\nconst refreshToken = (retry?: boolean): Promise<t.TRefreshTokenResponse | undefined> =>\n _post(endpoints.refreshToken(retry));\n\nconst dispatchTokenUpdatedEvent = (token: string) => {\n setTokenHeader(token);\n window.dispatchEvent(new CustomEvent('tokenUpdated', { detail: token }));\n};\n\nconst processQueue = (error: AxiosError | null, token: string | null = null) => {\n failedQueue.forEach((prom) => {\n if (error) {\n prom.reject(error);\n } else {\n prom.resolve(token);\n }\n });\n failedQueue = [];\n};\n\naxios.interceptors.response.use(\n (response) => response,\n async (error) => {\n const originalRequest = error.config;\n if (!error.response) {\n return Promise.reject(error);\n }\n\n if (originalRequest.url?.includes('/api/auth/2fa') === true) {\n return Promise.reject(error);\n }\n if (originalRequest.url?.includes('/api/auth/logout') === true) {\n return Promise.reject(error);\n }\n\n if (error.response.status === 401 && !originalRequest._retry) {\n console.warn('401 error, refreshing token');\n originalRequest._retry = true;\n\n if (isRefreshing) {\n try {\n const token = await new Promise((resolve, reject) => {\n failedQueue.push({ resolve, reject });\n });\n originalRequest.headers['Authorization'] = 'Bearer ' + token;\n return await axios(originalRequest);\n } catch (err) {\n return Promise.reject(err);\n }\n }\n\n isRefreshing = true;\n\n try {\n const response = await refreshToken(\n // Handle edge case where we get a blank screen if the initial 401 error is from a refresh token request\n originalRequest.url?.includes('api/auth/refresh') === true ? true : false,\n );\n\n const token = response?.token ?? '';\n\n if (token) {\n originalRequest.headers['Authorization'] = 'Bearer ' + token;\n dispatchTokenUpdatedEvent(token);\n processQueue(null, token);\n return await axios(originalRequest);\n } else if (window.location.href.includes('share/')) {\n console.log(\n `Refresh token failed from shared link, attempting request to ${originalRequest.url}`,\n );\n } else {\n window.location.href = '/login';\n }\n } catch (err) {\n processQueue(err as AxiosError, null);\n return Promise.reject(err);\n } finally {\n isRefreshing = false;\n }\n }\n\n return Promise.reject(error);\n },\n);\n\nexport default {\n get: _get,\n getResponse: _getResponse,\n post: _post,\n postMultiPart: _postMultiPart,\n postTTS: _postTTS,\n put: _put,\n delete: _delete,\n deleteWithOptions: _deleteWithOptions,\n patch: _patch,\n refreshToken,\n dispatchTokenUpdatedEvent,\n};\n","import axios from 'axios';\n\nexport function setAcceptLanguageHeader(value: string): void {\n axios.defaults.headers.common['Accept-Language'] = value;\n}\n\nexport function setTokenHeader(token: string) {\n axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;\n}\n","import type { AxiosResponse } from 'axios';\nimport type * as t from './types';\nimport * as endpoints from './api-endpoints';\nimport * as a from './types/assistants';\nimport * as m from './types/mutations';\nimport * as q from './types/queries';\nimport * as f from './types/files';\nimport * as config from './config';\nimport request from './request';\nimport * as s from './schemas';\nimport * as r from './roles';\n\nexport function abortRequestWithMessage(\n endpoint: string,\n abortKey: string,\n message: string,\n): Promise<void> {\n return request.post(endpoints.abortRequest(endpoint), { arg: { abortKey, message } });\n}\n\nexport function revokeUserKey(name: string): Promise<unknown> {\n return request.delete(endpoints.revokeUserKey(name));\n}\n\nexport function revokeAllUserKeys(): Promise<unknown> {\n return request.delete(endpoints.revokeAllUserKeys());\n}\n\nexport function deleteUser(): Promise<s.TPreset> {\n return request.delete(endpoints.deleteUser());\n}\n\nexport function getSharedMessages(shareId: string): Promise<t.TSharedMessagesResponse> {\n return request.get(endpoints.shareMessages(shareId));\n}\n\nexport const listSharedLinks = async (\n params: q.SharedLinksListParams,\n): Promise<q.SharedLinksResponse> => {\n const { pageSize, isPublic, sortBy, sortDirection, search, cursor } = params;\n\n return request.get(\n endpoints.getSharedLinks(pageSize, isPublic, sortBy, sortDirection, search, cursor),\n );\n};\n\nexport function getSharedLink(conversationId: string): Promise<t.TSharedLinkGetResponse> {\n return request.get(endpoints.getSharedLink(conversationId));\n}\n\nexport function createSharedLink(conversationId: string): Promise<t.TSharedLinkResponse> {\n return request.post(endpoints.createSharedLink(conversationId));\n}\n\nexport function updateSharedLink(shareId: string): Promise<t.TSharedLinkResponse> {\n return request.patch(endpoints.updateSharedLink(shareId));\n}\n\nexport function deleteSharedLink(shareId: string): Promise<m.TDeleteSharedLinkResponse> {\n return request.delete(endpoints.shareMessages(shareId));\n}\n\nexport function updateUserKey(payload: t.TUpdateUserKeyRequest) {\n const { value } = payload;\n if (!value) {\n throw new Error('value is required');\n }\n\n return request.put(endpoints.keys(), payload);\n}\n\nexport function getPresets(): Promise<s.TPreset[]> {\n return request.get(endpoints.presets());\n}\n\nexport function createPreset(payload: s.TPreset): Promise<s.TPreset> {\n return request.post(endpoints.presets(), payload);\n}\n\nexport function updatePreset(payload: s.TPreset): Promise<s.TPreset> {\n return request.post(endpoints.presets(), payload);\n}\n\nexport function deletePreset(arg: s.TPreset | undefined): Promise<m.PresetDeleteResponse> {\n return request.post(endpoints.deletePreset(), arg);\n}\n\nexport function getSearchEnabled(): Promise<boolean> {\n return request.get(endpoints.searchEnabled());\n}\n\nexport function getUser(): Promise<t.TUser> {\n return request.get(endpoints.user());\n}\n\nexport function getUserBalance(): Promise<string> {\n return request.get(endpoints.balance());\n}\n\nexport const updateTokenCount = (text: string) => {\n return request.post(endpoints.tokenizer(), { arg: text });\n};\n\nexport const login = (payload: t.TLoginUser): Promise<t.TLoginResponse> => {\n return request.post(endpoints.login(), payload);\n};\n\nexport const logout = (): Promise<m.TLogoutResponse> => {\n return request.post(endpoints.logout());\n};\n\nexport const register = (payload: t.TRegisterUser) => {\n return request.post(endpoints.register(), payload);\n};\n\nexport const userKeyQuery = (name: string): Promise<t.TCheckUserKeyResponse> =>\n request.get(endpoints.userKeyQuery(name));\n\nexport const getLoginGoogle = () => {\n return request.get(endpoints.loginGoogle());\n};\n\nexport const requestPasswordReset = (\n payload: t.TRequestPasswordReset,\n): Promise<t.TRequestPasswordResetResponse> => {\n return request.post(endpoints.requestPasswordReset(), payload);\n};\n\nexport const resetPassword = (payload: t.TResetPassword) => {\n return request.post(endpoints.resetPassword(), payload);\n};\n\nexport const verifyEmail = (payload: t.TVerifyEmail): Promise<t.VerifyEmailResponse> => {\n return request.post(endpoints.verifyEmail(), payload);\n};\n\nexport const resendVerificationEmail = (\n payload: t.TResendVerificationEmail,\n): Promise<t.VerifyEmailResponse> => {\n return request.post(endpoints.resendVerificationEmail(), payload);\n};\n\nexport const getAvailablePlugins = (): Promise<s.TPlugin[]> => {\n return request.get(endpoints.plugins());\n};\n\nexport const updateUserPlugins = (payload: t.TUpdateUserPlugins) => {\n return request.post(endpoints.userPlugins(), payload);\n};\n\n/* Config */\n\nexport const getStartupConfig = (): Promise<config.TStartupConfig> => {\n return request.get(endpoints.config());\n};\n\nexport const getAIEndpoints = (): Promise<t.TEndpointsConfig> => {\n return request.get(endpoints.aiEndpoints());\n};\n\nexport const getModels = async (): Promise<t.TModelsConfig> => {\n return request.get(endpoints.models());\n};\n\nexport const getEndpointsConfigOverride = (): Promise<unknown | boolean> => {\n return request.get(endpoints.endpointsConfigOverride());\n};\n\n/* Assistants */\n\nexport const createAssistant = ({\n version,\n ...data\n}: a.AssistantCreateParams): Promise<a.Assistant> => {\n return request.post(endpoints.assistants({ version }), data);\n};\n\nexport const getAssistantById = ({\n endpoint,\n assistant_id,\n version,\n}: {\n endpoint: s.AssistantsEndpoint;\n assistant_id: string;\n version: number | string | number;\n}): Promise<a.Assistant> => {\n return request.get(\n endpoints.assistants({\n path: assistant_id,\n endpoint,\n version,\n }),\n );\n};\n\nexport const updateAssistant = ({\n assistant_id,\n data,\n version,\n}: {\n assistant_id: string;\n data: a.AssistantUpdateParams;\n version: number | string;\n}): Promise<a.Assistant> => {\n return request.patch(\n endpoints.assistants({\n path: assistant_id,\n version,\n }),\n data,\n );\n};\n\nexport const deleteAssistant = ({\n assistant_id,\n model,\n endpoint,\n version,\n}: m.DeleteAssistantBody & { version: number | string }): Promise<void> => {\n return request.delete(\n endpoints.assistants({\n path: assistant_id,\n options: { model, endpoint },\n version,\n }),\n );\n};\n\nexport const listAssistants = (\n params: a.AssistantListParams,\n version: number | string,\n): Promise<a.AssistantListResponse> => {\n return request.get(\n endpoints.assistants({\n version,\n options: params,\n }),\n );\n};\n\nexport function getAssistantDocs({\n endpoint,\n version,\n}: {\n endpoint: s.AssistantsEndpoint | string;\n version: number | string;\n}): Promise<a.AssistantDocument[]> {\n if (!s.isAssistantsEndpoint(endpoint)) {\n return Promise.resolve([]);\n }\n return request.get(\n endpoints.assistants({\n path: 'documents',\n version,\n options: { endpoint },\n endpoint: endpoint as s.AssistantsEndpoint,\n }),\n );\n}\n\n/* Tools */\n\nexport const getAvailableTools = (\n _endpoint: s.AssistantsEndpoint | s.EModelEndpoint.agents,\n version?: number | string,\n): Promise<s.TPlugin[]> => {\n let path = '';\n if (s.isAssistantsEndpoint(_endpoint)) {\n const endpoint = _endpoint as s.AssistantsEndpoint;\n path = endpoints.assistants({\n path: 'tools',\n endpoint: endpoint,\n version: version ?? config.defaultAssistantsVersion[endpoint],\n });\n } else {\n path = endpoints.agents({\n path: 'tools',\n });\n }\n\n return request.get(path);\n};\n\nexport const getVerifyAgentToolAuth = (\n params: q.VerifyToolAuthParams,\n): Promise<q.VerifyToolAuthResponse> => {\n return request.get(\n endpoints.agents({\n path: `tools/${params.toolId}/auth`,\n }),\n );\n};\n\nexport const callTool = <T extends m.ToolId>({\n toolId,\n toolParams,\n}: {\n toolId: T;\n toolParams: m.ToolParams<T>;\n}): Promise<m.ToolCallResponse> => {\n return request.post(\n endpoints.agents({\n path: `tools/${toolId}/call`,\n }),\n toolParams,\n );\n};\n\nexport const getToolCalls = (params: q.GetToolCallParams): Promise<q.ToolCallResults> => {\n return request.get(\n endpoints.agents({\n path: 'tools/calls',\n options: params,\n }),\n );\n};\n\n/* Files */\n\nexport const getFiles = (): Promise<f.TFile[]> => {\n return request.get(endpoints.files());\n};\n\nexport const getFileConfig = (): Promise<f.FileConfig> => {\n return request.get(`${endpoints.files()}/config`);\n};\n\nexport const uploadImage = (\n data: FormData,\n signal?: AbortSignal | null,\n): Promise<f.TFileUpload> => {\n const requestConfig = signal ? { signal } : undefined;\n return request.postMultiPart(endpoints.images(), data, requestConfig);\n};\n\nexport const uploadFile = (data: FormData, signal?: AbortSignal | null): Promise<f.TFileUpload> => {\n const requestConfig = signal ? { signal } : undefined;\n return request.postMultiPart(endpoints.files(), data, requestConfig);\n};\n\n/* actions */\n\nexport const updateAction = (data: m.UpdateActionVariables): Promise<m.UpdateActionResponse> => {\n const { assistant_id, version, ...body } = data;\n return request.post(\n endpoints.assistants({\n path: `actions/${assistant_id}`,\n version,\n }),\n body,\n );\n};\n\nexport function getActions(): Promise<a.Action[]> {\n return request.get(\n endpoints.agents({\n path: 'actions',\n }),\n );\n}\n\nexport const deleteAction = async ({\n assistant_id,\n action_id,\n model,\n version,\n endpoint,\n}: m.DeleteActionVariables & { version: number | string }): Promise<void> =>\n request.delete(\n endpoints.assistants({\n path: `actions/${assistant_id}/${action_id}/${model}`,\n version,\n endpoint,\n }),\n );\n\n/**\n * Agents\n */\n\nexport const createAgent = ({ ...data }: a.AgentCreateParams): Promise<a.Agent> => {\n return request.post(endpoints.agents({}), data);\n};\n\nexport const getAgentById = ({ agent_id }: { agent_id: string }): Promise<a.Agent> => {\n return request.get(\n endpoints.agents({\n path: agent_id,\n }),\n );\n};\n\nexport const updateAgent = ({\n agent_id,\n data,\n}: {\n agent_id: string;\n data: a.AgentUpdateParams;\n}): Promise<a.Agent> => {\n return request.patch(\n endpoints.agents({\n path: agent_id,\n }),\n data,\n );\n};\n\nexport const duplicateAgent = ({\n agent_id,\n}: m.DuplicateAgentBody): Promise<{ agent: a.Agent; actions: a.Action[] }> => {\n return request.post(\n endpoints.agents({\n path: `${agent_id}/duplicate`,\n }),\n );\n};\n\nexport const deleteAgent = ({ agent_id }: m.DeleteAgentBody): Promise<void> => {\n return request.delete(\n endpoints.agents({\n path: agent_id,\n }),\n );\n};\n\nexport const listAgents = (params: a.AgentListParams): Promise<a.AgentListResponse> => {\n return request.get(\n endpoints.agents({\n options: params,\n }),\n );\n};\n\n/* Tools */\n\nexport const getAvailableAgentTools = (): Promise<s.TPlugin[]> => {\n return request.get(\n endpoints.agents({\n path: 'tools',\n }),\n );\n};\n\n/* Actions */\n\nexport const updateAgentAction = (\n data: m.UpdateAgentActionVariables,\n): Promise<m.UpdateAgentActionResponse> => {\n const { agent_id, ...body } = data;\n return request.post(\n endpoints.agents({\n path: `actions/${agent_id}`,\n }),\n body,\n );\n};\n\nexport const deleteAgentAction = async ({\n agent_id,\n action_id,\n}: m.DeleteAgentActionVariables): Promise<void> =>\n request.delete(\n endpoints.agents({\n path: `actions/${agent_id}/${action_id}`,\n }),\n );\n\n/**\n * Imports a conversations file.\n *\n * @param data - The FormData containing the file to import.\n * @returns A Promise that resolves to the import start response.\n */\nexport const importConversationsFile = (data: FormData): Promise<t.TImportResponse> => {\n return request.postMultiPart(endpoints.importConversation(), data);\n};\n\nexport const uploadAvatar = (data: FormData): Promise<f.AvatarUploadResponse> => {\n return request.postMultiPart(endpoints.avatar(), data);\n};\n\nexport const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise<a.Assistant> => {\n return request.postMultiPart(\n endpoints.assistants({\n isAvatar: true,\n path: `${data.assistant_id}/avatar`,\n options: { model: data.model, endpoint: data.endpoint },\n version: data.version,\n }),\n data.formData,\n );\n};\n\nexport const uploadAgentAvatar = (data: m.AgentAvatarVariables): Promise<a.Agent> => {\n return request.postMultiPart(\n `${endpoints.images()}/agents/${data.agent_id}/avatar`,\n data.formData,\n );\n};\n\nexport const getFileDownload = async (userId: string, file_id: string): Promise<AxiosResponse> => {\n return request.getResponse(`${endpoints.files()}/download/${userId}/${file_id}`, {\n responseType: 'blob',\n headers: {\n Accept: 'application/octet-stream',\n },\n });\n};\n\nexport const getCodeOutputDownload = async (url: string): Promise<AxiosResponse> => {\n return request.getResponse(url, {\n responseType: 'blob',\n headers: {\n Accept: 'application/octet-stream',\n },\n });\n};\n\nexport const deleteFiles = async (payload: {\n files: f.BatchFile[];\n agent_id?: string;\n assistant_id?: string;\n tool_resource?: a.EToolResources;\n}): Promise<f.DeleteFilesResponse> =>\n request.deleteWithOptions(endpoints.files(), {\n data: payload,\n });\n\n/* Speech */\n\nexport const speechToText = (data: FormData): Promise<f.SpeechToTextResponse> => {\n return request.postMultiPart(endpoints.speechToText(), data);\n};\n\nexport const textToSpeech = (data: FormData): Promise<ArrayBuffer> => {\n return request.postTTS(endpoints.textToSpeechManual(), data);\n};\n\nexport const getVoices = (): Promise<f.VoiceResponse> => {\n return request.get(endpoints.textToSpeechVoices());\n};\n\nexport const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse> => {\n return request.get(endpoints.getCustomConfigSpeech());\n};\n\n/* conversations */\n\nexport function duplicateConversation(\n payload: t.TDuplicateConvoRequest,\n): Promise<t.TDuplicateConvoResponse> {\n return request.post(endpoints.duplicateConversation(), payload);\n}\n\nexport function forkConversation(payload: t.TForkConvoRequest): Promise<t.TForkConvoResponse> {\n return request.post(endpoints.forkConversation(), payload);\n}\n\nexport function deleteConversation(payload: t.TDeleteConversationRequest) {\n return request.deleteWithOptions(endpoints.deleteConversation(), { data: { arg: payload } });\n}\n\nexport function clearAllConversations(): Promise<unknown> {\n return request.delete(endpoints.deleteAllConversation());\n}\n\nexport const listConversations = (\n params?: q.ConversationListParams,\n): Promise<q.ConversationListResponse> => {\n return request.get(endpoints.conversations(params ?? {}));\n};\n\nexport function getConversations(cursor: string): Promise<t.TGetConversationsResponse> {\n return request.get(endpoints.conversations({ cursor }));\n}\n\nexport function getConversationById(id: string): Promise<s.TConversation> {\n return request.get(endpoints.conversationById(id));\n}\n\nexport function updateConversation(\n payload: t.TUpdateConversationRequest,\n): Promise<t.TUpdateConversationResponse> {\n return request.post(endpoints.updateConversation(), { arg: payload });\n}\n\nexport function archiveConversation(\n payload: t.TArchiveConversationRequest,\n): Promise<t.TArchiveConversationResponse> {\n return request.post(endpoints.updateConversation(), { arg: payload });\n}\n\nexport function genTitle(payload: m.TGenTitleRequest): Promise<m.TGenTitleResponse> {\n return request.post(endpoints.genTitle(), payload);\n}\n\nexport const listMessages = (params?: q.MessagesListParams): Promise<q.MessagesListResponse> => {\n return request.get(endpoints.messages(params ?? {}));\n};\n\nexport function updateMessage(payload: t.TUpdateMessageRequest): Promise<unknown> {\n const { conversationId, messageId, text } = payload;\n if (!conversationId) {\n throw new Error('conversationId is required');\n }\n\n return request.put(endpoints.messages({ conversationId, messageId }), { text });\n}\n\nexport function updateMessageContent(payload: t.TUpdateMessageContent): Promise<unknown> {\n const { conversationId, messageId, index, text } = payload;\n if (!conversationId) {\n throw new Error('conversationId is required');\n }\n\n return request.put(endpoints.messages({ conversationId, messageId }), { text, index });\n}\n\nexport const editArtifact = async ({\n messageId,\n ...params\n}: m.TEditArtifactRequest): Promise<m.TEditArtifactResponse> => {\n return request.post(`/api/messages/artifact/${messageId}`, params);\n};\n\nexport function getMessagesByConvoId(conversationId: string): Promise<s.TMessage[]> {\n if (\n conversationId === config.Constants.NEW_CONVO ||\n conversationId === config.Constants.PENDING_CONVO\n ) {\n return Promise.resolve([]);\n }\n return request.get(endpoints.messages({ conversationId }));\n}\n\nexport function getPrompt(id: string): Promise<{ prompt: t.TPrompt }> {\n return request.get(endpoints.getPrompt(id));\n}\n\nexport function getPrompts(filter: t.TPromptsWithFilterRequest): Promise<t.TPrompt[]> {\n return request.get(endpoints.getPromptsWithFilters(filter));\n}\n\nexport function getAllPromptGroups(): Promise<q.AllPromptGroupsResponse> {\n return request.get(endpoints.getAllPromptGroups());\n}\n\nexport function getPromptGroups(\n filter: t.TPromptGroupsWithFilterRequest,\n): Promise<t.PromptGroupListResponse> {\n return request.get(endpoints.getPromptGroupsWithFilters(filter));\n}\n\nexport function getPromptGroup(id: string): Promise<t.TPromptGroup> {\n return request.get(endpoints.getPromptGroup(id));\n}\n\nexport function createPrompt(payload: t.TCreatePrompt): Promise<t.TCreatePromptResponse> {\n return request.post(endpoints.postPrompt(), payload);\n}\n\nexport function updatePromptGroup(\n variables: t.TUpdatePromptGroupVariables,\n): Promise<t.TUpdatePromptGroupResponse> {\n return request.patch(endpoints.updatePromptGroup(variables.id), variables.payload);\n}\n\nexport function deletePrompt(payload: t.TDeletePromptVariables): Promise<t.TDeletePromptResponse> {\n return request.delete(endpoints.deletePrompt(payload));\n}\n\nexport function makePromptProduction(id: string): Promise<t.TMakePromptProductionResponse> {\n return request.patch(endpoints.updatePromptTag(id));\n}\n\nexport function updatePromptLabels(\n variables: t.TUpdatePromptLabelsRequest,\n): Promise<t.TUpdatePromptLabelsResponse> {\n return request.patch(endpoints.updatePromptLabels(variables.id), variables.payload);\n}\n\nexport function deletePromptGroup(id: string): Promise<t.TDeletePromptGroupResponse> {\n return request.delete(endpoints.deletePromptGroup(id));\n}\n\nexport function getCategories(): Promise<t.TGetCategoriesResponse> {\n return request.get(endpoints.getCategories());\n}\n\nexport function getRandomPrompts(\n variables: t.TGetRandomPromptsRequest,\n): Promise<t.TGetRandomPromptsResponse> {\n return request.get(endpoints.getRandomPrompts(variables.limit, variables.skip));\n}\n\n/* Roles */\nexport function getRole(roleName: string): Promise<r.TRole> {\n return request.get(endpoints.getRole(roleName));\n}\n\nexport function updatePromptPermissions(\n variables: m.UpdatePromptPermVars,\n): Promise<m.UpdatePermResponse> {\n return request.put(endpoints.updatePromptPermissions(variables.roleName), variables.updates);\n}\n\nexport function updateAgentPermissions(\n variables: m.UpdateAgentPermVars,\n): Promise<m.UpdatePermResponse> {\n return request.put(endpoints.updateAgentPermissions(variables.roleName), variables.updates);\n}\n\n/* Tags */\nexport function getConversationTags(): Promise<t.TConversationTagsResponse> {\n return request.get(endpoints.conversationTags());\n}\n\nexport function createConversationTag(\n payload: t.TConversationTagRequest,\n): Promise<t.TConversationTagResponse> {\n return request.post(endpoints.conversationTags(), payload);\n}\n\nexport function updateConversationTag(\n tag: string,\n payload: t.TConversationTagRequest,\n): Promise<t.TConversationTagResponse> {\n return request.put(endpoints.conversationTags(tag), payload);\n}\nexport function deleteConversationTag(tag: string): Promise<t.TConversationTagResponse> {\n return request.delete(endpoints.conversationTags(tag));\n}\n\nexport function addTagToConversation(\n conversationId: string,\n payload: t.TTagConversationRequest,\n): Promise<t.TTagConversationResponse> {\n return request.put(endpoints.addTagToConversation(conversationId), payload);\n}\nexport function rebuildConversationTags(): Promise<t.TConversationTagsResponse> {\n return request.post(endpoints.conversationTags('rebuild'));\n}\n\nexport function healthCheck(): Promise<string> {\n return request.get(endpoints.health());\n}\n\nexport function getUserTerms(): Promise<t.TUserTermsResponse> {\n return request.get(endpoints.userTerms());\n}\n\nexport function acceptTerms(): Promise<t.TAcceptTermsResponse> {\n return request.post(endpoints.acceptUserTerms());\n}\n\nexport function getBanner(): Promise<t.TBannerResponse> {\n return request.get(endpoints.banner());\n}\n\nexport function enableTwoFactor(): Promise<t.TEnable2FAResponse> {\n return request.get(endpoints.enableTwoFactor());\n}\n\nexport function verifyTwoFactor(payload: t.TVerify2FARequest): Promise<t.TVerify2FAResponse> {\n return request.post(endpoints.verifyTwoFactor(), payload);\n}\n\nexport function confirmTwoFactor(payload: t.TVerify2FARequest): Promise<t.TVerify2FAResponse> {\n return request.post(endpoints.confirmTwoFactor(), payload);\n}\n\nexport function disableTwoFactor(): Promise<t.TDisable2FAResponse> {\n return request.post(endpoints.disableTwoFactor());\n}\n\nexport function regenerateBackupCodes(): Promise<t.TRegenerateBackupCodesResponse> {\n return request.post(endpoints.regenerateBackupCodes());\n}\n\nexport function verifyTwoFactorTemp(\n payload: t.TVerify2FATempRequest,\n): Promise<t.TVerify2FATempResponse> {\n return request.post(endpoints.verifyTwoFactorTemp(), payload);\n}\n","export enum QueryKeys {\n messages = 'messages',\n sharedMessages = 'sharedMessages',\n sharedLinks = 'sharedLinks',\n allConversations = 'allConversations',\n archivedConversations = 'archivedConversations',\n searchConversations = 'searchConversations',\n conversation = 'conversation',\n searchEnabled = 'searchEnabled',\n user = 'user',\n name = 'name', // user key name\n models = 'models',\n balance = 'balance',\n endpoints = 'endpoints',\n presets = 'presets',\n searchResults = 'searchResults',\n tokenCount = 'tokenCount',\n availablePlugins = 'availablePlugins',\n startupConfig = 'startupConfig',\n assistants = 'assistants',\n assistant = 'assistant',\n agents = 'agents',\n agent = 'agent',\n endpointsConfigOverride = 'endpointsConfigOverride',\n files = 'files',\n fileConfig = 'fileConfig',\n tools = 'tools',\n toolAuth = 'toolAuth',\n toolCalls = 'toolCalls',\n agentTools = 'agentTools',\n actions = 'actions',\n assistantDocs = 'assistantDocs',\n agentDocs = 'agentDocs',\n fileDownload = 'fileDownload',\n voices = 'voices',\n customConfigSpeech = 'customConfigSpeech',\n prompts = 'prompts',\n prompt = 'prompt',\n promptGroups = 'promptGroups',\n allPromptGroups = 'allPromptGroups',\n promptGroup = 'promptGroup',\n categories = 'categories',\n randomPrompts = 'randomPrompts',\n roles = 'roles',\n conversationTags = 'conversationTags',\n health = 'health',\n userTerms = 'userTerms',\n banner = 'banner',\n}\n\nexport enum MutationKeys {\n fileUpload = 'fileUpload',\n fileDelete = 'fileDelete',\n updatePreset = 'updatePreset',\n deletePreset = 'deletePreset',\n loginUser = 'loginUser',\n logoutUser = 'logoutUser',\n refreshToken = 'refreshToken',\n avatarUpload = 'avatarUpload',\n speechToText = 'speechToText',\n textToSpeech = 'textToSpeech',\n assistantAvatarUpload = 'assistantAvatarUpload',\n agentAvatarUpload = 'agentAvatarUpload',\n updateAction = 'updateAction',\n updateAgentAction = 'updateAgentAction',\n deleteAction = 'deleteAction',\n deleteAgentAction = 'deleteAgentAction',\n deleteUser = 'deleteUser',\n updateRole = 'updateRole',\n enableTwoFactor = 'enableTwoFactor',\n verifyTwoFactor = 'verifyTwoFactor',\n}\n","import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport type {\n UseQueryOptions,\n UseMutationResult,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport { Constants, initialModelsConfig } from '../config';\nimport { defaultOrderQuery } from '../types/assistants';\nimport * as dataService from '../data-service';\nimport * as m from '../types/mutations';\nimport { QueryKeys } from '../keys';\nimport * as s from '../schemas';\nimport * as t from '../types';\n\nexport const useAbortRequestWithMessage = (): UseMutationResult<\n void,\n Error,\n { endpoint: string; abortKey: string; message: string }\n> => {\n const queryClient = useQueryClient();\n return useMutation(\n ({ endpoint, abortKey, message }) =>\n dataService.abortRequestWithMessage(endpoint, abortKey, message),\n {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.balance]);\n },\n },\n );\n};\n\nexport const useGetSharedMessages = (\n shareId: string,\n config?: UseQueryOptions<t.TSharedMessagesResponse>,\n): QueryObserverResult<t.TSharedMessagesResponse> => {\n return useQuery<t.TSharedMessagesResponse>(\n [QueryKeys.sharedMessages, shareId],\n () => dataService.getSharedMessages(shareId),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n\nexport const useGetSharedLinkQuery = (\n conversationId: string,\n config?: UseQueryOptions<t.TSharedLinkGetResponse>,\n): QueryObserverResult<t.TSharedLinkGetResponse> => {\n const queryClient = useQueryClient();\n return useQuery<t.TSharedLinkGetResponse>(\n [QueryKeys.sharedLinks, conversationId],\n () => dataService.getSharedLink(conversationId),\n {\n enabled:\n !!conversationId &&\n conversationId !== Constants.NEW_CONVO &&\n conversationId !== Constants.PENDING_CONVO,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n onSuccess: (data) => {\n queryClient.setQueryData([QueryKeys.sharedLinks, conversationId], {\n conversationId: data.conversationId,\n shareId: data.shareId,\n });\n },\n ...config,\n },\n );\n};\n\nexport const useGetConversationByIdQuery = (\n id: string,\n config?: UseQueryOptions<s.TConversation>,\n): QueryObserverResult<s.TConversation> => {\n return useQuery<s.TConversation>(\n [QueryKeys.conversation, id],\n () => dataService.getConversationById(id),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n\n//This isn't ideal because its just a query and we're using mutation, but it was the only way\n//to make it work with how the Chat component is structured\nexport const useGetConversationByIdMutation = (id: string): UseMutationResult<s.TConversation> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.getConversationById(id), {\n // onSuccess: (res: s.TConversation) => {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.conversation, id]);\n },\n });\n};\n\nexport const useUpdateMessageMutation = (\n id: string,\n): UseMutationResult<unknown, unknown, t.TUpdateMessageRequest, unknown> => {\n const queryClient = useQueryClient();\n return useMutation((payload: t.TUpdateMessageRequest) => dataService.updateMessage(payload), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.messages, id]);\n },\n });\n};\n\nexport const useUpdateMessageContentMutation = (\n conversationId: string,\n): UseMutationResult<unknown, unknown, t.TUpdateMessageContent, unknown> => {\n const queryClient = useQueryClient();\n return useMutation(\n (payload: t.TUpdateMessageContent) => dataService.updateMessageContent(payload),\n {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.messages, conversationId]);\n },\n },\n );\n};\n\nexport const useUpdateUserKeysMutation = (): UseMutationResult<\n t.TUser,\n unknown,\n t.TUpdateUserKeyRequest,\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation((payload: t.TUpdateUserKeyRequest) => dataService.updateUserKey(payload), {\n onSuccess: (data, variables) => {\n queryClient.invalidateQueries([QueryKeys.name, variables.name]);\n },\n });\n};\n\nexport const useClearConversationsMutation = (): UseMutationResult<unknown> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.clearAllConversations(), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.allConversations]);\n },\n });\n};\n\nexport const useRevokeUserKeyMutation = (name: string): UseMutationResult<unknown> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.revokeUserKey(name), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.name, name]);\n if (s.isAssistantsEndpoint(name)) {\n queryClient.invalidateQueries([QueryKeys.assistants, name, defaultOrderQuery]);\n queryClient.invalidateQueries([QueryKeys.assistantDocs]);\n queryClient.invalidateQueries([QueryKeys.assistants]);\n queryClient.invalidateQueries([QueryKeys.assistant]);\n queryClient.invalidateQueries([QueryKeys.actions]);\n queryClient.invalidateQueries([QueryKeys.tools]);\n }\n },\n });\n};\n\nexport const useRevokeAllUserKeysMutation = (): UseMutationResult<unknown> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.revokeAllUserKeys(), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.name]);\n queryClient.invalidateQueries([\n QueryKeys.assistants,\n s.EModelEndpoint.assistants,\n defaultOrderQuery,\n ]);\n queryClient.invalidateQueries([\n QueryKeys.assistants,\n s.EModelEndpoint.azureAssistants,\n defaultOrderQuery,\n ]);\n queryClient.invalidateQueries([QueryKeys.assistantDocs]);\n queryClient.invalidateQueries([QueryKeys.assistants]);\n queryClient.invalidateQueries([QueryKeys.assistant]);\n queryClient.invalidateQueries([QueryKeys.actions]);\n queryClient.invalidateQueries([QueryKeys.tools]);\n },\n });\n};\n\nexport const useGetModelsQuery = (\n config?: UseQueryOptions<t.TModelsConfig>,\n): QueryObserverResult<t.TModelsConfig> => {\n return useQuery<t.TModelsConfig>([QueryKeys.models], () => dataService.getModels(), {\n initialData: initialModelsConfig,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n staleTime: Infinity,\n ...config,\n });\n};\n\nexport const useCreatePresetMutation = (): UseMutationResult<\n s.TPreset,\n unknown,\n s.TPreset,\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation((payload: s.TPreset) => dataService.createPreset(payload), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.presets]);\n },\n });\n};\n\nexport const useDeletePresetMutation = (): UseMutationResult<\n m.PresetDeleteResponse,\n unknown,\n s.TPreset | undefined,\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation((payload: s.TPreset | undefined) => dataService.deletePreset(payload), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.presets]);\n },\n });\n};\n\nexport const useUpdateTokenCountMutation = (): UseMutationResult<\n t.TUpdateTokenCountResponse,\n unknown,\n { text: string },\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation(({ text }: { text: string }) => dataService.updateTokenCount(text), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.tokenCount]);\n },\n });\n};\n\nexport const useRegisterUserMutation = (\n options?: m.RegistrationOptions,\n): UseMutationResult<t.TError, unknown, t.TRegisterUser, unknown> => {\n const queryClient = useQueryClient();\n return useMutation<t.TRegisterUserResponse, t.TError, t.TRegisterUser>(\n (payload: t.TRegisterUser) => dataService.register(payload),\n {\n ...options,\n onSuccess: (...args) => {\n queryClient.invalidateQueries([QueryKeys.user]);\n if (options?.onSuccess) {\n options.onSuccess(...args);\n }\n },\n },\n );\n};\n\nexport const useUserKeyQuery = (\n name: string,\n config?: UseQueryOptions<t.TCheckUserKeyResponse>,\n): QueryObserverResult<t.TCheckUserKeyResponse> => {\n return useQuery<t.TCheckUserKeyResponse>(\n [QueryKeys.name, name],\n () => {\n if (!name) {\n return Promise.resolve({ expiresAt: '' });\n }\n return dataService.userKeyQuery(name);\n },\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n retry: false,\n ...config,\n },\n );\n};\n\nexport const useRequestPasswordResetMutation = (): UseMutationResult<\n t.TRequestPasswordResetResponse,\n unknown,\n t.TRequestPasswordReset,\n unknown\n> => {\n return useMutation((payload: t.TRequestPasswordReset) =>\n dataService.requestPasswordReset(payload),\n );\n};\n\nexport const useResetPasswordMutation = (): UseMutationResult<\n unknown,\n unknown,\n t.TResetPassword,\n unknown\n> => {\n return useMutation((payload: t.TResetPassword) => dataService.resetPassword(payload));\n};\n\nexport const useAvailablePluginsQuery = <TData = s.TPlugin[]>(\n config?: UseQueryOptions<s.TPlugin[], unknown, TData>,\n): QueryObserverResult<TData> => {\n return useQuery<s.TPlugin[], unknown, TData>(\n [QueryKeys.availablePlugins],\n () => dataService.getAvailablePlugins(),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n\nexport const useUpdateUserPluginsMutation = (\n _options?: m.UpdatePluginAuthOptions,\n): UseMutationResult<t.TUser, unknown, t.TUpdateUserPlugins, unknown> => {\n const queryClient = useQueryClient();\n const { onSuccess, ...options } = _options ?? {};\n return useMutation((payload: t.TUpdateUserPlugins) => dataService.updateUserPlugins(payload), {\n ...options,\n onSuccess: (...args) => {\n queryClient.invalidateQueries([QueryKeys.user]);\n onSuccess?.(...args);\n },\n });\n};\n\nexport const useGetCustomConfigSpeechQuery = (\n config?: UseQueryOptions<t.TCustomConfigSpeechResponse>,\n): QueryObserverResult<t.TCustomConfigSpeechResponse> => {\n return useQuery<t.TCustomConfigSpeechResponse>(\n [QueryKeys.customConfigSpeech],\n () => dataService.getCustomConfigSpeech(),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n"],"names":["Tools","EToolResources","AnnotationTypes","StepStatus","MessageContentTypes","RunStatus","AuthTypeEnum","AuthorizationTypeEnum","TokenExchangeMethodEnum","FilePurpose","AssistantStreamEvents","AuthType","defaultOrderQuery","order","limit","z","string","uuid","EModelEndpoint","BedrockProviders","authTypeSchema","nativeEnum","Set","agents","openAI","bedrock","azureOpenAI","anthropic","custom","google","ImageDetail","ReasoningEffort","_a","low","auto","high","eImageDetailSchema","eReasoningEffortSchema","_b","agent","id","name","description","instructions","model","model_parameters","tools","provider","projectIds","artifacts","isCollaborative","recursion_limit","undefined","execute_code","file_search","type","function","parameters","properties","required","EAgent","openAISettings","default","temperature","min","max","step","top_p","presence_penalty","frequency_penalty","resendFiles","maxContextTokens","max_tokens","imageDetail","LEGACY_ANTHROPIC_MAX_OUTPUT","anthropicSettings","promptCache","thinking","thinkingBudget","maxOutputTokens","reset","modelName","test","set","value","topP","topK","legacy","agentsSettings","_d","eModelEndpointSchema","extendedModelEndpointSchema","union","tPluginAuthConfigSchema","object","authField","label","tPluginSchema","pluginKey","icon","optional","authConfig","array","authenticated","boolean","chatMenu","isButton","toolkit","tExampleSchema","input","content","output","agentOptionSettings","functions","classic","tAgentOptionsSchema","skipCompletion","number","messageId","endpoint","clientId","nullable","conversationId","parentMessageId","responseMessageId","overrideParentMessageId","bg","title","or","literal","sender","text","generation","isCreatedByUser","error","clientTimestamp","createdAt","Date","toISOString","updatedAt","current","unfinished","searchResult","finish_reason","thread_id","iconURL","coerceNumber","transform","val","trim","parseFloat","DocumentType","lazy","null","record","tConversationSchema","endpointType","isArchived","user","messages","modelLabel","userLabel","promptPrefix","system","context","examples","tags","file_ids","reasoning_effort","assistant_id","agent_id","region","maxTokens","additionalModelRequestFields","additional_instructions","append_current_datetime","presetOverride","unknown","stop","greeting","spec","expiredAt","resendImages","agentOptions","chatGptLabel","tPresetSchema","omit","merge","presetId","defaultPreset","pick","shareId","isPublic","_id","tag","count","position","googleBaseSchema","obj","removeNullishValues","catch","presencePenalty","frequencyPenalty","stopSequences","strip","gptPluginsBaseSchema","removeEmptyStrings","newObj","__assign","Object","keys","forEach","key","result","_c","_e","_f","_g","_h","_j","_k","_l","_m","_o","_p","length","bannerId","message","displayFrom","displayTo","tModelSpecSchema","preset","showIconInMenu","showIconInHeader","authType","specsConfigSchema","enforce","prioritize","list","addedEndpoints","assistants","azureAssistants","excelFileTypes","__spreadArray","supportedMimeTypes","defaultSizeLimit","assistantsFileConfig","fileLimit","fileSizeLimit","totalSizeLimit","disabled","FileSources","FileContext","supportedMimeTypesSchema","any","refine","mimeTypes","every","mimeType","RegExp","endpointFileConfigSchema","fileConfigSchema","endpoints","serverFileSizeLimit","avatarSizeLimit","envVarRegex","extractEnvVariable","trimmed","singleMatch","match","varName","process","env","regex","matches","exec","push","fullMatch","index","i","envValue","substring","SettingsViews","BaseOptionsSchema","iconPath","timeout","initTimeout","StdioOptionsSchema","extend","command","args","processedEnv","_i","entries","stderr","WebSocketOptionsSchema","url","protocol","URL","SSEOptionsSchema","headers","StreamableHTTPOptionsSchema","MCPOptionsSchema","MCPServersSchema","Capabilities","AgentCapabilities","fileSourceSchema","modelConfigSchema","deploymentName","version","azureBaseSchema","apiKey","serverless","instanceName","addParams","dropParams","forcePrompt","baseURL","additionalHeaders","azureGroupSchema","group","models","and","azureGroupConfigsSchema","baseEndpointSchema","streamRate","titlePrompt","titleModel","availableRegions","RateLimitPrefix","assistantEndpointSchema","disableBuilder","pollIntervalMs","timeoutMs","supportedIds","excludedIds","privateAssistants","retrievalModels","capabilities","code_interpreter","image_vision","retrieval","actions","fetch","userIdQuery","titleConvo","titleMethod","agentsEndpointSChema","recursionLimit","maxRecursionLimit","allowedProviders","ocr","chain","endpointSchema","safeParse","success","concat","values","join","summarize","summaryModel","modelDisplayLabel","customOrder","directEndpoint","titleMessageRole","azureEndpointSchema","groups","plugins","partial","ttsOpenaiSchema","voices","ttsAzureOpenAISchema","apiVersion","ttsElevenLabsSchema","websocketUrl","voice_settings","similarity_boost","stability","style","use_speaker_boost","pronunciation_dictionary_locators","ttsLocalaiSchema","backend","ttsSchema","openai","elevenlabs","localai","sttOpenaiSchema","sttAzureOpenAISchema","sttSchema","speechTab","conversationMode","advancedMode","speechToText","engineSTT","languageSTT","autoTranscribeAudio","decibelValue","autoSendText","textToSpeech","engineTTS","voice","languageTTS","automaticPlayback","playbackRate","cacheTTS","EImageOutputType","rateLimitSchema","fileUploads","ipMax","ipWindowInMinutes","userMax","userWindowInMinutes","conversationsImport","tts","stt","OCRStrategy","termsOfServiceSchema","externalUrl","openNewTab","modalAcceptance","modalTitle","modalContent","intefaceSchema","privacyPolicy","termsOfService","customWelcome","endpointsMenu","modelSelect","sidePanel","multiConvo","bookmarks","presets","prompts","temporaryChat","runCode","turnstileOptionsSchema","language","size","enum","turnstileSchema","siteKey","options","KnownEndpoints","FetchTokenConfig","ocrSchema","mistralModel","strategy","MISTRAL_OCR","balanceSchema","enabled","startBalance","autoRefillEnabled","refillIntervalValue","refillIntervalUnit","refillAmount","cache","secureImageLinks","imageOutputType","PNG","includedTools","filteredTools","mcpServers","interface","turnstile","fileStrategy","local","allowedDomains","registration","socialLogins","balance","speech","rateLimits","fileConfig","modelSpecs","all","gptPlugins","strict","data","chatGPTBrowser","ollama","deepseek","xai","VisionModes","InfiniteCollections","Time","CacheKeys","ViolationTypes","ErrorTypes","AuthKeys","ImageDetailCost","SettingsTabValues","STTProviders","TTSProviders","Constants","LocalStorageKeys","ForkOptions","CohereConstants","SystemCategories","sharedOpenAIModels","defaultModels","openAIModels","initialModelsConfig","initial","filter","str","params","rest","__rest","query","Array","isArray","map","v","encodeURIComponent","String","buildQuery","shareRoot","keysEndpoint","conversationsRoot","_post","axios","post","JSON","stringify","sent","isRefreshing","failedQueue","refreshToken","retry","endpoints.refreshToken","dispatchTokenUpdatedEvent","token","defaults","common","setTokenHeader","window","dispatchEvent","CustomEvent","detail","processQueue","prom","reject","resolve","interceptors","response","use","__awaiter","originalRequest","config","Promise","includes","status","_retry","console","warn","err_1","location","href","log","err_2","request","get","getResponse","postMultiPart","formData","postTTS","responseType","put","delete","deleteWithOptions","patch","revokeUserKey","endpoints.revokeUserKey","revokeAllUserKeys","getSharedMessages","endpoints.shareMessages","getSharedLink","endpoints.getSharedLink","updateUserKey","payload","Error","QueryKeys","MutationKeys","userKeyQuery","endpoints.userKeyQuery","clearAllConversations","getConversationById","endpoints.conversationById","useAbortRequestWithMessage","queryClient","useQueryClient","useMutation","abortKey","endpoints.abortRequest","arg","dataService.abortRequestWithMessage","onSuccess","invalidateQueries","useGetSharedMessages","useQuery","sharedMessages","dataService.getSharedMessages","refetchOnWindowFocus","refetchOnReconnect","refetchOnMount","useGetSharedLinkQuery","sharedLinks","dataService.getSharedLink","NEW_CONVO","PENDING_CONVO","setQueryData","useGetConversationByIdQuery","conversation","dataService.getConversationById","useGetConversationByIdMutation","useUpdateMessageMutation","endpoints.messages","dataService.updateMessage","useUpdateMessageContentMutation","dataService.updateMessageContent","useUpdateUserKeysMutation","dataService.updateUserKey","variables","useClearConversationsMutation","dataService.clearAllConversations","allConversations","useRevokeUserKeyMutation","dataService.revokeUserKey","_endpoint","toLowerCase","endsWith","assistantDocs","assistant","useRevokeAllUserKeysMutation","dataService.revokeAllUserKeys","s.EModelEndpoint","useGetModelsQuery","initialData","staleTime","Infinity","useCreatePresetMutation","dataService.createPreset","useDeletePresetMutation","useUpdateTokenCountMutation","dataService.updateTokenCount","tokenCount","useRegisterUserMutation","dataService.register","arguments","apply","useUserKeyQuery","dataService.userKeyQuery","expiresAt","useRequestPasswordResetMutation","dataService.requestPasswordReset","useResetPasswordMutation","dataService.resetPassword","useAvailablePluginsQuery","availablePlugins","useUpdateUserPluginsMutation","_options","dataService.updateUserPlugins","useGetCustomConfigSpeechQuery","customConfigSpeech"],"mappings":"uIAiBYA,EAQAC,EAmXAC,EAKAC,EAQAC,EAOAC,EAsEAC,EAMAC,EAMAC,EAmEAC,2rEApiBZ,SAAYT,GACVA,EAAA,aAAA,eACAA,EAAA,iBAAA,mBACAA,EAAA,YAAA,cACAA,EAAA,UAAA,YACAA,EAAA,SAAA,UACD,CAND,CAAYA,IAAAA,EAMX,CAAA,IAED,SAAYC,GACVA,EAAA,iBAAA,mBACAA,EAAA,aAAA,eACAA,EAAA,YAAA,cACAA,EAAA,WAAA,aACAA,EAAA,IAAA,KACD,CAND,CAAYA,IAAAA,EAMX,CAAA,IA6WD,SAAYC,GACVA,EAAA,cAAA,gBACAA,EAAA,UAAA,WACD,CAHD,CAAYA,IAAAA,EAGX,CAAA,IAED,SAAYC,GACVA,EAAA,YAAA,cACAA,EAAA,UAAA,YACAA,EAAA,OAAA,SACAA,EAAA,UAAA,YACAA,EAAA,QAAA,SACD,CAND,CAAYA,IAAAA,EAMX,CAAA,IAED,SAAYC,GACVA,EAAA,KAAA,OACAA,EAAA,WAAA,YACD,CAHD,CAAYA,IAAAA,EAG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,GAAQvC,KHCyB,iCGDc0D,EACxD,CEuKI2E,CAAiC3E,EAAjC,GAEJ,EAEa4E,GAA2B,WAMtC,OAAOhE,GAAY,SAACZ,GAA8B,OF/KvB,SAACA,GAC5B,OAAOnB,GAAQvC,KHDkB,0BGCc0D,EACjD,CE6KoD6E,CAA0B7E,KAC9E,EAEa8E,GAA2B,SACtC7G,GAEA,OAAOmD,EACL,CAAClB,GAAU6E,mBACX,WAAM,OFxKDlG,GAAQC,IHTY,eKiLc,GAAAlW,EAAA,CAErC2Y,sBAAsB,EACtBC,oBAAoB,EACpBC,gBAAgB,GACbxD,GAGT,EAEa+G,GAA+B,SAC1CC,GAEA,IAAMvE,EAAcC,IACd/iB,EAA4BqnB,QAAAA,EAAY,CAAE,EAAxChE,cAAc3J,EAAhBkE,EAAA5d,EAAA,CAAA,cACN,OAAOgjB,GAAY,SAACZ,GAAkC,OFpLvB,SAACA,GAChC,OAAOnB,GAAQvC,KHxHgB,oBGwHc0D,EAC/C,CEkLwDkF,CAA8BlF,EAAQ,UACvF1I,GAAO,CACV2J,UAAW,eAAC,IAAOnT,EAAA,GAAAE,EAAA,EAAPA,EAAOqW,UAAAxa,OAAPmE,IAAAF,EAAOE,GAAAqW,UAAArW,GACjB0S,EAAYQ,kBAAkB,CAAChB,GAAUxa,OACzCub,SAAAA,EAAeqD,WAAA,EAAAxW,EAChB,IAEL,EAEaqX,GAAgC,SAC3ClH,GAEA,OAAOmD,EACL,CAAClB,GAAUkF,qBACX,WAAM,OF2MDvG,GAAQC,IHlV0B,GAAG9M,OAVlB,GAAGA,OANJ,aAMW,WAUgB,eKuIT,GAAApJ,EAAA,CAEvC2Y,sBAAsB,EACtBC,oBAAoB,EACpBC,gBAAgB,GACbxD,GAGT"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../src/types/assistants.ts","../../src/schemas.ts","../../src/models.ts","../../src/file-config.ts","../../src/types/files.ts","../../src/utils.ts","../../src/mcp.ts","../../src/config.ts","../../src/api-endpoints.ts","../../src/request.ts","../../src/headers-helpers.ts","../../src/data-service.ts","../../src/keys.ts","../../src/react-query/react-query-service.ts"],"sourcesContent":["import type { OpenAPIV3 } from 'openapi-types';\nimport type { AssistantsEndpoint, AgentProvider } from 'src/schemas';\nimport type { ContentTypes } from './runs';\nimport type { Agents } from './agents';\nimport type { TFile } from './files';\nimport { ArtifactModes } from 'src/artifacts';\n\nexport type Schema = OpenAPIV3.SchemaObject & { description?: string };\nexport type Reference = OpenAPIV3.ReferenceObject & { description?: string };\n\nexport type Metadata = {\n avatar?: string;\n author?: string;\n} & {\n [key: string]: unknown;\n};\n\nexport enum Tools {\n execute_code = 'execute_code',\n code_interpreter = 'code_interpreter',\n file_search = 'file_search',\n web_search = 'web_search',\n retrieval = 'retrieval',\n function = 'function',\n}\n\nexport enum EToolResources {\n code_interpreter = 'code_interpreter',\n execute_code = 'execute_code',\n file_search = 'file_search',\n image_edit = 'image_edit',\n ocr = 'ocr',\n}\n\nexport type Tool = {\n [type: string]: Tools;\n};\n\nexport type FunctionTool = {\n type: Tools;\n function?: {\n description: string;\n name: string;\n parameters: Record<string, unknown>;\n strict?: boolean;\n additionalProperties?: boolean; // must be false if strict is true https://platform.openai.com/docs/guides/structured-outputs/some-type-specific-keywords-are-not-yet-supported\n };\n};\n\n/**\n * A set of resources that are used by the assistant's tools. The resources are\n * specific to the type of tool. For example, the `code_interpreter` tool requires\n * a list of file IDs, while the `file_search` tool requires a list of vector store\n * IDs.\n */\nexport interface ToolResources {\n code_interpreter?: CodeInterpreterResource;\n file_search?: FileSearchResource;\n}\nexport interface CodeInterpreterResource {\n /**\n * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made\n * available to the `code_interpreter`` tool. There can be a maximum of 20 files\n * associated with the tool.\n */\n file_ids?: Array<string>;\n}\n\nexport interface FileSearchResource {\n /**\n * The ID of the\n * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)\n * attached to this assistant. There can be a maximum of 1 vector store attached to\n * the assistant.\n */\n vector_store_ids?: Array<string>;\n}\n\n/* Assistant types */\n\nexport type Assistant = {\n id: string;\n created_at: number;\n description: string | null;\n file_ids?: string[];\n instructions: string | null;\n conversation_starters?: string[];\n metadata: Metadata | null;\n model: string;\n name: string | null;\n object: string;\n tools?: FunctionTool[];\n tool_resources?: ToolResources;\n};\n\nexport type TAssistantsMap = Record<AssistantsEndpoint, Record<string, Assistant>>;\n\nexport type AssistantCreateParams = {\n model: string;\n description?: string | null;\n file_ids?: string[];\n instructions?: string | null;\n conversation_starters?: string[];\n metadata?: Metadata | null;\n name?: string | null;\n tools?: Array<FunctionTool | string>;\n endpoint: AssistantsEndpoint;\n version: number | string;\n append_current_datetime?: boolean;\n};\n\nexport type AssistantUpdateParams = {\n model?: string;\n description?: string | null;\n file_ids?: string[];\n instructions?: string | null;\n conversation_starters?: string[] | null;\n metadata?: Metadata | null;\n name?: string | null;\n tools?: Array<FunctionTool | string>;\n tool_resources?: ToolResources;\n endpoint: AssistantsEndpoint;\n append_current_datetime?: boolean;\n};\n\nexport type AssistantListParams = {\n limit?: number;\n before?: string | null;\n after?: string | null;\n order?: 'asc' | 'desc';\n endpoint: AssistantsEndpoint;\n};\n\nexport type AssistantListResponse = {\n object: string;\n data: Assistant[];\n first_id: string;\n last_id: string;\n has_more: boolean;\n};\n\nexport type File = {\n file_id: string;\n id?: string;\n temp_file_id?: string;\n bytes: number;\n created_at: number;\n filename: string;\n object: string;\n purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';\n};\n\n/* Agent types */\n\nexport type AgentParameterValue = number | string | null;\n\nexport type AgentModelParameters = {\n model?: string;\n temperature: AgentParameterValue;\n maxContextTokens: AgentParameterValue;\n max_context_tokens: AgentParameterValue;\n max_output_tokens: AgentParameterValue;\n top_p: AgentParameterValue;\n frequency_penalty: AgentParameterValue;\n presence_penalty: AgentParameterValue;\n};\n\nexport interface AgentBaseResource {\n /**\n * A list of file IDs made available to the tool.\n */\n file_ids?: Array<string>;\n /**\n * A list of files already fetched.\n */\n files?: Array<TFile>;\n}\n\nexport interface AgentToolResources {\n [EToolResources.image_edit]?: AgentBaseResource;\n [EToolResources.execute_code]?: ExecuteCodeResource;\n [EToolResources.file_search]?: AgentFileResource;\n [EToolResources.ocr]?: AgentBaseResource;\n}\n/**\n * A resource for the execute_code tool.\n * Contains file IDs made available to the tool (max 20 files) and already fetched files.\n */\nexport type ExecuteCodeResource = AgentBaseResource;\n\nexport interface AgentFileResource extends AgentBaseResource {\n /**\n * The ID of the vector store attached to this agent. There\n * can be a maximum of 1 vector store attached to the agent.\n */\n vector_store_ids?: Array<string>;\n}\n\nexport type Agent = {\n id: string;\n name: string | null;\n author?: string | null;\n /** The original custom endpoint name, lowercased */\n endpoint?: string | null;\n authorName?: string | null;\n description: string | null;\n created_at: number;\n avatar: AgentAvatar | null;\n instructions: string | null;\n additional_instructions?: string | null;\n tools?: string[];\n projectIds?: string[];\n tool_kwargs?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n provider: AgentProvider;\n model: string | null;\n model_parameters: AgentModelParameters;\n conversation_starters?: string[];\n isCollaborative?: boolean;\n tool_resources?: AgentToolResources;\n agent_ids?: string[];\n end_after_tools?: boolean;\n hide_sequential_outputs?: boolean;\n artifacts?: ArtifactModes;\n recursion_limit?: number;\n version?: number;\n};\n\nexport type TAgentsMap = Record<string, Agent | undefined>;\n\nexport type AgentCreateParams = {\n name?: string | null;\n description?: string | null;\n avatar?: AgentAvatar | null;\n file_ids?: string[];\n instructions?: string | null;\n tools?: Array<FunctionTool | string>;\n provider: AgentProvider;\n model: string | null;\n model_parameters: AgentModelParameters;\n} & Pick<\n Agent,\n 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit'\n>;\n\nexport type AgentUpdateParams = {\n name?: string | null;\n description?: string | null;\n avatar?: AgentAvatar | null;\n file_ids?: string[];\n instructions?: string | null;\n tools?: Array<FunctionTool | string>;\n tool_resources?: ToolResources;\n provider?: AgentProvider;\n model?: string | null;\n model_parameters?: AgentModelParameters;\n projectIds?: string[];\n removeProjectIds?: string[];\n isCollaborative?: boolean;\n} & Pick<\n Agent,\n 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit'\n>;\n\nexport type AgentListParams = {\n limit?: number;\n before?: string | null;\n after?: string | null;\n order?: 'asc' | 'desc';\n provider?: AgentProvider;\n};\n\nexport type AgentListResponse = {\n object: string;\n data: Agent[];\n first_id: string;\n last_id: string;\n has_more: boolean;\n};\n\nexport type AgentFile = {\n file_id: string;\n id?: string;\n temp_file_id?: string;\n bytes: number;\n created_at: number;\n filename: string;\n object: string;\n purpose: 'fine-tune' | 'fine-tune-results' | 'agents' | 'agents_output';\n};\n\n/**\n * Details of the Code Interpreter tool call the run step was involved in.\n * Includes the tool call ID, the code interpreter definition, and the type of tool call.\n */\nexport type CodeToolCall = {\n id: string; // The ID of the tool call.\n code_interpreter: {\n input: string; // The input to the Code Interpreter tool call.\n outputs: Array<Record<string, unknown>>; // The outputs from the Code Interpreter tool call.\n };\n type: 'code_interpreter'; // The type of tool call, always 'code_interpreter'.\n};\n\n/**\n * Details of a Function tool call the run step was involved in.\n * Includes the tool call ID, the function definition, and the type of tool call.\n */\nexport type FunctionToolCall = {\n id: string; // The ID of the tool call object.\n function: {\n arguments: string; // The arguments passed to the function.\n name: string; // The name of the function.\n output: string | null; // The output of the function, null if not submitted.\n };\n type: 'function'; // The type of tool call, always 'function'.\n};\n\n/**\n * Details of a Retrieval tool call the run step was involved in.\n * Includes the tool call ID and the type of tool call.\n */\nexport type RetrievalToolCall = {\n id: string; // The ID of the tool call object.\n retrieval: unknown; // An empty object for now.\n type: 'retrieval'; // The type of tool call, always 'retrieval'.\n};\n\n/**\n * Details of a Retrieval tool call the run step was involved in.\n * Includes the tool call ID and the type of tool call.\n */\nexport type FileSearchToolCall = {\n id: string; // The ID of the tool call object.\n file_search: unknown; // An empty object for now.\n type: 'file_search'; // The type of tool call, always 'retrieval'.\n};\n\n/**\n * Details of the tool calls involved in a run step.\n * Can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`.\n */\nexport type ToolCallsStepDetails = {\n tool_calls: Array<CodeToolCall | RetrievalToolCall | FileSearchToolCall | FunctionToolCall>; // An array of tool calls the run step was involved in.\n type: 'tool_calls'; // Always 'tool_calls'.\n};\n\nexport type ImageFile = TFile & {\n /**\n * The [File](https://platform.openai.com/docs/api-reference/files) ID of the image\n * in the message content.\n */\n file_id: string;\n filename: string;\n filepath: string;\n height: number;\n width: number;\n /**\n * Prompt used to generate the image if applicable.\n */\n prompt?: string;\n /**\n * Additional metadata used to generate or about the image/tool_call.\n */\n metadata?: Record<string, unknown>;\n};\n\n// FileCitation.ts\nexport type FileCitation = {\n end_index: number;\n file_citation: FileCitationDetails;\n start_index: number;\n text: string;\n type: 'file_citation';\n};\n\nexport type FileCitationDetails = {\n file_id: string;\n quote: string;\n};\n\nexport type FilePath = {\n end_index: number;\n file_path: FilePathDetails;\n start_index: number;\n text: string;\n type: 'file_path';\n};\n\nexport type FilePathDetails = {\n file_id: string;\n};\n\nexport type Text = {\n annotations?: Array<FileCitation | FilePath>;\n value: string;\n};\n\nexport enum AnnotationTypes {\n FILE_CITATION = 'file_citation',\n FILE_PATH = 'file_path',\n}\n\nexport enum StepStatus {\n IN_PROGRESS = 'in_progress',\n CANCELLED = 'cancelled',\n FAILED = 'failed',\n COMPLETED = 'completed',\n EXPIRED = 'expired',\n}\n\nexport enum MessageContentTypes {\n TEXT = 'text',\n IMAGE_FILE = 'image_file',\n}\n\n//enum for RunStatus\n// The status of the run: queued, in_progress, requires_action, cancelling, cancelled, failed, completed, or expired.\nexport enum RunStatus {\n QUEUED = 'queued',\n IN_PROGRESS = 'in_progress',\n REQUIRES_ACTION = 'requires_action',\n CANCELLING = 'cancelling',\n CANCELLED = 'cancelled',\n FAILED = 'failed',\n COMPLETED = 'completed',\n EXPIRED = 'expired',\n}\n\nexport type PartMetadata = {\n progress?: number;\n asset_pointer?: string;\n status?: string;\n action?: boolean;\n auth?: string;\n expires_at?: number;\n};\n\nexport type ContentPart = (\n | CodeToolCall\n | RetrievalToolCall\n | FileSearchToolCall\n | FunctionToolCall\n | Agents.AgentToolCall\n | ImageFile\n | Text\n) &\n PartMetadata;\n\nexport type TMessageContentParts =\n | { type: ContentTypes.ERROR; text?: string | (Text & PartMetadata); error?: string }\n | { type: ContentTypes.THINK; think: string | (Text & PartMetadata) }\n | { type: ContentTypes.TEXT; text: string | (Text & PartMetadata); tool_call_ids?: string[] }\n | {\n type: ContentTypes.TOOL_CALL;\n tool_call: (\n | CodeToolCall\n | RetrievalToolCall\n | FileSearchToolCall\n | FunctionToolCall\n | Agents.AgentToolCall\n ) &\n PartMetadata;\n }\n | { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }\n | Agents.AgentUpdate\n | Agents.MessageContentImageUrl;\n\nexport type StreamContentData = TMessageContentParts & {\n /** The index of the current content part */\n index: number;\n /** The current text content was already served but edited to replace elements therein */\n edited?: boolean;\n};\n\nexport type TContentData = StreamContentData & {\n messageId: string;\n conversationId: string;\n userMessageId: string;\n thread_id: string;\n stream?: boolean;\n};\n\nexport const actionDelimiter = '_action_';\nexport const actionDomainSeparator = '---';\nexport const hostImageIdSuffix = '_host_copy';\nexport const hostImageNamePrefix = 'host_copy_';\n\nexport enum AuthTypeEnum {\n ServiceHttp = 'service_http',\n OAuth = 'oauth',\n None = 'none',\n}\n\nexport enum AuthorizationTypeEnum {\n Bearer = 'bearer',\n Basic = 'basic',\n Custom = 'custom',\n}\n\nexport enum TokenExchangeMethodEnum {\n DefaultPost = 'default_post',\n BasicAuthHeader = 'basic_auth_header',\n}\n\nexport type ActionAuth = {\n authorization_type?: AuthorizationTypeEnum;\n custom_auth_header?: string;\n type?: AuthTypeEnum;\n authorization_content_type?: string;\n authorization_url?: string;\n client_url?: string;\n scope?: string;\n token_exchange_method?: TokenExchangeMethodEnum;\n};\n\nexport type ActionMetadata = {\n api_key?: string;\n auth?: ActionAuth;\n domain?: string;\n privacy_policy_url?: string;\n raw_spec?: string;\n oauth_client_id?: string;\n oauth_client_secret?: string;\n};\n\nexport type ActionMetadataRuntime = ActionMetadata & {\n oauth_access_token?: string;\n oauth_refresh_token?: string;\n oauth_token_expires_at?: Date;\n};\n\n/* Assistant types */\n\nexport type Action = {\n action_id: string;\n type?: string;\n settings?: Record<string, unknown>;\n metadata: ActionMetadata;\n version: number | string;\n} & ({ assistant_id: string; agent_id?: never } | { assistant_id?: never; agent_id: string });\n\nexport type AssistantAvatar = {\n filepath: string;\n source: string;\n};\n\nexport type AssistantDocument = {\n user: string;\n assistant_id: string;\n conversation_starters?: string[];\n avatar?: AssistantAvatar;\n access_level?: number;\n file_ids?: string[];\n actions?: string[];\n createdAt?: Date;\n updatedAt?: Date;\n append_current_datetime?: boolean;\n};\n\n/* Agent types */\n\nexport type AgentAvatar = {\n filepath: string;\n source: string;\n};\n\nexport enum FilePurpose {\n Vision = 'vision',\n FineTune = 'fine-tune',\n FineTuneResults = 'fine-tune-results',\n Assistants = 'assistants',\n AssistantsOutput = 'assistants_output',\n}\n\nexport const defaultOrderQuery: {\n order: 'desc';\n limit: 100;\n} = {\n order: 'desc',\n limit: 100,\n};\n\nexport enum AssistantStreamEvents {\n ThreadCreated = 'thread.created',\n ThreadRunCreated = 'thread.run.created',\n ThreadRunQueued = 'thread.run.queued',\n ThreadRunInProgress = 'thread.run.in_progress',\n ThreadRunRequiresAction = 'thread.run.requires_action',\n ThreadRunCompleted = 'thread.run.completed',\n ThreadRunFailed = 'thread.run.failed',\n ThreadRunCancelling = 'thread.run.cancelling',\n ThreadRunCancelled = 'thread.run.cancelled',\n ThreadRunExpired = 'thread.run.expired',\n ThreadRunStepCreated = 'thread.run.step.created',\n ThreadRunStepInProgress = 'thread.run.step.in_progress',\n ThreadRunStepCompleted = 'thread.run.step.completed',\n ThreadRunStepFailed = 'thread.run.step.failed',\n ThreadRunStepCancelled = 'thread.run.step.cancelled',\n ThreadRunStepExpired = 'thread.run.step.expired',\n ThreadRunStepDelta = 'thread.run.step.delta',\n ThreadMessageCreated = 'thread.message.created',\n ThreadMessageInProgress = 'thread.message.in_progress',\n ThreadMessageCompleted = 'thread.message.completed',\n ThreadMessageIncomplete = 'thread.message.incomplete',\n ThreadMessageDelta = 'thread.message.delta',\n ErrorEvent = 'error',\n}\n","import { z } from 'zod';\nimport { Tools } from './types/assistants';\nimport type { TMessageContentParts, FunctionTool, FunctionToolCall } from './types/assistants';\nimport type { SearchResultData } from './types/web';\nimport type { TEphemeralAgent } from './types';\nimport type { TFile } from './types/files';\n\nexport const isUUID = z.string().uuid();\n\nexport enum AuthType {\n OVERRIDE_AUTH = 'override_auth',\n USER_PROVIDED = 'user_provided',\n SYSTEM_DEFINED = 'system_defined',\n}\n\nexport const authTypeSchema = z.nativeEnum(AuthType);\n\nexport enum EModelEndpoint {\n azureOpenAI = 'azureOpenAI',\n openAI = 'openAI',\n google = 'google',\n anthropic = 'anthropic',\n assistants = 'assistants',\n azureAssistants = 'azureAssistants',\n agents = 'agents',\n custom = 'custom',\n bedrock = 'bedrock',\n /** @deprecated */\n chatGPTBrowser = 'chatGPTBrowser',\n /** @deprecated */\n gptPlugins = 'gptPlugins',\n}\n\nexport const paramEndpoints = new Set<EModelEndpoint | string>([\n EModelEndpoint.agents,\n EModelEndpoint.openAI,\n EModelEndpoint.bedrock,\n EModelEndpoint.azureOpenAI,\n EModelEndpoint.anthropic,\n EModelEndpoint.custom,\n EModelEndpoint.google,\n]);\n\nexport enum BedrockProviders {\n AI21 = 'ai21',\n Amazon = 'amazon',\n Anthropic = 'anthropic',\n Cohere = 'cohere',\n Meta = 'meta',\n MistralAI = 'mistral',\n StabilityAI = 'stability',\n DeepSeek = 'deepseek',\n}\n\nexport const getModelKey = (endpoint: EModelEndpoint | string, model: string) => {\n if (endpoint === EModelEndpoint.bedrock) {\n const parts = model.split('.');\n const provider = [parts[0], parts[1]].find((part) =>\n Object.values(BedrockProviders).includes(part as BedrockProviders),\n );\n return (provider ?? parts[0]) as BedrockProviders;\n }\n return model;\n};\n\nexport const getSettingsKeys = (endpoint: EModelEndpoint | string, model: string) => {\n const endpointKey = endpoint;\n const modelKey = getModelKey(endpointKey, model);\n const combinedKey = `${endpointKey}-${modelKey}`;\n return [combinedKey, endpointKey];\n};\n\nexport type AssistantsEndpoint = EModelEndpoint.assistants | EModelEndpoint.azureAssistants;\n\nexport const isAssistantsEndpoint = (_endpoint?: AssistantsEndpoint | null | string): boolean => {\n const endpoint = _endpoint ?? '';\n if (!endpoint) {\n return false;\n }\n return endpoint.toLowerCase().endsWith(EModelEndpoint.assistants);\n};\n\nexport type AgentProvider = Exclude<keyof typeof EModelEndpoint, EModelEndpoint.agents> | string;\n\nexport const isAgentsEndpoint = (_endpoint?: EModelEndpoint.agents | null | string): boolean => {\n const endpoint = _endpoint ?? '';\n if (!endpoint) {\n return false;\n }\n return endpoint === EModelEndpoint.agents;\n};\n\nexport const isEphemeralAgent = (\n endpoint?: EModelEndpoint.agents | null | string,\n ephemeralAgent?: TEphemeralAgent | null,\n) => {\n if (!ephemeralAgent) {\n return false;\n }\n if (isAgentsEndpoint(endpoint)) {\n return false;\n }\n const hasMCPSelected = (ephemeralAgent?.mcp?.length ?? 0) > 0;\n const hasCodeSelected = (ephemeralAgent?.execute_code ?? false) === true;\n const hasSearchSelected = (ephemeralAgent?.web_search ?? false) === true;\n return hasMCPSelected || hasCodeSelected || hasSearchSelected;\n};\n\nexport const isParamEndpoint = (\n endpoint: EModelEndpoint | string,\n endpointType?: EModelEndpoint | string,\n): boolean => {\n if (paramEndpoints.has(endpoint)) {\n return true;\n }\n\n if (endpointType != null) {\n return paramEndpoints.has(endpointType);\n }\n\n return false;\n};\n\nexport enum ImageDetail {\n low = 'low',\n auto = 'auto',\n high = 'high',\n}\n\nexport enum ReasoningEffort {\n low = 'low',\n medium = 'medium',\n high = 'high',\n}\n\nexport const imageDetailNumeric = {\n [ImageDetail.low]: 0,\n [ImageDetail.auto]: 1,\n [ImageDetail.high]: 2,\n};\n\nexport const imageDetailValue = {\n 0: ImageDetail.low,\n 1: ImageDetail.auto,\n 2: ImageDetail.high,\n};\n\nexport const eImageDetailSchema = z.nativeEnum(ImageDetail);\nexport const eReasoningEffortSchema = z.nativeEnum(ReasoningEffort);\n\nexport const defaultAssistantFormValues = {\n assistant: '',\n id: '',\n name: '',\n description: '',\n instructions: '',\n conversation_starters: [],\n model: '',\n functions: [],\n code_interpreter: false,\n image_vision: false,\n retrieval: false,\n append_current_datetime: false,\n};\n\nexport const defaultAgentFormValues = {\n agent: {},\n id: '',\n name: '',\n description: '',\n instructions: '',\n model: '',\n model_parameters: {},\n tools: [],\n provider: {},\n projectIds: [],\n artifacts: '',\n isCollaborative: false,\n recursion_limit: undefined,\n [Tools.execute_code]: false,\n [Tools.file_search]: false,\n [Tools.web_search]: false,\n};\n\nexport const ImageVisionTool: FunctionTool = {\n type: Tools.function,\n [Tools.function]: {\n name: 'image_vision',\n description: 'Get detailed text descriptions for all current image attachments.',\n parameters: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n};\n\nexport const isImageVisionTool = (tool: FunctionTool | FunctionToolCall) =>\n tool.type === 'function' && tool.function?.name === ImageVisionTool.function?.name;\n\nexport const openAISettings = {\n model: {\n default: 'gpt-4o-mini' as const,\n },\n temperature: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n top_p: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n presence_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n frequency_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n resendFiles: {\n default: true as const,\n },\n maxContextTokens: {\n default: undefined,\n },\n max_tokens: {\n default: undefined,\n },\n imageDetail: {\n default: ImageDetail.auto as const,\n min: 0 as const,\n max: 2 as const,\n step: 1 as const,\n },\n};\n\nexport const googleSettings = {\n model: {\n default: 'gemini-1.5-flash-latest' as const,\n },\n maxOutputTokens: {\n min: 1 as const,\n max: 64000 as const,\n step: 1 as const,\n default: 8192 as const,\n },\n temperature: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n topP: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 0.95 as const,\n },\n topK: {\n min: 1 as const,\n max: 40 as const,\n step: 1 as const,\n default: 40 as const,\n },\n};\n\nconst ANTHROPIC_MAX_OUTPUT = 128000 as const;\nconst DEFAULT_MAX_OUTPUT = 8192 as const;\nconst LEGACY_ANTHROPIC_MAX_OUTPUT = 4096 as const;\nexport const anthropicSettings = {\n model: {\n default: 'claude-3-5-sonnet-latest' as const,\n },\n temperature: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n promptCache: {\n default: true as const,\n },\n thinking: {\n default: true as const,\n },\n thinkingBudget: {\n min: 1024 as const,\n step: 100 as const,\n max: 200000 as const,\n default: 2000 as const,\n },\n maxOutputTokens: {\n min: 1 as const,\n max: ANTHROPIC_MAX_OUTPUT,\n step: 1 as const,\n default: DEFAULT_MAX_OUTPUT,\n reset: (modelName: string) => {\n if (/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) {\n return DEFAULT_MAX_OUTPUT;\n }\n\n return 4096;\n },\n set: (value: number, modelName: string) => {\n if (\n !(/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) &&\n value > LEGACY_ANTHROPIC_MAX_OUTPUT\n ) {\n return LEGACY_ANTHROPIC_MAX_OUTPUT;\n }\n\n return value;\n },\n },\n topP: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 0.7 as const,\n },\n topK: {\n min: 1 as const,\n max: 40 as const,\n step: 1 as const,\n default: 5 as const,\n },\n resendFiles: {\n default: true as const,\n },\n maxContextTokens: {\n default: undefined,\n },\n legacy: {\n maxOutputTokens: {\n min: 1 as const,\n max: LEGACY_ANTHROPIC_MAX_OUTPUT,\n step: 1 as const,\n default: LEGACY_ANTHROPIC_MAX_OUTPUT,\n },\n },\n};\n\nexport const agentsSettings = {\n model: {\n default: 'gpt-3.5-turbo-test' as const,\n },\n temperature: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n top_p: {\n min: 0 as const,\n max: 1 as const,\n step: 0.01 as const,\n default: 1 as const,\n },\n presence_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n frequency_penalty: {\n min: 0 as const,\n max: 2 as const,\n step: 0.01 as const,\n default: 0 as const,\n },\n resendFiles: {\n default: true as const,\n },\n maxContextTokens: {\n default: undefined,\n },\n max_tokens: {\n default: undefined,\n },\n imageDetail: {\n default: ImageDetail.auto as const,\n },\n};\n\nexport const endpointSettings = {\n [EModelEndpoint.openAI]: openAISettings,\n [EModelEndpoint.google]: googleSettings,\n [EModelEndpoint.anthropic]: anthropicSettings,\n [EModelEndpoint.agents]: agentsSettings,\n [EModelEndpoint.bedrock]: agentsSettings,\n};\n\nconst google = endpointSettings[EModelEndpoint.google];\n\nexport const eModelEndpointSchema = z.nativeEnum(EModelEndpoint);\n\nexport const extendedModelEndpointSchema = z.union([eModelEndpointSchema, z.string()]);\n\nexport const tPluginAuthConfigSchema = z.object({\n authField: z.string(),\n label: z.string(),\n description: z.string(),\n});\n\nexport type TPluginAuthConfig = z.infer<typeof tPluginAuthConfigSchema>;\n\nexport const tPluginSchema = z.object({\n name: z.string(),\n pluginKey: z.string(),\n description: z.string(),\n icon: z.string().optional(),\n authConfig: z.array(tPluginAuthConfigSchema).optional(),\n authenticated: z.boolean().optional(),\n chatMenu: z.boolean().optional(),\n isButton: z.boolean().optional(),\n toolkit: z.boolean().optional(),\n});\n\nexport type TPlugin = z.infer<typeof tPluginSchema>;\n\nexport type TInput = {\n inputStr: string;\n};\n\nexport type TResPlugin = {\n plugin: string;\n input: string;\n thought: string;\n loading?: boolean;\n outputs?: string;\n latest?: string;\n inputs?: TInput[];\n};\n\nexport const tExampleSchema = z.object({\n input: z.object({\n content: z.string(),\n }),\n output: z.object({\n content: z.string(),\n }),\n});\n\nexport type TExample = z.infer<typeof tExampleSchema>;\n\nexport enum EAgent {\n functions = 'functions',\n classic = 'classic',\n}\n\nexport const agentOptionSettings = {\n model: {\n default: 'gpt-4o-mini',\n },\n temperature: {\n min: 0,\n max: 1,\n step: 0.01,\n default: 0,\n },\n agent: {\n default: EAgent.functions,\n options: [EAgent.functions, EAgent.classic],\n },\n skipCompletion: {\n default: true,\n },\n};\n\nexport const eAgentOptionsSchema = z.nativeEnum(EAgent);\n\nexport const tAgentOptionsSchema = z.object({\n agent: z.string().default(EAgent.functions),\n skipCompletion: z.boolean().default(agentOptionSettings.skipCompletion.default),\n model: z.string(),\n temperature: z.number().default(agentOptionSettings.temperature.default),\n});\n\nexport const tMessageSchema = z.object({\n messageId: z.string(),\n endpoint: z.string().optional(),\n clientId: z.string().nullable().optional(),\n conversationId: z.string().nullable(),\n parentMessageId: z.string().nullable(),\n responseMessageId: z.string().nullable().optional(),\n overrideParentMessageId: z.string().nullable().optional(),\n bg: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),\n sender: z.string().optional(),\n text: z.string(),\n generation: z.string().nullable().optional(),\n isCreatedByUser: z.boolean(),\n error: z.boolean().optional(),\n clientTimestamp: z.string().optional(),\n createdAt: z\n .string()\n .optional()\n .default(() => new Date().toISOString()),\n updatedAt: z\n .string()\n .optional()\n .default(() => new Date().toISOString()),\n current: z.boolean().optional(),\n unfinished: z.boolean().optional(),\n searchResult: z.boolean().optional(),\n finish_reason: z.string().optional(),\n /* assistant */\n thread_id: z.string().optional(),\n /* frontend components */\n iconURL: z.string().nullable().optional(),\n});\n\nexport type TAttachmentMetadata = {\n type?: Tools;\n messageId: string;\n toolCallId: string;\n [Tools.web_search]?: SearchResultData;\n};\n\nexport type TAttachment =\n | (TFile & TAttachmentMetadata)\n | (Pick<TFile, 'filename' | 'filepath' | 'conversationId'> & {\n expiresAt: number;\n } & TAttachmentMetadata);\n\nexport type TMessage = z.input<typeof tMessageSchema> & {\n children?: TMessage[];\n plugin?: TResPlugin | null;\n plugins?: TResPlugin[];\n content?: TMessageContentParts[];\n files?: Partial<TFile>[];\n depth?: number;\n siblingIndex?: number;\n attachments?: TAttachment[];\n clientTimestamp?: string;\n};\n\nexport const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {\n if (typeof val === 'string') {\n return val.trim() === '' ? undefined : parseFloat(val);\n }\n return val;\n});\n\ntype DocumentTypeValue =\n | null\n | boolean\n | number\n | string\n | DocumentTypeValue[]\n | { [key: string]: DocumentTypeValue };\n\nconst DocumentType: z.ZodType<DocumentTypeValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.boolean(),\n z.number(),\n z.string(),\n z.array(z.lazy(() => DocumentType)),\n z.record(z.lazy(() => DocumentType)),\n ]),\n);\n\nexport const tConversationSchema = z.object({\n conversationId: z.string().nullable(),\n endpoint: eModelEndpointSchema.nullable(),\n endpointType: eModelEndpointSchema.nullable().optional(),\n isArchived: z.boolean().optional(),\n title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),\n user: z.string().optional(),\n messages: z.array(z.string()).optional(),\n tools: z.union([z.array(tPluginSchema), z.array(z.string())]).optional(),\n modelLabel: z.string().nullable().optional(),\n userLabel: z.string().optional(),\n model: z.string().nullable().optional(),\n promptPrefix: z.string().nullable().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n topK: z.number().optional(),\n top_p: z.number().optional(),\n frequency_penalty: z.number().optional(),\n presence_penalty: z.number().optional(),\n parentMessageId: z.string().optional(),\n maxOutputTokens: coerceNumber.optional(),\n maxContextTokens: coerceNumber.optional(),\n max_tokens: coerceNumber.optional(),\n /* Anthropic */\n promptCache: z.boolean().optional(),\n system: z.string().optional(),\n thinking: z.boolean().optional(),\n thinkingBudget: coerceNumber.optional(),\n /* artifacts */\n artifacts: z.string().optional(),\n /* google */\n context: z.string().nullable().optional(),\n examples: z.array(tExampleSchema).optional(),\n /* DB */\n tags: z.array(z.string()).optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n /* Files */\n resendFiles: z.boolean().optional(),\n file_ids: z.array(z.string()).optional(),\n /* vision */\n imageDetail: eImageDetailSchema.optional(),\n /* OpenAI: o1 only */\n reasoning_effort: eReasoningEffortSchema.optional(),\n /* assistant */\n assistant_id: z.string().optional(),\n /* agents */\n agent_id: z.string().optional(),\n /* AWS Bedrock */\n region: z.string().optional(),\n maxTokens: coerceNumber.optional(),\n additionalModelRequestFields: DocumentType.optional(),\n /* assistants */\n instructions: z.string().optional(),\n additional_instructions: z.string().optional(),\n append_current_datetime: z.boolean().optional(),\n /** Used to overwrite active conversation settings when saving a Preset */\n presetOverride: z.record(z.unknown()).optional(),\n stop: z.array(z.string()).optional(),\n /* frontend components */\n greeting: z.string().optional(),\n spec: z.string().nullable().optional(),\n iconURL: z.string().nullable().optional(),\n /* temporary chat */\n expiredAt: z.string().nullable().optional(),\n /** @deprecated */\n resendImages: z.boolean().optional(),\n /** @deprecated */\n agentOptions: tAgentOptionsSchema.nullable().optional(),\n /** @deprecated Prefer `modelLabel` over `chatGptLabel` */\n chatGptLabel: z.string().nullable().optional(),\n});\n\nexport const tPresetSchema = tConversationSchema\n .omit({\n conversationId: true,\n createdAt: true,\n updatedAt: true,\n title: true,\n })\n .merge(\n z.object({\n conversationId: z.string().nullable().optional(),\n presetId: z.string().nullable().optional(),\n title: z.string().nullable().optional(),\n defaultPreset: z.boolean().optional(),\n order: z.number().optional(),\n endpoint: extendedModelEndpointSchema.nullable(),\n }),\n );\n\nexport const tConvoUpdateSchema = tConversationSchema.merge(\n z.object({\n endpoint: extendedModelEndpointSchema.nullable(),\n createdAt: z.string().optional(),\n updatedAt: z.string().optional(),\n }),\n);\n\nexport const tQueryParamsSchema = tConversationSchema\n .pick({\n // librechat settings\n /** The model spec to be used */\n spec: true,\n /** The AI context window, overrides the system-defined window as determined by `model` value */\n maxContextTokens: true,\n /**\n * Whether or not to re-submit files from previous messages on subsequent messages\n * */\n resendFiles: true,\n /**\n * @endpoints openAI, custom, azureOpenAI\n *\n * System parameter that only affects the above endpoints.\n * Image detail for re-sizing according to OpenAI spec, defaults to `auto`\n * */\n imageDetail: true,\n /**\n * AKA Custom Instructions, dynamically added to chat history as a system message;\n * for `bedrock` endpoint, this is used as the `system` model param if the provider uses it;\n * for `assistants` endpoint, this is used as the `additional_instructions` model param:\n * https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_instructions\n * ; otherwise, a message with `system` role is added to the chat history\n */\n promptPrefix: true,\n // Model parameters\n /** @endpoints openAI, custom, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock */\n model: true,\n /** @endpoints openAI, custom, azureOpenAI, google, anthropic, bedrock */\n temperature: true,\n /** @endpoints openAI, custom, azureOpenAI */\n presence_penalty: true,\n /** @endpoints openAI, custom, azureOpenAI */\n frequency_penalty: true,\n /** @endpoints openAI, custom, azureOpenAI */\n stop: true,\n /** @endpoints openAI, custom, azureOpenAI */\n top_p: true,\n /** @endpoints openAI, custom, azureOpenAI */\n max_tokens: true,\n /** @endpoints google, anthropic, bedrock */\n topP: true,\n /** @endpoints google, anthropic */\n topK: true,\n /** @endpoints google, anthropic */\n maxOutputTokens: true,\n /** @endpoints anthropic */\n promptCache: true,\n thinking: true,\n thinkingBudget: true,\n /** @endpoints bedrock */\n region: true,\n /** @endpoints bedrock */\n maxTokens: true,\n /** @endpoints agents */\n agent_id: true,\n /** @endpoints assistants, azureAssistants */\n assistant_id: true,\n /** @endpoints assistants, azureAssistants */\n append_current_datetime: true,\n /**\n * @endpoints assistants, azureAssistants\n *\n * Overrides existing assistant instructions, only used for the current run:\n * https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-instructions\n * */\n instructions: true,\n })\n .merge(\n z.object({\n /** @endpoints openAI, custom, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock, agents */\n endpoint: extendedModelEndpointSchema.nullable(),\n }),\n );\n\nexport type TPreset = z.infer<typeof tPresetSchema>;\n\nexport type TSetOption = (\n param: number | string,\n) => (newValue: number | string | boolean | string[] | Partial<TPreset>) => void;\n\nexport type TConversation = z.infer<typeof tConversationSchema> & {\n presetOverride?: Partial<TPreset>;\n disableParams?: boolean;\n};\n\nexport const tSharedLinkSchema = z.object({\n conversationId: z.string(),\n shareId: z.string(),\n messages: z.array(z.string()),\n isPublic: z.boolean(),\n title: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nexport type TSharedLink = z.infer<typeof tSharedLinkSchema>;\n\nexport const tConversationTagSchema = z.object({\n _id: z.string(),\n user: z.string(),\n tag: z.string(),\n description: z.string().optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n count: z.number(),\n position: z.number(),\n});\nexport type TConversationTag = z.infer<typeof tConversationTagSchema>;\n\nexport const googleBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n promptPrefix: true,\n examples: true,\n temperature: true,\n maxOutputTokens: true,\n artifacts: true,\n topP: true,\n topK: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n});\n\nexport const googleSchema = googleBaseSchema\n .transform((obj: Partial<TConversation>) => removeNullishValues(obj))\n .catch(() => ({}));\n\n/**\n * TODO: Map the following fields:\n - presence_penalty -> presencePenalty\n - frequency_penalty -> frequencyPenalty\n - stop -> stopSequences\n */\nexport const googleGenConfigSchema = z\n .object({\n maxOutputTokens: coerceNumber.optional(),\n temperature: coerceNumber.optional(),\n topP: coerceNumber.optional(),\n topK: coerceNumber.optional(),\n presencePenalty: coerceNumber.optional(),\n frequencyPenalty: coerceNumber.optional(),\n stopSequences: z.array(z.string()).optional(),\n })\n .strip()\n .optional();\n\nconst gptPluginsBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n chatGptLabel: true,\n promptPrefix: true,\n temperature: true,\n artifacts: true,\n top_p: true,\n presence_penalty: true,\n frequency_penalty: true,\n tools: true,\n agentOptions: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n});\n\nexport const gptPluginsSchema = gptPluginsBaseSchema\n .transform((obj) => {\n const result = {\n ...obj,\n model: obj.model ?? 'gpt-3.5-turbo',\n chatGptLabel: obj.chatGptLabel ?? obj.modelLabel ?? null,\n promptPrefix: obj.promptPrefix ?? null,\n temperature: obj.temperature ?? 0.8,\n top_p: obj.top_p ?? 1,\n presence_penalty: obj.presence_penalty ?? 0,\n frequency_penalty: obj.frequency_penalty ?? 0,\n tools: obj.tools ?? [],\n agentOptions: obj.agentOptions ?? {\n agent: EAgent.functions,\n skipCompletion: true,\n model: 'gpt-3.5-turbo',\n temperature: 0,\n },\n iconURL: obj.iconURL ?? undefined,\n greeting: obj.greeting ?? undefined,\n spec: obj.spec ?? undefined,\n maxContextTokens: obj.maxContextTokens ?? undefined,\n };\n\n if (obj.modelLabel != null && obj.modelLabel !== '') {\n result.modelLabel = null;\n }\n\n return result;\n })\n .catch(() => ({\n model: 'gpt-3.5-turbo',\n chatGptLabel: null,\n promptPrefix: null,\n temperature: 0.8,\n top_p: 1,\n presence_penalty: 0,\n frequency_penalty: 0,\n tools: [],\n agentOptions: {\n agent: EAgent.functions,\n skipCompletion: true,\n model: 'gpt-3.5-turbo',\n temperature: 0,\n },\n iconURL: undefined,\n greeting: undefined,\n spec: undefined,\n maxContextTokens: undefined,\n }));\n\nexport function removeNullishValues<T extends Record<string, unknown>>(\n obj: T,\n removeEmptyStrings?: boolean,\n): Partial<T> {\n const newObj: Partial<T> = { ...obj };\n\n (Object.keys(newObj) as Array<keyof T>).forEach((key) => {\n const value = newObj[key];\n if (value === undefined || value === null) {\n delete newObj[key];\n }\n if (removeEmptyStrings && typeof value === 'string' && value === '') {\n delete newObj[key];\n }\n });\n\n return newObj;\n}\n\nconst assistantBaseSchema = tConversationSchema.pick({\n model: true,\n assistant_id: true,\n instructions: true,\n artifacts: true,\n promptPrefix: true,\n iconURL: true,\n greeting: true,\n spec: true,\n append_current_datetime: true,\n});\n\nexport const assistantSchema = assistantBaseSchema\n .transform((obj) => ({\n ...obj,\n model: obj.model ?? openAISettings.model.default,\n assistant_id: obj.assistant_id ?? undefined,\n instructions: obj.instructions ?? undefined,\n promptPrefix: obj.promptPrefix ?? null,\n iconURL: obj.iconURL ?? undefined,\n greeting: obj.greeting ?? undefined,\n spec: obj.spec ?? undefined,\n append_current_datetime: obj.append_current_datetime ?? false,\n }))\n .catch(() => ({\n model: openAISettings.model.default,\n assistant_id: undefined,\n instructions: undefined,\n promptPrefix: null,\n iconURL: undefined,\n greeting: undefined,\n spec: undefined,\n append_current_datetime: false,\n }));\n\nconst compactAssistantBaseSchema = tConversationSchema.pick({\n model: true,\n assistant_id: true,\n instructions: true,\n promptPrefix: true,\n artifacts: true,\n iconURL: true,\n greeting: true,\n spec: true,\n});\n\nexport const compactAssistantSchema = compactAssistantBaseSchema\n .transform((obj) => removeNullishValues(obj))\n .catch(() => ({}));\n\nexport const agentsBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n temperature: true,\n top_p: true,\n presence_penalty: true,\n frequency_penalty: true,\n resendFiles: true,\n imageDetail: true,\n agent_id: true,\n instructions: true,\n promptPrefix: true,\n iconURL: true,\n greeting: true,\n maxContextTokens: true,\n});\n\nexport const agentsSchema = agentsBaseSchema\n .transform((obj) => ({\n ...obj,\n model: obj.model ?? agentsSettings.model.default,\n modelLabel: obj.modelLabel ?? null,\n temperature: obj.temperature ?? 1,\n top_p: obj.top_p ?? 1,\n presence_penalty: obj.presence_penalty ?? 0,\n frequency_penalty: obj.frequency_penalty ?? 0,\n resendFiles:\n typeof obj.resendFiles === 'boolean' ? obj.resendFiles : agentsSettings.resendFiles.default,\n imageDetail: obj.imageDetail ?? ImageDetail.auto,\n agent_id: obj.agent_id ?? undefined,\n instructions: obj.instructions ?? undefined,\n promptPrefix: obj.promptPrefix ?? null,\n iconURL: obj.iconURL ?? undefined,\n greeting: obj.greeting ?? undefined,\n maxContextTokens: obj.maxContextTokens ?? undefined,\n }))\n .catch(() => ({\n model: agentsSettings.model.default,\n modelLabel: null,\n temperature: 1,\n top_p: 1,\n presence_penalty: 0,\n frequency_penalty: 0,\n resendFiles: agentsSettings.resendFiles.default,\n imageDetail: ImageDetail.auto,\n agent_id: undefined,\n instructions: undefined,\n promptPrefix: null,\n iconURL: undefined,\n greeting: undefined,\n maxContextTokens: undefined,\n }));\n\nexport const openAIBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n chatGptLabel: true,\n promptPrefix: true,\n temperature: true,\n top_p: true,\n presence_penalty: true,\n frequency_penalty: true,\n resendFiles: true,\n artifacts: true,\n imageDetail: true,\n stop: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n max_tokens: true,\n reasoning_effort: true,\n});\n\nexport const openAISchema = openAIBaseSchema\n .transform((obj: Partial<TConversation>) => removeNullishValues(obj))\n .catch(() => ({}));\n\nexport const compactGoogleSchema = googleBaseSchema\n .transform((obj) => {\n const newObj: Partial<TConversation> = { ...obj };\n if (newObj.temperature === google.temperature.default) {\n delete newObj.temperature;\n }\n if (newObj.maxOutputTokens === google.maxOutputTokens.default) {\n delete newObj.maxOutputTokens;\n }\n if (newObj.topP === google.topP.default) {\n delete newObj.topP;\n }\n if (newObj.topK === google.topK.default) {\n delete newObj.topK;\n }\n\n return removeNullishValues(newObj);\n })\n .catch(() => ({}));\n\nexport const anthropicBaseSchema = tConversationSchema.pick({\n model: true,\n modelLabel: true,\n promptPrefix: true,\n temperature: true,\n maxOutputTokens: true,\n topP: true,\n topK: true,\n resendFiles: true,\n promptCache: true,\n thinking: true,\n thinkingBudget: true,\n artifacts: true,\n iconURL: true,\n greeting: true,\n spec: true,\n maxContextTokens: true,\n});\n\nexport const anthropicSchema = anthropicBaseSchema\n .transform((obj) => removeNullishValues(obj))\n .catch(() => ({}));\n\nexport const compactPluginsSchema = gptPluginsBaseSchema\n .transform((obj) => {\n const newObj: Partial<TConversation> = { ...obj };\n if (newObj.modelLabel === null) {\n delete newObj.modelLabel;\n }\n if (newObj.chatGptLabel === null) {\n delete newObj.chatGptLabel;\n }\n if (newObj.promptPrefix === null) {\n delete newObj.promptPrefix;\n }\n if (newObj.temperature === 0.8) {\n delete newObj.temperature;\n }\n if (newObj.top_p === 1) {\n delete newObj.top_p;\n }\n if (newObj.presence_penalty === 0) {\n delete newObj.presence_penalty;\n }\n if (newObj.frequency_penalty === 0) {\n delete newObj.frequency_penalty;\n }\n if (newObj.tools?.length === 0) {\n delete newObj.tools;\n }\n\n if (\n newObj.agentOptions &&\n newObj.agentOptions.agent === EAgent.functions &&\n newObj.agentOptions.skipCompletion === true &&\n newObj.agentOptions.model === 'gpt-3.5-turbo' &&\n newObj.agentOptions.temperature === 0\n ) {\n delete newObj.agentOptions;\n }\n\n return removeNullishValues(newObj);\n })\n .catch(() => ({}));\n\nexport const tBannerSchema = z.object({\n bannerId: z.string(),\n message: z.string(),\n displayFrom: z.string(),\n displayTo: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n isPublic: z.boolean(),\n});\nexport type TBanner = z.infer<typeof tBannerSchema>;\n\nexport const compactAgentsBaseSchema = tConversationSchema.pick({\n spec: true,\n // model: true,\n iconURL: true,\n greeting: true,\n agent_id: true,\n instructions: true,\n additional_instructions: true,\n});\n\nexport const compactAgentsSchema = compactAgentsBaseSchema\n .transform((obj) => removeNullishValues(obj))\n .catch(() => ({}));\n","import { z } from 'zod';\nimport type { TPreset } from './schemas';\nimport {\n EModelEndpoint,\n tPresetSchema,\n eModelEndpointSchema,\n AuthType,\n authTypeSchema,\n} from './schemas';\n\nexport type TModelSpec = {\n name: string;\n label: string;\n preset: TPreset;\n order?: number;\n default?: boolean;\n description?: string;\n showIconInMenu?: boolean;\n showIconInHeader?: boolean;\n iconURL?: string | EModelEndpoint; // Allow using project-included icons\n authType?: AuthType;\n};\n\nexport const tModelSpecSchema = z.object({\n name: z.string(),\n label: z.string(),\n preset: tPresetSchema,\n order: z.number().optional(),\n default: z.boolean().optional(),\n description: z.string().optional(),\n showIconInMenu: z.boolean().optional(),\n showIconInHeader: z.boolean().optional(),\n iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),\n authType: authTypeSchema.optional(),\n});\n\nexport const specsConfigSchema = z.object({\n enforce: z.boolean().default(false),\n prioritize: z.boolean().default(true),\n list: z.array(tModelSpecSchema).min(1),\n addedEndpoints: z.array(z.union([z.string(), eModelEndpointSchema])).optional(),\n});\n\nexport type TSpecsConfig = z.infer<typeof specsConfigSchema>;\n","/* eslint-disable max-len */\nimport { z } from 'zod';\nimport { EModelEndpoint } from './schemas';\nimport type { FileConfig, EndpointFileConfig } from './types/files';\n\nexport const supportsFiles = {\n [EModelEndpoint.openAI]: true,\n [EModelEndpoint.google]: true,\n [EModelEndpoint.assistants]: true,\n [EModelEndpoint.azureAssistants]: true,\n [EModelEndpoint.agents]: true,\n [EModelEndpoint.azureOpenAI]: true,\n [EModelEndpoint.anthropic]: true,\n [EModelEndpoint.custom]: true,\n [EModelEndpoint.bedrock]: true,\n};\n\nexport const excelFileTypes = [\n 'application/vnd.ms-excel',\n 'application/msexcel',\n 'application/x-msexcel',\n 'application/x-ms-excel',\n 'application/x-excel',\n 'application/x-dos_ms_excel',\n 'application/xls',\n 'application/x-xls',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n];\n\nexport const fullMimeTypesList = [\n 'text/x-c',\n 'text/x-c++',\n 'application/csv',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/html',\n 'text/x-java',\n 'application/json',\n 'text/markdown',\n 'application/pdf',\n 'text/x-php',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'text/x-python',\n 'text/x-script.python',\n 'text/x-ruby',\n 'text/x-tex',\n 'text/plain',\n 'text/css',\n 'text/vtt',\n 'image/jpeg',\n 'text/javascript',\n 'image/gif',\n 'image/png',\n 'application/x-tar',\n 'application/typescript',\n 'application/xml',\n 'application/zip',\n 'image/svg',\n 'image/svg+xml',\n ...excelFileTypes,\n];\n\nexport const codeInterpreterMimeTypesList = [\n 'text/x-c',\n 'text/x-c++',\n 'application/csv',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/html',\n 'text/x-java',\n 'application/json',\n 'text/markdown',\n 'application/pdf',\n 'text/x-php',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'text/x-python',\n 'text/x-script.python',\n 'text/x-ruby',\n 'text/x-tex',\n 'text/plain',\n 'text/css',\n 'image/jpeg',\n 'text/javascript',\n 'image/gif',\n 'image/png',\n 'application/x-tar',\n 'application/typescript',\n 'application/xml',\n 'application/zip',\n ...excelFileTypes,\n];\n\nexport const retrievalMimeTypesList = [\n 'text/x-c',\n 'text/x-c++',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/html',\n 'text/x-java',\n 'application/json',\n 'text/markdown',\n 'application/pdf',\n 'text/x-php',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'text/x-python',\n 'text/x-script.python',\n 'text/x-ruby',\n 'text/x-tex',\n 'text/plain',\n];\n\nexport const imageExtRegex = /\\.(jpg|jpeg|png|gif|webp)$/i;\n\nexport const excelMimeTypes =\n /^application\\/(vnd\\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\\.openxmlformats-officedocument\\.spreadsheetml\\.sheet)$/;\n\nexport const textMimeTypes =\n /^(text\\/(x-c|x-csharp|tab-separated-values|x-c\\+\\+|x-java|html|markdown|x-php|x-python|x-script\\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv))$/;\n\nexport const applicationMimeTypes =\n /^(application\\/(epub\\+zip|csv|json|pdf|x-tar|typescript|vnd\\.openxmlformats-officedocument\\.(wordprocessingml\\.document|presentationml\\.presentation|spreadsheetml\\.sheet)|xml|zip))$/;\n\nexport const imageMimeTypes = /^image\\/(jpeg|gif|png|webp)$/;\n\nexport const supportedMimeTypes = [\n textMimeTypes,\n excelMimeTypes,\n applicationMimeTypes,\n imageMimeTypes,\n /** Supported by LC Code Interpreter PAI */\n /^image\\/(svg|svg\\+xml)$/,\n];\n\nexport const codeInterpreterMimeTypes = [\n textMimeTypes,\n excelMimeTypes,\n applicationMimeTypes,\n imageMimeTypes,\n];\n\nexport const codeTypeMapping: { [key: string]: string } = {\n c: 'text/x-c',\n cs: 'text/x-csharp',\n cpp: 'text/x-c++',\n md: 'text/markdown',\n php: 'text/x-php',\n py: 'text/x-python',\n rb: 'text/x-ruby',\n tex: 'text/x-tex',\n js: 'text/javascript',\n sh: 'application/x-sh',\n ts: 'application/typescript',\n tar: 'application/x-tar',\n zip: 'application/zip',\n yml: 'application/x-yaml',\n yaml: 'application/x-yaml',\n log: 'text/plain',\n tsv: 'text/tab-separated-values',\n};\n\nexport const retrievalMimeTypes = [\n /^(text\\/(x-c|x-c\\+\\+|html|x-java|markdown|x-php|x-python|x-script\\.python|x-ruby|x-tex|plain|vtt|xml))$/,\n /^(application\\/(json|pdf|vnd\\.openxmlformats-officedocument\\.(wordprocessingml\\.document|presentationml\\.presentation)))$/,\n];\n\nexport const megabyte = 1024 * 1024;\n/** Helper function to get megabytes value */\nexport const mbToBytes = (mb: number): number => mb * megabyte;\n\nconst defaultSizeLimit = mbToBytes(512);\nconst assistantsFileConfig = {\n fileLimit: 10,\n fileSizeLimit: defaultSizeLimit,\n totalSizeLimit: defaultSizeLimit,\n supportedMimeTypes,\n disabled: false,\n};\n\nexport const fileConfig = {\n endpoints: {\n [EModelEndpoint.assistants]: assistantsFileConfig,\n [EModelEndpoint.azureAssistants]: assistantsFileConfig,\n [EModelEndpoint.agents]: assistantsFileConfig,\n default: {\n fileLimit: 10,\n fileSizeLimit: defaultSizeLimit,\n totalSizeLimit: defaultSizeLimit,\n supportedMimeTypes,\n disabled: false,\n },\n },\n serverFileSizeLimit: defaultSizeLimit,\n avatarSizeLimit: mbToBytes(2),\n checkType: function (fileType: string, supportedTypes: RegExp[] = supportedMimeTypes) {\n return supportedTypes.some((regex) => regex.test(fileType));\n },\n};\n\nconst supportedMimeTypesSchema = z\n .array(z.any())\n .optional()\n .refine(\n (mimeTypes) => {\n if (!mimeTypes) {\n return true;\n }\n return mimeTypes.every(\n (mimeType) => mimeType instanceof RegExp || typeof mimeType === 'string',\n );\n },\n {\n message: 'Each mimeType must be a string or a RegExp object.',\n },\n );\n\nexport const endpointFileConfigSchema = z.object({\n disabled: z.boolean().optional(),\n fileLimit: z.number().min(0).optional(),\n fileSizeLimit: z.number().min(0).optional(),\n totalSizeLimit: z.number().min(0).optional(),\n supportedMimeTypes: supportedMimeTypesSchema.optional(),\n});\n\nexport const fileConfigSchema = z.object({\n endpoints: z.record(endpointFileConfigSchema).optional(),\n serverFileSizeLimit: z.number().min(0).optional(),\n avatarSizeLimit: z.number().min(0).optional(),\n imageGeneration: z\n .object({\n percentage: z.number().min(0).max(100).optional(),\n px: z.number().min(0).optional(),\n })\n .optional(),\n});\n\n/** Helper function to safely convert string patterns to RegExp objects */\nexport const convertStringsToRegex = (patterns: string[]): RegExp[] =>\n patterns.reduce((acc: RegExp[], pattern) => {\n try {\n const regex = new RegExp(pattern);\n acc.push(regex);\n } catch (error) {\n console.error(`Invalid regex pattern \"${pattern}\" skipped.`, error);\n }\n return acc;\n }, []);\n\nexport function mergeFileConfig(dynamic: z.infer<typeof fileConfigSchema> | undefined): FileConfig {\n const mergedConfig = fileConfig as FileConfig;\n if (!dynamic) {\n return mergedConfig;\n }\n\n if (dynamic.serverFileSizeLimit !== undefined) {\n mergedConfig.serverFileSizeLimit = mbToBytes(dynamic.serverFileSizeLimit);\n }\n\n if (dynamic.avatarSizeLimit !== undefined) {\n mergedConfig.avatarSizeLimit = mbToBytes(dynamic.avatarSizeLimit);\n }\n\n if (!dynamic.endpoints) {\n return mergedConfig;\n }\n\n for (const key in dynamic.endpoints) {\n const dynamicEndpoint = (dynamic.endpoints as Record<string, EndpointFileConfig>)[key];\n\n if (!mergedConfig.endpoints[key]) {\n mergedConfig.endpoints[key] = {};\n }\n\n const mergedEndpoint = mergedConfig.endpoints[key];\n\n if (dynamicEndpoint.disabled === true) {\n mergedEndpoint.disabled = true;\n mergedEndpoint.fileLimit = 0;\n mergedEndpoint.fileSizeLimit = 0;\n mergedEndpoint.totalSizeLimit = 0;\n mergedEndpoint.supportedMimeTypes = [];\n continue;\n }\n\n if (dynamicEndpoint.fileSizeLimit !== undefined) {\n mergedEndpoint.fileSizeLimit = mbToBytes(dynamicEndpoint.fileSizeLimit);\n }\n\n if (dynamicEndpoint.totalSizeLimit !== undefined) {\n mergedEndpoint.totalSizeLimit = mbToBytes(dynamicEndpoint.totalSizeLimit);\n }\n\n const configKeys = ['fileLimit'] as const;\n configKeys.forEach((field) => {\n if (dynamicEndpoint[field] !== undefined) {\n mergedEndpoint[field] = dynamicEndpoint[field];\n }\n });\n\n if (dynamicEndpoint.supportedMimeTypes) {\n mergedEndpoint.supportedMimeTypes = convertStringsToRegex(\n dynamicEndpoint.supportedMimeTypes as unknown as string[],\n );\n }\n }\n\n return mergedConfig;\n}\n","import { EToolResources } from './assistants';\n\nexport enum FileSources {\n local = 'local',\n firebase = 'firebase',\n azure = 'azure',\n azure_blob = 'azure_blob',\n openai = 'openai',\n s3 = 's3',\n vectordb = 'vectordb',\n execute_code = 'execute_code',\n mistral_ocr = 'mistral_ocr',\n text = 'text',\n}\n\nexport const checkOpenAIStorage = (source: string) =>\n source === FileSources.openai || source === FileSources.azure;\n\nexport enum FileContext {\n avatar = 'avatar',\n unknown = 'unknown',\n agents = 'agents',\n assistants = 'assistants',\n execute_code = 'execute_code',\n image_generation = 'image_generation',\n assistants_output = 'assistants_output',\n message_attachment = 'message_attachment',\n filename = 'filename',\n updatedAt = 'updatedAt',\n source = 'source',\n filterSource = 'filterSource',\n context = 'context',\n bytes = 'bytes',\n}\n\nexport type EndpointFileConfig = {\n disabled?: boolean;\n fileLimit?: number;\n fileSizeLimit?: number;\n totalSizeLimit?: number;\n supportedMimeTypes?: RegExp[];\n};\n\nexport type FileConfig = {\n endpoints: {\n [key: string]: EndpointFileConfig;\n };\n serverFileSizeLimit?: number;\n avatarSizeLimit?: number;\n checkType?: (fileType: string, supportedTypes: RegExp[]) => boolean;\n};\n\nexport type TFile = {\n _id?: string;\n __v?: number;\n user: string;\n conversationId?: string;\n message?: string;\n file_id: string;\n temp_file_id?: string;\n bytes: number;\n embedded: boolean;\n filename: string;\n filepath: string;\n object: 'file';\n type: string;\n usage: number;\n context?: FileContext;\n source?: FileSources;\n filterSource?: FileSources;\n width?: number;\n height?: number;\n expiresAt?: string | Date;\n preview?: string;\n metadata?: { fileIdentifier?: string };\n createdAt?: string | Date;\n updatedAt?: string | Date;\n};\n\nexport type TFileUpload = TFile & {\n temp_file_id: string;\n};\n\nexport type AvatarUploadResponse = {\n url: string;\n};\n\nexport type SpeechToTextResponse = {\n text: string;\n};\n\nexport type VoiceResponse = string[];\n\nexport type UploadMutationOptions = {\n onSuccess?: (data: TFileUpload, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type UploadAvatarOptions = {\n onSuccess?: (data: AvatarUploadResponse, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type SpeechToTextOptions = {\n onSuccess?: (data: SpeechToTextResponse, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type TextToSpeechOptions = {\n onSuccess?: (data: ArrayBuffer, variables: FormData, context?: unknown) => void;\n onMutate?: (variables: FormData) => void | Promise<unknown>;\n onError?: (error: unknown, variables: FormData, context?: unknown) => void;\n};\n\nexport type VoiceOptions = {\n onSuccess?: (data: VoiceResponse, variables: unknown, context?: unknown) => void;\n onMutate?: () => void | Promise<unknown>;\n onError?: (error: unknown, variables: unknown, context?: unknown) => void;\n};\n\nexport type DeleteFilesResponse = {\n message: string;\n result: Record<string, unknown>;\n};\n\nexport type BatchFile = {\n file_id: string;\n filepath: string;\n embedded: boolean;\n source: FileSources;\n temp_file_id?: string;\n};\n\nexport type DeleteFilesBody = {\n files: BatchFile[];\n agent_id?: string;\n assistant_id?: string;\n tool_resource?: EToolResources;\n};\n\nexport type DeleteMutationOptions = {\n onSuccess?: (data: DeleteFilesResponse, variables: DeleteFilesBody, context?: unknown) => void;\n onMutate?: (variables: DeleteFilesBody) => void | Promise<unknown>;\n onError?: (error: unknown, variables: DeleteFilesBody, context?: unknown) => void;\n};\n","export const envVarRegex = /^\\${(.+)}$/;\n\n/** Extracts the environment variable name from a template literal string */\nexport function extractVariableName(value: string): string | null {\n if (!value) {\n return null;\n }\n\n const match = value.trim().match(envVarRegex);\n return match ? match[1] : null;\n}\n\n/** Extracts the value of an environment variable from a string. */\nexport function extractEnvVariable(value: string) {\n if (!value) {\n return value;\n }\n\n // Trim the input\n const trimmed = value.trim();\n\n // Special case: if it's just a single environment variable\n const singleMatch = trimmed.match(envVarRegex);\n if (singleMatch) {\n const varName = singleMatch[1];\n return process.env[varName] || trimmed;\n }\n\n // For multiple variables, process them using a regex loop\n const regex = /\\${([^}]+)}/g;\n let result = trimmed;\n\n // First collect all matches and their positions\n const matches = [];\n let match;\n while ((match = regex.exec(trimmed)) !== null) {\n matches.push({\n fullMatch: match[0],\n varName: match[1],\n index: match.index,\n });\n }\n\n // Process matches in reverse order to avoid position shifts\n for (let i = matches.length - 1; i >= 0; i--) {\n const { fullMatch, varName, index } = matches[i];\n const envValue = process.env[varName] || fullMatch;\n\n // Replace at exact position\n result = result.substring(0, index) + envValue + result.substring(index + fullMatch.length);\n }\n\n return result;\n}\n","import { z } from 'zod';\nimport { extractEnvVariable } from './utils';\n\nconst BaseOptionsSchema = z.object({\n iconPath: z.string().optional(),\n timeout: z.number().optional(),\n initTimeout: z.number().optional(),\n /** Controls visibility in chat dropdown menu (MCPSelect) */\n chatMenu: z.boolean().optional(),\n});\n\nexport const StdioOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('stdio').optional(),\n /**\n * The executable to run to start the server.\n */\n command: z.string(),\n /**\n * Command line arguments to pass to the executable.\n */\n args: z.array(z.string()),\n /**\n * The environment to use when spawning the process.\n *\n * If not specified, the result of getDefaultEnvironment() will be used.\n * Environment variables can be referenced using ${VAR_NAME} syntax.\n */\n env: z\n .record(z.string(), z.string())\n .optional()\n .transform((env) => {\n if (!env) {\n return env;\n }\n\n const processedEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(env)) {\n processedEnv[key] = extractEnvVariable(value);\n }\n return processedEnv;\n }),\n /**\n * How to handle stderr of the child process. This matches the semantics of Node's `child_process.spawn`.\n *\n * @type {import('node:child_process').IOType | import('node:stream').Stream | number}\n *\n * The default is \"inherit\", meaning messages to stderr will be printed to the parent process's stderr.\n */\n stderr: z.any().optional(),\n});\n\nexport const WebSocketOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('websocket').optional(),\n url: z\n .string()\n .transform((val: string) => extractEnvVariable(val))\n .pipe(z.string().url())\n .refine(\n (val: string) => {\n const protocol = new URL(val).protocol;\n return protocol === 'ws:' || protocol === 'wss:';\n },\n {\n message: 'WebSocket URL must start with ws:// or wss://',\n },\n ),\n});\n\nexport const SSEOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('sse').optional(),\n headers: z.record(z.string(), z.string()).optional(),\n url: z\n .string()\n .transform((val: string) => extractEnvVariable(val))\n .pipe(z.string().url())\n .refine(\n (val: string) => {\n const protocol = new URL(val).protocol;\n return protocol !== 'ws:' && protocol !== 'wss:';\n },\n {\n message: 'SSE URL must not start with ws:// or wss://',\n },\n ),\n});\n\nexport const StreamableHTTPOptionsSchema = BaseOptionsSchema.extend({\n type: z.literal('streamable-http'),\n headers: z.record(z.string(), z.string()).optional(),\n url: z\n .string()\n .transform((val: string) => extractEnvVariable(val))\n .pipe(z.string().url())\n .refine(\n (val: string) => {\n const protocol = new URL(val).protocol;\n return protocol !== 'ws:' && protocol !== 'wss:';\n },\n {\n message: 'Streamable HTTP URL must not start with ws:// or wss://',\n },\n ),\n});\n\nexport const MCPOptionsSchema = z.union([\n StdioOptionsSchema,\n WebSocketOptionsSchema,\n SSEOptionsSchema,\n StreamableHTTPOptionsSchema,\n]);\n\nexport const MCPServersSchema = z.record(z.string(), MCPOptionsSchema);\n\nexport type MCPOptions = z.infer<typeof MCPOptionsSchema>;\n\n/**\n * Recursively processes an object to replace environment variables in string values\n * @param {MCPOptions} obj - The object to process\n * @param {string} [userId] - The user ID\n * @returns {MCPOptions} - The processed object with environment variables replaced\n */\nexport function processMCPEnv(obj: Readonly<MCPOptions>, userId?: string): MCPOptions {\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n const newObj: MCPOptions = structuredClone(obj);\n\n if ('env' in newObj && newObj.env) {\n const processedEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(newObj.env)) {\n processedEnv[key] = extractEnvVariable(value);\n }\n newObj.env = processedEnv;\n } else if ('headers' in newObj && newObj.headers) {\n const processedHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(newObj.headers)) {\n if (value === '{{LIBRECHAT_USER_ID}}' && userId != null && userId) {\n processedHeaders[key] = userId;\n continue;\n }\n processedHeaders[key] = extractEnvVariable(value);\n }\n newObj.headers = processedHeaders;\n }\n\n if ('url' in newObj && newObj.url) {\n newObj.url = extractEnvVariable(newObj.url);\n }\n\n return newObj;\n}\n","import { z } from 'zod';\nimport type { ZodError } from 'zod';\nimport type { TModelsConfig } from './types';\nimport { EModelEndpoint, eModelEndpointSchema } from './schemas';\nimport { specsConfigSchema, TSpecsConfig } from './models';\nimport { fileConfigSchema } from './file-config';\nimport { FileSources } from './types/files';\nimport { MCPServersSchema } from './mcp';\n\nexport const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord'];\n\nexport const defaultRetrievalModels = [\n 'gpt-4o',\n 'o1-preview-2024-09-12',\n 'o1-preview',\n 'o1-mini-2024-09-12',\n 'o1-mini',\n 'o3-mini',\n 'chatgpt-4o-latest',\n 'gpt-4o-2024-05-13',\n 'gpt-4o-2024-08-06',\n 'gpt-4o-mini',\n 'gpt-4o-mini-2024-07-18',\n 'gpt-4-turbo-preview',\n 'gpt-3.5-turbo-0125',\n 'gpt-4-0125-preview',\n 'gpt-4-1106-preview',\n 'gpt-3.5-turbo-1106',\n 'gpt-3.5-turbo-0125',\n 'gpt-4-turbo',\n 'gpt-4-0125',\n 'gpt-4-1106',\n];\n\nexport const excludedKeys = new Set([\n 'conversationId',\n 'title',\n 'iconURL',\n 'greeting',\n 'endpoint',\n 'endpointType',\n 'createdAt',\n 'updatedAt',\n 'expiredAt',\n 'messages',\n 'isArchived',\n 'tags',\n 'user',\n '__v',\n '_id',\n 'tools',\n 'model',\n 'files',\n 'spec',\n 'disableParams',\n]);\n\nexport enum SettingsViews {\n default = 'default',\n advanced = 'advanced',\n}\n\nexport const fileSourceSchema = z.nativeEnum(FileSources);\n\n// Helper type to extract the shape of the Zod object schema\ntype SchemaShape<T> = T extends z.ZodObject<infer U> ? U : never;\n\n// Helper type to determine the default value or undefined based on whether the field has a default\ntype DefaultValue<T> =\n T extends z.ZodDefault<z.ZodTypeAny> ? ReturnType<T['_def']['defaultValue']> : undefined;\n\n// Extract default values or undefined from the schema shape\ntype ExtractDefaults<T> = {\n [P in keyof T]: DefaultValue<T[P]>;\n};\n\nexport type SchemaDefaults<T> = ExtractDefaults<SchemaShape<T>>;\n\nexport type TConfigDefaults = SchemaDefaults<typeof configSchema>;\n\nexport function getSchemaDefaults<Schema extends z.AnyZodObject>(\n schema: Schema,\n): ExtractDefaults<SchemaShape<Schema>> {\n const shape = schema.shape;\n const entries = Object.entries(shape).map(([key, value]) => {\n if (value instanceof z.ZodDefault) {\n // Extract default value if it exists\n return [key, value._def.defaultValue()];\n }\n return [key, undefined];\n });\n\n // Create the object with the right types\n return Object.fromEntries(entries) as ExtractDefaults<SchemaShape<Schema>>;\n}\n\nexport const modelConfigSchema = z\n .object({\n deploymentName: z.string().optional(),\n version: z.string().optional(),\n assistants: z.boolean().optional(),\n })\n .or(z.boolean());\n\nexport type TAzureModelConfig = z.infer<typeof modelConfigSchema>;\n\nexport const azureBaseSchema = z.object({\n apiKey: z.string(),\n serverless: z.boolean().optional(),\n instanceName: z.string().optional(),\n deploymentName: z.string().optional(),\n assistants: z.boolean().optional(),\n addParams: z.record(z.any()).optional(),\n dropParams: z.array(z.string()).optional(),\n forcePrompt: z.boolean().optional(),\n version: z.string().optional(),\n baseURL: z.string().optional(),\n additionalHeaders: z.record(z.any()).optional(),\n});\n\nexport type TAzureBaseSchema = z.infer<typeof azureBaseSchema>;\n\nexport const azureGroupSchema = z\n .object({\n group: z.string(),\n models: z.record(z.string(), modelConfigSchema),\n })\n .required()\n .and(azureBaseSchema);\n\nexport const azureGroupConfigsSchema = z.array(azureGroupSchema).min(1);\nexport type TAzureGroup = z.infer<typeof azureGroupSchema>;\nexport type TAzureGroups = z.infer<typeof azureGroupConfigsSchema>;\nexport type TAzureModelMapSchema = {\n // deploymentName?: string;\n // version?: string;\n group: string;\n};\n\nexport type TAzureModelGroupMap = Record<string, TAzureModelMapSchema | undefined>;\nexport type TAzureGroupMap = Record<\n string,\n (TAzureBaseSchema & { models: Record<string, TAzureModelConfig | undefined> }) | undefined\n>;\n\nexport type TValidatedAzureConfig = {\n modelNames: string[];\n modelGroupMap: TAzureModelGroupMap;\n groupMap: TAzureGroupMap;\n};\n\nexport type TAzureConfigValidationResult = TValidatedAzureConfig & {\n isValid: boolean;\n errors: (ZodError | string)[];\n};\n\nexport enum Capabilities {\n code_interpreter = 'code_interpreter',\n image_vision = 'image_vision',\n retrieval = 'retrieval',\n actions = 'actions',\n tools = 'tools',\n}\n\nexport enum AgentCapabilities {\n hide_sequential_outputs = 'hide_sequential_outputs',\n end_after_tools = 'end_after_tools',\n execute_code = 'execute_code',\n file_search = 'file_search',\n web_search = 'web_search',\n artifacts = 'artifacts',\n actions = 'actions',\n tools = 'tools',\n chain = 'chain',\n ocr = 'ocr',\n}\n\nexport const defaultAssistantsVersion = {\n [EModelEndpoint.assistants]: 2,\n [EModelEndpoint.azureAssistants]: 1,\n};\n\nexport const baseEndpointSchema = z.object({\n streamRate: z.number().optional(),\n baseURL: z.string().optional(),\n titlePrompt: z.string().optional(),\n titleModel: z.string().optional(),\n});\n\nexport type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;\n\nexport const bedrockEndpointSchema = baseEndpointSchema.merge(\n z.object({\n availableRegions: z.array(z.string()).optional(),\n }),\n);\n\nexport const assistantEndpointSchema = baseEndpointSchema.merge(\n z.object({\n /* assistants specific */\n disableBuilder: z.boolean().optional(),\n pollIntervalMs: z.number().optional(),\n timeoutMs: z.number().optional(),\n version: z.union([z.string(), z.number()]).default(2),\n supportedIds: z.array(z.string()).min(1).optional(),\n excludedIds: z.array(z.string()).min(1).optional(),\n privateAssistants: z.boolean().optional(),\n retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),\n capabilities: z\n .array(z.nativeEnum(Capabilities))\n .optional()\n .default([\n Capabilities.code_interpreter,\n Capabilities.image_vision,\n Capabilities.retrieval,\n Capabilities.actions,\n Capabilities.tools,\n ]),\n /* general */\n apiKey: z.string().optional(),\n models: z\n .object({\n default: z.array(z.string()).min(1),\n fetch: z.boolean().optional(),\n userIdQuery: z.boolean().optional(),\n })\n .optional(),\n titleConvo: z.boolean().optional(),\n titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),\n headers: z.record(z.any()).optional(),\n }),\n);\n\nexport type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;\n\nexport const defaultAgentCapabilities = [\n AgentCapabilities.execute_code,\n AgentCapabilities.file_search,\n AgentCapabilities.web_search,\n AgentCapabilities.artifacts,\n AgentCapabilities.actions,\n AgentCapabilities.tools,\n AgentCapabilities.chain,\n AgentCapabilities.ocr,\n];\n\nexport const agentsEndpointSChema = baseEndpointSchema.merge(\n z.object({\n /* agents specific */\n recursionLimit: z.number().optional(),\n disableBuilder: z.boolean().optional(),\n maxRecursionLimit: z.number().optional(),\n allowedProviders: z.array(z.union([z.string(), eModelEndpointSchema])).optional(),\n capabilities: z\n .array(z.nativeEnum(AgentCapabilities))\n .optional()\n .default(defaultAgentCapabilities),\n }),\n);\n\nexport type TAgentsEndpoint = z.infer<typeof agentsEndpointSChema>;\n\nexport const endpointSchema = baseEndpointSchema.merge(\n z.object({\n name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, {\n message: `Value cannot be one of the default endpoint (EModelEndpoint) values: ${Object.values(\n EModelEndpoint,\n ).join(', ')}`,\n }),\n apiKey: z.string(),\n baseURL: z.string(),\n models: z.object({\n default: z.array(z.string()).min(1),\n fetch: z.boolean().optional(),\n userIdQuery: z.boolean().optional(),\n }),\n titleConvo: z.boolean().optional(),\n titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),\n summarize: z.boolean().optional(),\n summaryModel: z.string().optional(),\n forcePrompt: z.boolean().optional(),\n modelDisplayLabel: z.string().optional(),\n headers: z.record(z.any()).optional(),\n addParams: z.record(z.any()).optional(),\n dropParams: z.array(z.string()).optional(),\n customParams: z\n .object({\n defaultParamsEndpoint: z.string().default('custom'),\n paramDefinitions: z.array(z.record(z.any())).optional(),\n })\n .strict(),\n customOrder: z.number().optional(),\n directEndpoint: z.boolean().optional(),\n titleMessageRole: z.string().optional(),\n }),\n);\n\nexport type TEndpoint = z.infer<typeof endpointSchema>;\n\nexport const azureEndpointSchema = z\n .object({\n groups: azureGroupConfigsSchema,\n plugins: z.boolean().optional(),\n assistants: z.boolean().optional(),\n })\n .and(\n endpointSchema\n .pick({\n streamRate: true,\n titleConvo: true,\n titleMethod: true,\n titleModel: true,\n summarize: true,\n summaryModel: true,\n customOrder: true,\n })\n .partial(),\n );\n\nexport type TAzureConfig = Omit<z.infer<typeof azureEndpointSchema>, 'groups'> &\n TAzureConfigValidationResult;\n\nconst ttsOpenaiSchema = z.object({\n url: z.string().optional(),\n apiKey: z.string(),\n model: z.string(),\n voices: z.array(z.string()),\n});\n\nconst ttsAzureOpenAISchema = z.object({\n instanceName: z.string(),\n apiKey: z.string(),\n deploymentName: z.string(),\n apiVersion: z.string(),\n model: z.string(),\n voices: z.array(z.string()),\n});\n\nconst ttsElevenLabsSchema = z.object({\n url: z.string().optional(),\n websocketUrl: z.string().optional(),\n apiKey: z.string(),\n model: z.string(),\n voices: z.array(z.string()),\n voice_settings: z\n .object({\n similarity_boost: z.number().optional(),\n stability: z.number().optional(),\n style: z.number().optional(),\n use_speaker_boost: z.boolean().optional(),\n })\n .optional(),\n pronunciation_dictionary_locators: z.array(z.string()).optional(),\n});\n\nconst ttsLocalaiSchema = z.object({\n url: z.string(),\n apiKey: z.string().optional(),\n voices: z.array(z.string()),\n backend: z.string(),\n});\n\nconst ttsSchema = z.object({\n openai: ttsOpenaiSchema.optional(),\n azureOpenAI: ttsAzureOpenAISchema.optional(),\n elevenlabs: ttsElevenLabsSchema.optional(),\n localai: ttsLocalaiSchema.optional(),\n});\n\nconst sttOpenaiSchema = z.object({\n url: z.string().optional(),\n apiKey: z.string(),\n model: z.string(),\n});\n\nconst sttAzureOpenAISchema = z.object({\n instanceName: z.string(),\n apiKey: z.string(),\n deploymentName: z.string(),\n apiVersion: z.string(),\n});\n\nconst sttSchema = z.object({\n openai: sttOpenaiSchema.optional(),\n azureOpenAI: sttAzureOpenAISchema.optional(),\n});\n\nconst speechTab = z\n .object({\n conversationMode: z.boolean().optional(),\n advancedMode: z.boolean().optional(),\n speechToText: z\n .boolean()\n .optional()\n .or(\n z.object({\n engineSTT: z.string().optional(),\n languageSTT: z.string().optional(),\n autoTranscribeAudio: z.boolean().optional(),\n decibelValue: z.number().optional(),\n autoSendText: z.number().optional(),\n }),\n )\n .optional(),\n textToSpeech: z\n .boolean()\n .optional()\n .or(\n z.object({\n engineTTS: z.string().optional(),\n voice: z.string().optional(),\n languageTTS: z.string().optional(),\n automaticPlayback: z.boolean().optional(),\n playbackRate: z.number().optional(),\n cacheTTS: z.boolean().optional(),\n }),\n )\n .optional(),\n })\n .optional();\n\nexport enum RateLimitPrefix {\n FILE_UPLOAD = 'FILE_UPLOAD',\n IMPORT = 'IMPORT',\n TTS = 'TTS',\n STT = 'STT',\n}\n\nexport const rateLimitSchema = z.object({\n fileUploads: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n conversationsImport: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n tts: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n stt: z\n .object({\n ipMax: z.number().optional(),\n ipWindowInMinutes: z.number().optional(),\n userMax: z.number().optional(),\n userWindowInMinutes: z.number().optional(),\n })\n .optional(),\n});\n\nexport enum EImageOutputType {\n PNG = 'png',\n WEBP = 'webp',\n JPEG = 'jpeg',\n}\n\nconst termsOfServiceSchema = z.object({\n externalUrl: z.string().optional(),\n openNewTab: z.boolean().optional(),\n modalAcceptance: z.boolean().optional(),\n modalTitle: z.string().optional(),\n modalContent: z.string().or(z.array(z.string())).optional(),\n});\n\nexport type TTermsOfService = z.infer<typeof termsOfServiceSchema>;\n\nexport const intefaceSchema = z\n .object({\n privacyPolicy: z\n .object({\n externalUrl: z.string().optional(),\n openNewTab: z.boolean().optional(),\n })\n .optional(),\n termsOfService: termsOfServiceSchema.optional(),\n customWelcome: z.string().optional(),\n endpointsMenu: z.boolean().optional(),\n modelSelect: z.boolean().optional(),\n parameters: z.boolean().optional(),\n sidePanel: z.boolean().optional(),\n multiConvo: z.boolean().optional(),\n bookmarks: z.boolean().optional(),\n presets: z.boolean().optional(),\n prompts: z.boolean().optional(),\n agents: z.boolean().optional(),\n temporaryChat: z.boolean().optional(),\n runCode: z.boolean().optional(),\n webSearch: z.boolean().optional(),\n })\n .default({\n endpointsMenu: true,\n modelSelect: true,\n parameters: true,\n sidePanel: true,\n presets: true,\n multiConvo: true,\n bookmarks: true,\n prompts: true,\n agents: true,\n temporaryChat: true,\n runCode: true,\n webSearch: true,\n });\n\nexport type TInterfaceConfig = z.infer<typeof intefaceSchema>;\nexport type TBalanceConfig = z.infer<typeof balanceSchema>;\n\nexport const turnstileOptionsSchema = z\n .object({\n language: z.string().default('auto'),\n size: z.enum(['normal', 'compact', 'flexible', 'invisible']).default('normal'),\n })\n .default({\n language: 'auto',\n size: 'normal',\n });\n\nexport const turnstileSchema = z.object({\n siteKey: z.string(),\n options: turnstileOptionsSchema.optional(),\n});\n\nexport type TTurnstileConfig = z.infer<typeof turnstileSchema>;\n\nexport type TStartupConfig = {\n appTitle: string;\n socialLogins?: string[];\n interface?: TInterfaceConfig;\n turnstile?: TTurnstileConfig;\n balance?: TBalanceConfig;\n discordLoginEnabled: boolean;\n facebookLoginEnabled: boolean;\n githubLoginEnabled: boolean;\n googleLoginEnabled: boolean;\n openidLoginEnabled: boolean;\n appleLoginEnabled: boolean;\n openidLabel: string;\n openidImageUrl: string;\n openidAutoRedirect: boolean;\n /** LDAP Auth Configuration */\n ldap?: {\n /** LDAP enabled */\n enabled: boolean;\n /** Whether LDAP uses username vs. email */\n username?: boolean;\n };\n serverDomain: string;\n emailLoginEnabled: boolean;\n registrationEnabled: boolean;\n socialLoginEnabled: boolean;\n passwordResetEnabled: boolean;\n emailEnabled: boolean;\n showBirthdayIcon: boolean;\n helpAndFaqURL: string;\n customFooter?: string;\n modelSpecs?: TSpecsConfig;\n sharedLinksEnabled: boolean;\n publicSharedLinksEnabled: boolean;\n analyticsGtmId?: string;\n instanceProjectId: string;\n bundlerURL?: string;\n staticBundlerURL?: string;\n webSearch?: {\n searchProvider?: SearchProviders;\n scraperType?: ScraperTypes;\n rerankerType?: RerankerTypes;\n };\n};\n\nexport enum OCRStrategy {\n MISTRAL_OCR = 'mistral_ocr',\n CUSTOM_OCR = 'custom_ocr',\n}\n\nexport enum SearchCategories {\n PROVIDERS = 'providers',\n SCRAPERS = 'scrapers',\n RERANKERS = 'rerankers',\n}\n\nexport enum SearchProviders {\n SERPER = 'serper',\n SEARXNG = 'searxng',\n}\n\nexport enum ScraperTypes {\n FIRECRAWL = 'firecrawl',\n SERPER = 'serper',\n}\n\nexport enum RerankerTypes {\n JINA = 'jina',\n COHERE = 'cohere',\n}\n\nexport enum SafeSearchTypes {\n OFF = 0,\n MODERATE = 1,\n STRICT = 2,\n}\n\nexport const webSearchSchema = z.object({\n serperApiKey: z.string().optional().default('${SERPER_API_KEY}'),\n firecrawlApiKey: z.string().optional().default('${FIRECRAWL_API_KEY}'),\n firecrawlApiUrl: z.string().optional().default('${FIRECRAWL_API_URL}'),\n jinaApiKey: z.string().optional().default('${JINA_API_KEY}'),\n cohereApiKey: z.string().optional().default('${COHERE_API_KEY}'),\n searchProvider: z.nativeEnum(SearchProviders).optional(),\n scraperType: z.nativeEnum(ScraperTypes).optional(),\n rerankerType: z.nativeEnum(RerankerTypes).optional(),\n scraperTimeout: z.number().optional(),\n safeSearch: z.nativeEnum(SafeSearchTypes).default(SafeSearchTypes.MODERATE),\n});\n\nexport type TWebSearchConfig = z.infer<typeof webSearchSchema>;\n\nexport const ocrSchema = z.object({\n mistralModel: z.string().optional(),\n apiKey: z.string().optional().default('${OCR_API_KEY}'),\n baseURL: z.string().optional().default('${OCR_BASEURL}'),\n strategy: z.nativeEnum(OCRStrategy).default(OCRStrategy.MISTRAL_OCR),\n});\n\nexport const balanceSchema = z.object({\n enabled: z.boolean().optional().default(false),\n startBalance: z.number().optional().default(20000),\n autoRefillEnabled: z.boolean().optional().default(false),\n refillIntervalValue: z.number().optional().default(30),\n refillIntervalUnit: z\n .enum(['seconds', 'minutes', 'hours', 'days', 'weeks', 'months'])\n .optional()\n .default('days'),\n refillAmount: z.number().optional().default(10000),\n});\n\nexport const configSchema = z.object({\n version: z.string(),\n cache: z.boolean().default(true),\n ocr: ocrSchema.optional(),\n webSearch: webSearchSchema.optional(),\n secureImageLinks: z.boolean().optional(),\n imageOutputType: z.nativeEnum(EImageOutputType).default(EImageOutputType.PNG),\n includedTools: z.array(z.string()).optional(),\n filteredTools: z.array(z.string()).optional(),\n mcpServers: MCPServersSchema.optional(),\n interface: intefaceSchema,\n turnstile: turnstileSchema.optional(),\n fileStrategy: fileSourceSchema.default(FileSources.local),\n actions: z\n .object({\n allowedDomains: z.array(z.string()).optional(),\n })\n .optional(),\n registration: z\n .object({\n socialLogins: z.array(z.string()).optional(),\n allowedDomains: z.array(z.string()).optional(),\n })\n .default({ socialLogins: defaultSocialLogins }),\n balance: balanceSchema.optional(),\n speech: z\n .object({\n tts: ttsSchema.optional(),\n stt: sttSchema.optional(),\n speechTab: speechTab.optional(),\n })\n .optional(),\n rateLimits: rateLimitSchema.optional(),\n fileConfig: fileConfigSchema.optional(),\n modelSpecs: specsConfigSchema.optional(),\n endpoints: z\n .object({\n all: baseEndpointSchema.optional(),\n [EModelEndpoint.openAI]: baseEndpointSchema.optional(),\n [EModelEndpoint.google]: baseEndpointSchema.optional(),\n [EModelEndpoint.anthropic]: baseEndpointSchema.optional(),\n [EModelEndpoint.gptPlugins]: baseEndpointSchema.optional(),\n [EModelEndpoint.azureOpenAI]: azureEndpointSchema.optional(),\n [EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),\n [EModelEndpoint.assistants]: assistantEndpointSchema.optional(),\n [EModelEndpoint.agents]: agentsEndpointSChema.optional(),\n [EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),\n [EModelEndpoint.bedrock]: baseEndpointSchema.optional(),\n })\n .strict()\n .refine((data) => Object.keys(data).length > 0, {\n message: 'At least one `endpoints` field must be provided.',\n })\n .optional(),\n});\n\nexport const getConfigDefaults = () => getSchemaDefaults(configSchema);\n\nexport type TCustomConfig = z.infer<typeof configSchema>;\n\nexport type TProviderSchema =\n | z.infer<typeof ttsOpenaiSchema>\n | z.infer<typeof ttsElevenLabsSchema>\n | z.infer<typeof ttsLocalaiSchema>\n | undefined;\n\nexport enum KnownEndpoints {\n anyscale = 'anyscale',\n apipie = 'apipie',\n cohere = 'cohere',\n fireworks = 'fireworks',\n deepseek = 'deepseek',\n groq = 'groq',\n huggingface = 'huggingface',\n mistral = 'mistral',\n mlx = 'mlx',\n ollama = 'ollama',\n openrouter = 'openrouter',\n perplexity = 'perplexity',\n shuttleai = 'shuttleai',\n 'together.ai' = 'together.ai',\n unify = 'unify',\n xai = 'xai',\n}\n\nexport enum FetchTokenConfig {\n openrouter = KnownEndpoints.openrouter,\n}\n\nexport const defaultEndpoints: EModelEndpoint[] = [\n EModelEndpoint.openAI,\n EModelEndpoint.assistants,\n EModelEndpoint.azureAssistants,\n EModelEndpoint.azureOpenAI,\n EModelEndpoint.agents,\n EModelEndpoint.chatGPTBrowser,\n EModelEndpoint.gptPlugins,\n EModelEndpoint.google,\n EModelEndpoint.anthropic,\n EModelEndpoint.custom,\n EModelEndpoint.bedrock,\n];\n\nexport const alternateName = {\n [EModelEndpoint.openAI]: 'OpenAI',\n [EModelEndpoint.assistants]: 'Assistants',\n [EModelEndpoint.agents]: 'Agents',\n [EModelEndpoint.azureAssistants]: 'Azure Assistants',\n [EModelEndpoint.azureOpenAI]: 'Azure OpenAI',\n [EModelEndpoint.chatGPTBrowser]: 'ChatGPT',\n [EModelEndpoint.gptPlugins]: 'Plugins',\n [EModelEndpoint.google]: 'Google',\n [EModelEndpoint.anthropic]: 'Anthropic',\n [EModelEndpoint.custom]: 'Custom',\n [EModelEndpoint.bedrock]: 'AWS Bedrock',\n [KnownEndpoints.ollama]: 'Ollama',\n [KnownEndpoints.deepseek]: 'DeepSeek',\n [KnownEndpoints.xai]: 'xAI',\n};\n\nconst sharedOpenAIModels = [\n 'gpt-4o-mini',\n 'gpt-4o',\n 'gpt-4.5-preview',\n 'gpt-4.5-preview-2025-02-27',\n 'gpt-3.5-turbo',\n 'gpt-3.5-turbo-0125',\n 'gpt-4-turbo',\n 'gpt-4-turbo-2024-04-09',\n 'gpt-4-0125-preview',\n 'gpt-4-turbo-preview',\n 'gpt-4-1106-preview',\n 'gpt-3.5-turbo-1106',\n 'gpt-3.5-turbo-16k-0613',\n 'gpt-3.5-turbo-16k',\n 'gpt-4',\n 'gpt-4-0314',\n 'gpt-4-32k-0314',\n 'gpt-4-0613',\n 'gpt-3.5-turbo-0613',\n];\n\nconst sharedAnthropicModels = [\n 'claude-sonnet-4-20250514',\n 'claude-sonnet-4-latest',\n 'claude-opus-4-20250514',\n 'claude-opus-4-latest',\n 'claude-3-7-sonnet-latest',\n 'claude-3-7-sonnet-20250219',\n 'claude-3-5-haiku-20241022',\n 'claude-3-5-sonnet-20241022',\n 'claude-3-5-sonnet-20240620',\n 'claude-3-5-sonnet-latest',\n 'claude-3-opus-20240229',\n 'claude-3-sonnet-20240229',\n 'claude-3-haiku-20240307',\n 'claude-2.1',\n 'claude-2',\n 'claude-1.2',\n 'claude-1',\n 'claude-1-100k',\n 'claude-instant-1',\n 'claude-instant-1-100k',\n];\n\nexport const bedrockModels = [\n 'anthropic.claude-3-5-sonnet-20241022-v2:0',\n 'anthropic.claude-3-5-sonnet-20240620-v1:0',\n 'anthropic.claude-3-5-haiku-20241022-v1:0',\n 'anthropic.claude-3-haiku-20240307-v1:0',\n 'anthropic.claude-3-opus-20240229-v1:0',\n 'anthropic.claude-3-sonnet-20240229-v1:0',\n 'anthropic.claude-v2',\n 'anthropic.claude-v2:1',\n 'anthropic.claude-instant-v1',\n // 'cohere.command-text-v14', // no conversation history\n // 'cohere.command-light-text-v14', // no conversation history\n 'cohere.command-r-v1:0',\n 'cohere.command-r-plus-v1:0',\n 'meta.llama2-13b-chat-v1',\n 'meta.llama2-70b-chat-v1',\n 'meta.llama3-8b-instruct-v1:0',\n 'meta.llama3-70b-instruct-v1:0',\n 'meta.llama3-1-8b-instruct-v1:0',\n 'meta.llama3-1-70b-instruct-v1:0',\n 'meta.llama3-1-405b-instruct-v1:0',\n 'mistral.mistral-7b-instruct-v0:2',\n 'mistral.mixtral-8x7b-instruct-v0:1',\n 'mistral.mistral-large-2402-v1:0',\n 'mistral.mistral-large-2407-v1:0',\n 'mistral.mistral-small-2402-v1:0',\n 'ai21.jamba-instruct-v1:0',\n // 'ai21.j2-mid-v1', // no streaming\n // 'ai21.j2-ultra-v1', no conversation history\n 'amazon.titan-text-lite-v1',\n 'amazon.titan-text-express-v1',\n 'amazon.titan-text-premier-v1:0',\n];\n\nexport const defaultModels = {\n [EModelEndpoint.azureAssistants]: sharedOpenAIModels,\n [EModelEndpoint.assistants]: [...sharedOpenAIModels, 'chatgpt-4o-latest'],\n [EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)\n [EModelEndpoint.google]: [\n // Shared Google Models between Vertex AI & Gen AI\n // Gemini 2.0 Models\n 'gemini-2.0-flash-001',\n 'gemini-2.0-flash-exp',\n 'gemini-2.0-flash-lite',\n 'gemini-2.0-pro-exp-02-05',\n // Gemini 1.5 Models\n 'gemini-1.5-flash-001',\n 'gemini-1.5-flash-002',\n 'gemini-1.5-pro-001',\n 'gemini-1.5-pro-002',\n // Gemini 1.0 Models\n 'gemini-1.0-pro-001',\n ],\n [EModelEndpoint.anthropic]: sharedAnthropicModels,\n [EModelEndpoint.openAI]: [\n ...sharedOpenAIModels,\n 'chatgpt-4o-latest',\n 'gpt-4-vision-preview',\n 'gpt-3.5-turbo-instruct-0914',\n 'gpt-3.5-turbo-instruct',\n ],\n [EModelEndpoint.bedrock]: bedrockModels,\n};\n\nconst fitlerAssistantModels = (str: string) => {\n return /gpt-4|gpt-3\\\\.5/i.test(str) && !/vision|instruct/i.test(str);\n};\n\nconst openAIModels = defaultModels[EModelEndpoint.openAI];\n\nexport const initialModelsConfig: TModelsConfig = {\n initial: [],\n [EModelEndpoint.openAI]: openAIModels,\n [EModelEndpoint.assistants]: openAIModels.filter(fitlerAssistantModels),\n [EModelEndpoint.agents]: openAIModels, // TODO: Add agent models (agentsModels)\n [EModelEndpoint.gptPlugins]: openAIModels,\n [EModelEndpoint.azureOpenAI]: openAIModels,\n [EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],\n [EModelEndpoint.google]: defaultModels[EModelEndpoint.google],\n [EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],\n [EModelEndpoint.bedrock]: defaultModels[EModelEndpoint.bedrock],\n};\n\nexport const EndpointURLs: { [key in EModelEndpoint]: string } = {\n [EModelEndpoint.openAI]: `/api/ask/${EModelEndpoint.openAI}`,\n [EModelEndpoint.google]: `/api/ask/${EModelEndpoint.google}`,\n [EModelEndpoint.custom]: `/api/ask/${EModelEndpoint.custom}`,\n [EModelEndpoint.anthropic]: `/api/ask/${EModelEndpoint.anthropic}`,\n [EModelEndpoint.gptPlugins]: `/api/ask/${EModelEndpoint.gptPlugins}`,\n [EModelEndpoint.azureOpenAI]: `/api/ask/${EModelEndpoint.azureOpenAI}`,\n [EModelEndpoint.chatGPTBrowser]: `/api/ask/${EModelEndpoint.chatGPTBrowser}`,\n [EModelEndpoint.azureAssistants]: '/api/assistants/v1/chat',\n [EModelEndpoint.assistants]: '/api/assistants/v2/chat',\n [EModelEndpoint.agents]: `/api/${EModelEndpoint.agents}/chat`,\n [EModelEndpoint.bedrock]: `/api/${EModelEndpoint.bedrock}/chat`,\n};\n\nexport const modularEndpoints = new Set<EModelEndpoint | string>([\n EModelEndpoint.gptPlugins,\n EModelEndpoint.anthropic,\n EModelEndpoint.google,\n EModelEndpoint.openAI,\n EModelEndpoint.azureOpenAI,\n EModelEndpoint.custom,\n EModelEndpoint.agents,\n EModelEndpoint.bedrock,\n]);\n\nexport const supportsBalanceCheck = {\n [EModelEndpoint.custom]: true,\n [EModelEndpoint.openAI]: true,\n [EModelEndpoint.anthropic]: true,\n [EModelEndpoint.gptPlugins]: true,\n [EModelEndpoint.assistants]: true,\n [EModelEndpoint.agents]: true,\n [EModelEndpoint.azureAssistants]: true,\n [EModelEndpoint.azureOpenAI]: true,\n [EModelEndpoint.bedrock]: true,\n};\n\nexport const visionModels = [\n 'qwen-vl',\n 'grok-vision',\n 'grok-2-vision',\n 'grok-3',\n 'gpt-4o-mini',\n 'gpt-4o',\n 'gpt-4-turbo',\n 'gpt-4-vision',\n 'o4-mini',\n 'o3',\n 'o1',\n 'gpt-4.1',\n 'gpt-4.5',\n 'llava',\n 'llava-13b',\n 'gemini-pro-vision',\n 'claude-3',\n 'gemma',\n 'gemini-exp',\n 'gemini-1.5',\n 'gemini-2',\n 'gemini-3',\n 'moondream',\n 'llama3.2-vision',\n 'llama-3.2-11b-vision',\n 'llama-3-2-11b-vision',\n 'llama-3.2-90b-vision',\n 'llama-3-2-90b-vision',\n 'llama-4',\n 'claude-opus-4',\n 'claude-sonnet-4',\n 'claude-haiku-4',\n];\nexport enum VisionModes {\n generative = 'generative',\n agents = 'agents',\n}\n\nexport function validateVisionModel({\n model,\n additionalModels = [],\n availableModels,\n}: {\n model: string;\n additionalModels?: string[];\n availableModels?: string[];\n}) {\n if (!model) {\n return false;\n }\n\n if (model.includes('gpt-4-turbo-preview') || model.includes('o1-mini')) {\n return false;\n }\n\n if (availableModels && !availableModels.includes(model)) {\n return false;\n }\n\n return visionModels.concat(additionalModels).some((visionModel) => model.includes(visionModel));\n}\n\nexport const imageGenTools = new Set(['dalle', 'dall-e', 'stable-diffusion', 'flux']);\n\n/**\n * Enum for collections using infinite queries\n */\nexport enum InfiniteCollections {\n /**\n * Collection for Prompt Groups\n */\n PROMPT_GROUPS = 'promptGroups',\n /**\n * Collection for Shared Links\n */\n SHARED_LINKS = 'sharedLinks',\n}\n\n/**\n * Enum for time intervals\n */\nexport enum Time {\n ONE_HOUR = 3600000,\n THIRTY_MINUTES = 1800000,\n TEN_MINUTES = 600000,\n FIVE_MINUTES = 300000,\n TWO_MINUTES = 120000,\n ONE_MINUTE = 60000,\n THIRTY_SECONDS = 30000,\n}\n\n/**\n * Enum for cache keys.\n */\nexport enum CacheKeys {\n /**\n * Key for the config store namespace.\n */\n CONFIG_STORE = 'configStore',\n /**\n * Key for the config store namespace.\n */\n ROLES = 'roles',\n /**\n * Key for the plugins cache.\n */\n PLUGINS = 'plugins',\n /**\n * Key for the title generation cache.\n */\n GEN_TITLE = 'genTitle',\n /**\n /**\n * Key for the tools cache.\n */\n TOOLS = 'tools',\n /**\n * Key for the model config cache.\n */\n MODELS_CONFIG = 'modelsConfig',\n /**\n * Key for the model queries cache.\n */\n MODEL_QUERIES = 'modelQueries',\n /**\n * Key for the default startup config cache.\n */\n STARTUP_CONFIG = 'startupConfig',\n /**\n * Key for the default endpoint config cache.\n */\n ENDPOINT_CONFIG = 'endpointsConfig',\n /**\n * Key for accessing the model token config cache.\n */\n TOKEN_CONFIG = 'tokenConfig',\n /**\n * Key for the custom config cache.\n */\n CUSTOM_CONFIG = 'customConfig',\n /**\n * Key for accessing Abort Keys\n */\n ABORT_KEYS = 'abortKeys',\n /**\n * Key for the override config cache.\n */\n OVERRIDE_CONFIG = 'overrideConfig',\n /**\n * Key for the bans cache.\n */\n BANS = 'bans',\n /**\n * Key for the encoded domains cache.\n * Used by Azure OpenAI Assistants.\n */\n ENCODED_DOMAINS = 'encoded_domains',\n /**\n * Key for the cached audio run Ids.\n */\n AUDIO_RUNS = 'audioRuns',\n /**\n * Key for in-progress messages.\n */\n MESSAGES = 'messages',\n /**\n * Key for in-progress flow states.\n */\n FLOWS = 'flows',\n /**\n * Key for pending chat requests (concurrency check)\n */\n PENDING_REQ = 'pending_req',\n /**\n * Key for s3 check intervals per user\n */\n S3_EXPIRY_INTERVAL = 'S3_EXPIRY_INTERVAL',\n /**\n * key for open id exchanged tokens\n */\n OPENID_EXCHANGED_TOKENS = 'OPENID_EXCHANGED_TOKENS',\n}\n\n/**\n * Enum for violation types, used to identify, log, and cache violations.\n */\nexport enum ViolationTypes {\n /**\n * File Upload Violations (exceeding limit).\n */\n FILE_UPLOAD_LIMIT = 'file_upload_limit',\n /**\n * Illegal Model Request (not available).\n */\n ILLEGAL_MODEL_REQUEST = 'illegal_model_request',\n /**\n * Token Limit Violation.\n */\n TOKEN_BALANCE = 'token_balance',\n /**\n * An issued ban.\n */\n BAN = 'ban',\n /**\n * TTS Request Limit Violation.\n */\n TTS_LIMIT = 'tts_limit',\n /**\n * STT Request Limit Violation.\n */\n STT_LIMIT = 'stt_limit',\n /**\n * Reset Password Limit Violation.\n */\n RESET_PASSWORD_LIMIT = 'reset_password_limit',\n /**\n * Verify Email Limit Violation.\n */\n VERIFY_EMAIL_LIMIT = 'verify_email_limit',\n /**\n * Verify Conversation Access violation.\n */\n CONVO_ACCESS = 'convo_access',\n /**\n * Tool Call Limit Violation.\n */\n TOOL_CALL_LIMIT = 'tool_call_limit',\n}\n\n/**\n * Enum for error message types that are not \"violations\" as above, used to identify client-facing errors.\n */\nexport enum ErrorTypes {\n /**\n * No User-provided Key.\n */\n NO_USER_KEY = 'no_user_key',\n /**\n * Expired User-provided Key.\n */\n EXPIRED_USER_KEY = 'expired_user_key',\n /**\n * Invalid User-provided Key.\n */\n INVALID_USER_KEY = 'invalid_user_key',\n /**\n * No Base URL Provided.\n */\n NO_BASE_URL = 'no_base_url',\n /**\n * Moderation error\n */\n MODERATION = 'moderation',\n /**\n * Prompt exceeds max length\n */\n INPUT_LENGTH = 'INPUT_LENGTH',\n /**\n * Invalid request error, API rejected request\n */\n INVALID_REQUEST = 'invalid_request_error',\n /**\n * Invalid action request error, likely not on list of allowed domains\n */\n INVALID_ACTION = 'invalid_action_error',\n /**\n * Invalid request error, API rejected request\n */\n NO_SYSTEM_MESSAGES = 'no_system_messages',\n /**\n * Google provider returned an error\n */\n GOOGLE_ERROR = 'google_error',\n /**\n * Invalid Agent Provider (excluded by Admin)\n */\n INVALID_AGENT_PROVIDER = 'invalid_agent_provider',\n}\n\n/**\n * Enum for authentication keys.\n */\nexport enum AuthKeys {\n /**\n * Key for the Service Account to use Vertex AI.\n */\n GOOGLE_SERVICE_KEY = 'GOOGLE_SERVICE_KEY',\n /**\n * API key to use Google Generative AI.\n *\n * Note: this is not for Environment Variables, but to access encrypted object values.\n */\n GOOGLE_API_KEY = 'GOOGLE_API_KEY',\n}\n\n/**\n * Enum for Image Detail Cost.\n *\n * **Low Res Fixed Cost:** `85`\n *\n * **High Res Calculation:**\n *\n * Number of `512px` Tiles * `170` + `85` (Additional Cost)\n */\nexport enum ImageDetailCost {\n /**\n * Low resolution is a fixed value.\n */\n LOW = 85,\n /**\n * High resolution Cost Per Tile\n */\n HIGH = 170,\n /**\n * Additional Cost added to High Resolution Total Cost\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n ADDITIONAL = 85,\n}\n\n/**\n * Tab values for Settings Dialog\n */\nexport enum SettingsTabValues {\n /**\n * Tab for General Settings\n */\n GENERAL = 'general',\n /**\n * Tab for Chat Settings\n */\n CHAT = 'chat',\n /**\n * Tab for Speech Settings\n */\n SPEECH = 'speech',\n /**\n * Tab for Beta Features\n */\n BETA = 'beta',\n /**\n * Tab for Data Controls\n */\n DATA = 'data',\n /**\n * Tab for Account Settings\n */\n ACCOUNT = 'account',\n /**\n * Chat input commands\n */\n COMMANDS = 'commands',\n}\n\nexport enum STTProviders {\n /**\n * Provider for OpenAI STT\n */\n OPENAI = 'openai',\n /**\n * Provider for Microsoft Azure STT\n */\n AZURE_OPENAI = 'azureOpenAI',\n}\n\nexport enum TTSProviders {\n /**\n * Provider for OpenAI TTS\n */\n OPENAI = 'openai',\n /**\n * Provider for Microsoft Azure OpenAI TTS\n */\n AZURE_OPENAI = 'azureOpenAI',\n /**\n * Provider for ElevenLabs TTS\n */\n ELEVENLABS = 'elevenlabs',\n /**\n * Provider for LocalAI TTS\n */\n LOCALAI = 'localai',\n}\n\n/** Enum for app-wide constants */\nexport enum Constants {\n /** Key for the app's version. */\n VERSION = 'v0.7.8',\n /** Key for the Custom Config's version (librechat.yaml). */\n CONFIG_VERSION = '1.2.6',\n /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */\n NO_PARENT = '00000000-0000-0000-0000-000000000000',\n /** Standard value for the initial conversationId before a request is sent */\n NEW_CONVO = 'new',\n /** Standard value for the temporary conversationId after a request is sent and before the server responds */\n PENDING_CONVO = 'PENDING',\n /** Standard value for the conversationId used for search queries */\n SEARCH = 'search',\n /** Fixed, encoded domain length for Azure OpenAI Assistants Function name parsing. */\n ENCODED_DOMAIN_LENGTH = 10,\n /** Identifier for using current_model in multi-model requests. */\n CURRENT_MODEL = 'current_model',\n /** Common divider for text values */\n COMMON_DIVIDER = '__',\n /** Max length for commands */\n COMMANDS_MAX_LENGTH = 56,\n /** Default Stream Rate (ms) */\n DEFAULT_STREAM_RATE = 1,\n /** Saved Tag */\n SAVED_TAG = 'Saved',\n /** Max number of Conversation starters for Agents/Assistants */\n MAX_CONVO_STARTERS = 4,\n /** Global/instance Project Name */\n GLOBAL_PROJECT_NAME = 'instance',\n /** Delimiter for MCP tools */\n mcp_delimiter = '_mcp_',\n /** Placeholder Agent ID for Ephemeral Agents */\n EPHEMERAL_AGENT_ID = 'ephemeral',\n}\n\nexport enum LocalStorageKeys {\n /** Key for the admin defined App Title */\n APP_TITLE = 'appTitle',\n /** Key for the last conversation setup. */\n LAST_CONVO_SETUP = 'lastConversationSetup',\n /** Key for the last selected model. */\n LAST_MODEL = 'lastSelectedModel',\n /** Key for the last selected tools. */\n LAST_TOOLS = 'lastSelectedTools',\n /** Key for the last selected spec by name*/\n LAST_SPEC = 'lastSelectedSpec',\n /** Key for temporary files to delete */\n FILES_TO_DELETE = 'filesToDelete',\n /** Prefix key for the last selected assistant ID by index */\n ASST_ID_PREFIX = 'assistant_id__',\n /** Prefix key for the last selected agent ID by index */\n AGENT_ID_PREFIX = 'agent_id__',\n /** Key for the last selected fork setting */\n FORK_SETTING = 'forkSetting',\n /** Key for remembering the last selected option, instead of manually selecting */\n REMEMBER_FORK_OPTION = 'rememberDefaultFork',\n /** Key for remembering the split at target fork option modifier */\n FORK_SPLIT_AT_TARGET = 'splitAtTarget',\n /** Key for saving text drafts */\n TEXT_DRAFT = 'textDraft_',\n /** Key for saving file drafts */\n FILES_DRAFT = 'filesDraft_',\n /** Key for last Selected Prompt Category */\n LAST_PROMPT_CATEGORY = 'lastPromptCategory',\n /** Key for rendering User Messages as Markdown */\n ENABLE_USER_MSG_MARKDOWN = 'enableUserMsgMarkdown',\n /** Key for displaying analysis tool code input */\n SHOW_ANALYSIS_CODE = 'showAnalysisCode',\n /** Last selected MCP values per conversation ID */\n LAST_MCP_ = 'LAST_MCP_',\n /** Last checked toggle for Code Interpreter API per conversation ID */\n LAST_CODE_TOGGLE_ = 'LAST_CODE_TOGGLE_',\n /** Last checked toggle for Web Search per conversation ID */\n LAST_WEB_SEARCH_TOGGLE_ = 'LAST_WEB_SEARCH_TOGGLE_',\n}\n\nexport enum ForkOptions {\n /** Key for direct path option */\n DIRECT_PATH = 'directPath',\n /** Key for including branches */\n INCLUDE_BRANCHES = 'includeBranches',\n /** Key for target level fork (default) */\n TARGET_LEVEL = 'targetLevel',\n /** Default option */\n DEFAULT = 'default',\n}\n\n/**\n * Enum for Cohere related constants\n */\nexport enum CohereConstants {\n /**\n * Cohere API Endpoint, for special handling\n */\n API_URL = 'https://api.cohere.ai/v1',\n /**\n * Role for \"USER\" messages\n */\n ROLE_USER = 'USER',\n /**\n * Role for \"SYSTEM\" messages\n */\n ROLE_SYSTEM = 'SYSTEM',\n /**\n * Role for \"CHATBOT\" messages\n */\n ROLE_CHATBOT = 'CHATBOT',\n /**\n * Title message as required by Cohere\n */\n TITLE_MESSAGE = 'TITLE:',\n}\n\nexport enum SystemCategories {\n ALL = 'sys__all__sys',\n MY_PROMPTS = 'sys__my__prompts__sys',\n NO_CATEGORY = 'sys__no__category__sys',\n SHARED_PROMPTS = 'sys__shared__prompts__sys',\n}\n\nexport const providerEndpointMap = {\n [EModelEndpoint.openAI]: EModelEndpoint.openAI,\n [EModelEndpoint.bedrock]: EModelEndpoint.bedrock,\n [EModelEndpoint.anthropic]: EModelEndpoint.anthropic,\n [EModelEndpoint.azureOpenAI]: EModelEndpoint.azureOpenAI,\n};\n\nexport const specialVariables = {\n current_date: true,\n current_user: true,\n iso_datetime: true,\n current_datetime: true,\n};\n\nexport type TSpecialVarLabel = `com_ui_special_var_${keyof typeof specialVariables}`;\n","import type { AssistantsEndpoint } from './schemas';\nimport * as q from './types/queries';\n\n// Testing this buildQuery function\nconst buildQuery = (params: Record<string, unknown>): string => {\n const query = Object.entries(params)\n .filter(([, value]) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return value !== undefined && value !== null && value !== '';\n })\n .map(([key, value]) => {\n if (Array.isArray(value)) {\n return value.map((v) => `${key}=${encodeURIComponent(v)}`).join('&');\n }\n return `${key}=${encodeURIComponent(String(value))}`;\n })\n .join('&');\n return query ? `?${query}` : '';\n};\n\nexport const health = () => '/health';\nexport const user = () => '/api/user';\n\nexport const balance = () => '/api/balance';\n\nexport const userPlugins = () => '/api/user/plugins';\n\nexport const deleteUser = () => '/api/user/delete';\n\nexport const messages = (params: q.MessagesListParams) => {\n const { conversationId, messageId, ...rest } = params;\n\n if (conversationId && messageId) {\n return `/api/messages/${conversationId}/${messageId}`;\n }\n\n if (conversationId) {\n return `/api/messages/${conversationId}`;\n }\n\n return `/api/messages${buildQuery(rest)}`;\n};\n\nconst shareRoot = '/api/share';\nexport const shareMessages = (shareId: string) => `${shareRoot}/${shareId}`;\nexport const getSharedLink = (conversationId: string) => `${shareRoot}/link/${conversationId}`;\nexport const getSharedLinks = (\n pageSize: number,\n isPublic: boolean,\n sortBy: 'title' | 'createdAt',\n sortDirection: 'asc' | 'desc',\n search?: string,\n cursor?: string,\n) =>\n `${shareRoot}?pageSize=${pageSize}&isPublic=${isPublic}&sortBy=${sortBy}&sortDirection=${sortDirection}${\n search ? `&search=${search}` : ''\n }${cursor ? `&cursor=${cursor}` : ''}`;\nexport const createSharedLink = (conversationId: string) => `${shareRoot}/${conversationId}`;\nexport const updateSharedLink = (shareId: string) => `${shareRoot}/${shareId}`;\n\nconst keysEndpoint = '/api/keys';\n\nexport const keys = () => keysEndpoint;\n\nexport const userKeyQuery = (name: string) => `${keysEndpoint}?name=${name}`;\n\nexport const revokeUserKey = (name: string) => `${keysEndpoint}/${name}`;\n\nexport const revokeAllUserKeys = () => `${keysEndpoint}?all=true`;\n\nexport const abortRequest = (endpoint: string) => `/api/ask/${endpoint}/abort`;\n\nexport const conversationsRoot = '/api/convos';\n\nexport const conversations = (params: q.ConversationListParams) => {\n return `${conversationsRoot}${buildQuery(params)}`;\n};\n\nexport const conversationById = (id: string) => `${conversationsRoot}/${id}`;\n\nexport const genTitle = () => `${conversationsRoot}/gen_title`;\n\nexport const updateConversation = () => `${conversationsRoot}/update`;\n\nexport const deleteConversation = () => `${conversationsRoot}`;\n\nexport const deleteAllConversation = () => `${conversationsRoot}/all`;\n\nexport const importConversation = () => `${conversationsRoot}/import`;\n\nexport const forkConversation = () => `${conversationsRoot}/fork`;\n\nexport const duplicateConversation = () => `${conversationsRoot}/duplicate`;\n\nexport const search = (q: string, cursor?: string | null) =>\n `/api/search?q=${q}${cursor ? `&cursor=${cursor}` : ''}`;\n\nexport const searchEnabled = () => '/api/search/enable';\n\nexport const presets = () => '/api/presets';\n\nexport const deletePreset = () => '/api/presets/delete';\n\nexport const aiEndpoints = () => '/api/endpoints';\n\nexport const endpointsConfigOverride = () => '/api/endpoints/config/override';\n\nexport const models = () => '/api/models';\n\nexport const tokenizer = () => '/api/tokenizer';\n\nexport const login = () => '/api/auth/login';\n\nexport const logout = () => '/api/auth/logout';\n\nexport const register = () => '/api/auth/register';\n\nexport const loginFacebook = () => '/api/auth/facebook';\n\nexport const loginGoogle = () => '/api/auth/google';\n\nexport const refreshToken = (retry?: boolean) =>\n `/api/auth/refresh${retry === true ? '?retry=true' : ''}`;\n\nexport const requestPasswordReset = () => '/api/auth/requestPasswordReset';\n\nexport const resetPassword = () => '/api/auth/resetPassword';\n\nexport const verifyEmail = () => '/api/user/verify';\n\nexport const resendVerificationEmail = () => '/api/user/verify/resend';\n\nexport const plugins = () => '/api/plugins';\n\nexport const config = () => '/api/config';\n\nexport const prompts = () => '/api/prompts';\n\nexport const assistants = ({\n path = '',\n options,\n version,\n endpoint,\n isAvatar,\n}: {\n path?: string;\n options?: object;\n endpoint?: AssistantsEndpoint;\n version: number | string;\n isAvatar?: boolean;\n}) => {\n let url = isAvatar === true ? `${images()}/assistants` : `/api/assistants/v${version}`;\n\n if (path && path !== '') {\n url += `/${path}`;\n }\n\n if (endpoint) {\n options = {\n ...(options ?? {}),\n endpoint,\n };\n }\n\n if (options && Object.keys(options).length > 0) {\n const queryParams = new URLSearchParams(options as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n\n return url;\n};\n\nexport const agents = ({ path = '', options }: { path?: string; options?: object }) => {\n let url = '/api/agents';\n\n if (path && path !== '') {\n url += `/${path}`;\n }\n\n if (options && Object.keys(options).length > 0) {\n const queryParams = new URLSearchParams(options as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n\n return url;\n};\n\nexport const revertAgentVersion = (agent_id: string) => `${agents({ path: `${agent_id}/revert` })}`;\n\nexport const files = () => '/api/files';\n\nexport const images = () => `${files()}/images`;\n\nexport const avatar = () => `${images()}/avatar`;\n\nexport const speech = () => `${files()}/speech`;\n\nexport const speechToText = () => `${speech()}/stt`;\n\nexport const textToSpeech = () => `${speech()}/tts`;\n\nexport const textToSpeechManual = () => `${textToSpeech()}/manual`;\n\nexport const textToSpeechVoices = () => `${textToSpeech()}/voices`;\n\nexport const getCustomConfigSpeech = () => `${speech()}/config/get`;\n\nexport const getPromptGroup = (_id: string) => `${prompts()}/groups/${_id}`;\n\nexport const getPromptGroupsWithFilters = (filter: object) => {\n let url = `${prompts()}/groups`;\n if (Object.keys(filter).length > 0) {\n const queryParams = new URLSearchParams(filter as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n return url;\n};\n\nexport const getPromptsWithFilters = (filter: object) => {\n let url = prompts();\n if (Object.keys(filter).length > 0) {\n const queryParams = new URLSearchParams(filter as Record<string, string>).toString();\n url += `?${queryParams}`;\n }\n return url;\n};\n\nexport const getPrompt = (_id: string) => `${prompts()}/${_id}`;\n\nexport const getRandomPrompts = (limit: number, skip: number) =>\n `${prompts()}/random?limit=${limit}&skip=${skip}`;\n\nexport const postPrompt = prompts;\n\nexport const updatePromptGroup = getPromptGroup;\n\nexport const updatePromptLabels = (_id: string) => `${getPrompt(_id)}/labels`;\n\nexport const updatePromptTag = (_id: string) => `${getPrompt(_id)}/tags/production`;\n\nexport const deletePromptGroup = getPromptGroup;\n\nexport const deletePrompt = ({ _id, groupId }: { _id: string; groupId: string }) => {\n return `${prompts()}/${_id}?groupId=${groupId}`;\n};\n\nexport const getCategories = () => '/api/categories';\n\nexport const getAllPromptGroups = () => `${prompts()}/all`;\n\n/* Roles */\nexport const roles = () => '/api/roles';\nexport const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;\nexport const updatePromptPermissions = (roleName: string) => `${getRole(roleName)}/prompts`;\nexport const updateAgentPermissions = (roleName: string) => `${getRole(roleName)}/agents`;\n\n/* Conversation Tags */\nexport const conversationTags = (tag?: string) =>\n `/api/tags${tag != null && tag ? `/${encodeURIComponent(tag)}` : ''}`;\n\nexport const conversationTagsList = (pageNumber: string, sort?: string, order?: string) =>\n `${conversationTags()}/list?pageNumber=${pageNumber}${sort ? `&sort=${sort}` : ''}${\n order ? `&order=${order}` : ''\n }`;\n\nexport const addTagToConversation = (conversationId: string) =>\n `${conversationTags()}/convo/${conversationId}`;\n\nexport const userTerms = () => '/api/user/terms';\nexport const acceptUserTerms = () => '/api/user/terms/accept';\nexport const banner = () => '/api/banner';\n\n// Two-Factor Endpoints\nexport const enableTwoFactor = () => '/api/auth/2fa/enable';\nexport const verifyTwoFactor = () => '/api/auth/2fa/verify';\nexport const confirmTwoFactor = () => '/api/auth/2fa/confirm';\nexport const disableTwoFactor = () => '/api/auth/2fa/disable';\nexport const regenerateBackupCodes = () => '/api/auth/2fa/backup/regenerate';\nexport const verifyTwoFactorTemp = () => '/api/auth/2fa/verify-temp';\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport axios, { AxiosError, AxiosRequestConfig } from 'axios';\nimport * as endpoints from './api-endpoints';\nimport { setTokenHeader } from './headers-helpers';\nimport type * as t from './types';\n\nasync function _get<T>(url: string, options?: AxiosRequestConfig): Promise<T> {\n const response = await axios.get(url, { ...options });\n return response.data;\n}\n\nasync function _getResponse<T>(url: string, options?: AxiosRequestConfig): Promise<T> {\n return await axios.get(url, { ...options });\n}\n\nasync function _post(url: string, data?: any) {\n const response = await axios.post(url, JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json' },\n });\n return response.data;\n}\n\nasync function _postMultiPart(url: string, formData: FormData, options?: AxiosRequestConfig) {\n const response = await axios.post(url, formData, {\n ...options,\n headers: { 'Content-Type': 'multipart/form-data' },\n });\n return response.data;\n}\n\nasync function _postTTS(url: string, formData: FormData, options?: AxiosRequestConfig) {\n const response = await axios.post(url, formData, {\n ...options,\n headers: { 'Content-Type': 'multipart/form-data' },\n responseType: 'arraybuffer',\n });\n return response.data;\n}\n\nasync function _put(url: string, data?: any) {\n const response = await axios.put(url, JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json' },\n });\n return response.data;\n}\n\nasync function _delete<T>(url: string): Promise<T> {\n const response = await axios.delete(url);\n return response.data;\n}\n\nasync function _deleteWithOptions<T>(url: string, options?: AxiosRequestConfig): Promise<T> {\n const response = await axios.delete(url, { ...options });\n return response.data;\n}\n\nasync function _patch(url: string, data?: any) {\n const response = await axios.patch(url, JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json' },\n });\n return response.data;\n}\n\nlet isRefreshing = false;\nlet failedQueue: { resolve: (value?: any) => void; reject: (reason?: any) => void }[] = [];\n\nconst refreshToken = (retry?: boolean): Promise<t.TRefreshTokenResponse | undefined> =>\n _post(endpoints.refreshToken(retry));\n\nconst dispatchTokenUpdatedEvent = (token: string) => {\n setTokenHeader(token);\n window.dispatchEvent(new CustomEvent('tokenUpdated', { detail: token }));\n};\n\nconst processQueue = (error: AxiosError | null, token: string | null = null) => {\n failedQueue.forEach((prom) => {\n if (error) {\n prom.reject(error);\n } else {\n prom.resolve(token);\n }\n });\n failedQueue = [];\n};\n\naxios.interceptors.response.use(\n (response) => response,\n async (error) => {\n const originalRequest = error.config;\n if (!error.response) {\n return Promise.reject(error);\n }\n\n if (originalRequest.url?.includes('/api/auth/2fa') === true) {\n return Promise.reject(error);\n }\n if (originalRequest.url?.includes('/api/auth/logout') === true) {\n return Promise.reject(error);\n }\n\n if (error.response.status === 401 && !originalRequest._retry) {\n console.warn('401 error, refreshing token');\n originalRequest._retry = true;\n\n if (isRefreshing) {\n try {\n const token = await new Promise((resolve, reject) => {\n failedQueue.push({ resolve, reject });\n });\n originalRequest.headers['Authorization'] = 'Bearer ' + token;\n return await axios(originalRequest);\n } catch (err) {\n return Promise.reject(err);\n }\n }\n\n isRefreshing = true;\n\n try {\n const response = await refreshToken(\n // Handle edge case where we get a blank screen if the initial 401 error is from a refresh token request\n originalRequest.url?.includes('api/auth/refresh') === true ? true : false,\n );\n\n const token = response?.token ?? '';\n\n if (token) {\n originalRequest.headers['Authorization'] = 'Bearer ' + token;\n dispatchTokenUpdatedEvent(token);\n processQueue(null, token);\n return await axios(originalRequest);\n } else if (window.location.href.includes('share/')) {\n console.log(\n `Refresh token failed from shared link, attempting request to ${originalRequest.url}`,\n );\n } else {\n window.location.href = '/login';\n }\n } catch (err) {\n processQueue(err as AxiosError, null);\n return Promise.reject(err);\n } finally {\n isRefreshing = false;\n }\n }\n\n return Promise.reject(error);\n },\n);\n\nexport default {\n get: _get,\n getResponse: _getResponse,\n post: _post,\n postMultiPart: _postMultiPart,\n postTTS: _postTTS,\n put: _put,\n delete: _delete,\n deleteWithOptions: _deleteWithOptions,\n patch: _patch,\n refreshToken,\n dispatchTokenUpdatedEvent,\n};\n","import axios from 'axios';\n\nexport function setAcceptLanguageHeader(value: string): void {\n axios.defaults.headers.common['Accept-Language'] = value;\n}\n\nexport function setTokenHeader(token: string) {\n axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;\n}\n","import type { AxiosResponse } from 'axios';\nimport type * as t from './types';\nimport * as endpoints from './api-endpoints';\nimport * as a from './types/assistants';\nimport * as m from './types/mutations';\nimport * as q from './types/queries';\nimport * as f from './types/files';\nimport * as config from './config';\nimport request from './request';\nimport * as s from './schemas';\nimport * as r from './roles';\n\nexport function abortRequestWithMessage(\n endpoint: string,\n abortKey: string,\n message: string,\n): Promise<void> {\n return request.post(endpoints.abortRequest(endpoint), { arg: { abortKey, message } });\n}\n\nexport function revokeUserKey(name: string): Promise<unknown> {\n return request.delete(endpoints.revokeUserKey(name));\n}\n\nexport function revokeAllUserKeys(): Promise<unknown> {\n return request.delete(endpoints.revokeAllUserKeys());\n}\n\nexport function deleteUser(): Promise<s.TPreset> {\n return request.delete(endpoints.deleteUser());\n}\n\nexport function getSharedMessages(shareId: string): Promise<t.TSharedMessagesResponse> {\n return request.get(endpoints.shareMessages(shareId));\n}\n\nexport const listSharedLinks = async (\n params: q.SharedLinksListParams,\n): Promise<q.SharedLinksResponse> => {\n const { pageSize, isPublic, sortBy, sortDirection, search, cursor } = params;\n\n return request.get(\n endpoints.getSharedLinks(pageSize, isPublic, sortBy, sortDirection, search, cursor),\n );\n};\n\nexport function getSharedLink(conversationId: string): Promise<t.TSharedLinkGetResponse> {\n return request.get(endpoints.getSharedLink(conversationId));\n}\n\nexport function createSharedLink(conversationId: string): Promise<t.TSharedLinkResponse> {\n return request.post(endpoints.createSharedLink(conversationId));\n}\n\nexport function updateSharedLink(shareId: string): Promise<t.TSharedLinkResponse> {\n return request.patch(endpoints.updateSharedLink(shareId));\n}\n\nexport function deleteSharedLink(shareId: string): Promise<m.TDeleteSharedLinkResponse> {\n return request.delete(endpoints.shareMessages(shareId));\n}\n\nexport function updateUserKey(payload: t.TUpdateUserKeyRequest) {\n const { value } = payload;\n if (!value) {\n throw new Error('value is required');\n }\n\n return request.put(endpoints.keys(), payload);\n}\n\nexport function getPresets(): Promise<s.TPreset[]> {\n return request.get(endpoints.presets());\n}\n\nexport function createPreset(payload: s.TPreset): Promise<s.TPreset> {\n return request.post(endpoints.presets(), payload);\n}\n\nexport function updatePreset(payload: s.TPreset): Promise<s.TPreset> {\n return request.post(endpoints.presets(), payload);\n}\n\nexport function deletePreset(arg: s.TPreset | undefined): Promise<m.PresetDeleteResponse> {\n return request.post(endpoints.deletePreset(), arg);\n}\n\nexport function getSearchEnabled(): Promise<boolean> {\n return request.get(endpoints.searchEnabled());\n}\n\nexport function getUser(): Promise<t.TUser> {\n return request.get(endpoints.user());\n}\n\nexport function getUserBalance(): Promise<string> {\n return request.get(endpoints.balance());\n}\n\nexport const updateTokenCount = (text: string) => {\n return request.post(endpoints.tokenizer(), { arg: text });\n};\n\nexport const login = (payload: t.TLoginUser): Promise<t.TLoginResponse> => {\n return request.post(endpoints.login(), payload);\n};\n\nexport const logout = (): Promise<m.TLogoutResponse> => {\n return request.post(endpoints.logout());\n};\n\nexport const register = (payload: t.TRegisterUser) => {\n return request.post(endpoints.register(), payload);\n};\n\nexport const userKeyQuery = (name: string): Promise<t.TCheckUserKeyResponse> =>\n request.get(endpoints.userKeyQuery(name));\n\nexport const getLoginGoogle = () => {\n return request.get(endpoints.loginGoogle());\n};\n\nexport const requestPasswordReset = (\n payload: t.TRequestPasswordReset,\n): Promise<t.TRequestPasswordResetResponse> => {\n return request.post(endpoints.requestPasswordReset(), payload);\n};\n\nexport const resetPassword = (payload: t.TResetPassword) => {\n return request.post(endpoints.resetPassword(), payload);\n};\n\nexport const verifyEmail = (payload: t.TVerifyEmail): Promise<t.VerifyEmailResponse> => {\n return request.post(endpoints.verifyEmail(), payload);\n};\n\nexport const resendVerificationEmail = (\n payload: t.TResendVerificationEmail,\n): Promise<t.VerifyEmailResponse> => {\n return request.post(endpoints.resendVerificationEmail(), payload);\n};\n\nexport const getAvailablePlugins = (): Promise<s.TPlugin[]> => {\n return request.get(endpoints.plugins());\n};\n\nexport const updateUserPlugins = (payload: t.TUpdateUserPlugins) => {\n return request.post(endpoints.userPlugins(), payload);\n};\n\n/* Config */\n\nexport const getStartupConfig = (): Promise<config.TStartupConfig> => {\n return request.get(endpoints.config());\n};\n\nexport const getAIEndpoints = (): Promise<t.TEndpointsConfig> => {\n return request.get(endpoints.aiEndpoints());\n};\n\nexport const getModels = async (): Promise<t.TModelsConfig> => {\n return request.get(endpoints.models());\n};\n\nexport const getEndpointsConfigOverride = (): Promise<unknown | boolean> => {\n return request.get(endpoints.endpointsConfigOverride());\n};\n\n/* Assistants */\n\nexport const createAssistant = ({\n version,\n ...data\n}: a.AssistantCreateParams): Promise<a.Assistant> => {\n return request.post(endpoints.assistants({ version }), data);\n};\n\nexport const getAssistantById = ({\n endpoint,\n assistant_id,\n version,\n}: {\n endpoint: s.AssistantsEndpoint;\n assistant_id: string;\n version: number | string | number;\n}): Promise<a.Assistant> => {\n return request.get(\n endpoints.assistants({\n path: assistant_id,\n endpoint,\n version,\n }),\n );\n};\n\nexport const updateAssistant = ({\n assistant_id,\n data,\n version,\n}: {\n assistant_id: string;\n data: a.AssistantUpdateParams;\n version: number | string;\n}): Promise<a.Assistant> => {\n return request.patch(\n endpoints.assistants({\n path: assistant_id,\n version,\n }),\n data,\n );\n};\n\nexport const deleteAssistant = ({\n assistant_id,\n model,\n endpoint,\n version,\n}: m.DeleteAssistantBody & { version: number | string }): Promise<void> => {\n return request.delete(\n endpoints.assistants({\n path: assistant_id,\n options: { model, endpoint },\n version,\n }),\n );\n};\n\nexport const listAssistants = (\n params: a.AssistantListParams,\n version: number | string,\n): Promise<a.AssistantListResponse> => {\n return request.get(\n endpoints.assistants({\n version,\n options: params,\n }),\n );\n};\n\nexport function getAssistantDocs({\n endpoint,\n version,\n}: {\n endpoint: s.AssistantsEndpoint | string;\n version: number | string;\n}): Promise<a.AssistantDocument[]> {\n if (!s.isAssistantsEndpoint(endpoint)) {\n return Promise.resolve([]);\n }\n return request.get(\n endpoints.assistants({\n path: 'documents',\n version,\n options: { endpoint },\n endpoint: endpoint as s.AssistantsEndpoint,\n }),\n );\n}\n\n/* Tools */\n\nexport const getAvailableTools = (\n _endpoint: s.AssistantsEndpoint | s.EModelEndpoint.agents,\n version?: number | string,\n): Promise<s.TPlugin[]> => {\n let path = '';\n if (s.isAssistantsEndpoint(_endpoint)) {\n const endpoint = _endpoint as s.AssistantsEndpoint;\n path = endpoints.assistants({\n path: 'tools',\n endpoint: endpoint,\n version: version ?? config.defaultAssistantsVersion[endpoint],\n });\n } else {\n path = endpoints.agents({\n path: 'tools',\n });\n }\n\n return request.get(path);\n};\n\nexport const getVerifyAgentToolAuth = (\n params: q.VerifyToolAuthParams,\n): Promise<q.VerifyToolAuthResponse> => {\n return request.get(\n endpoints.agents({\n path: `tools/${params.toolId}/auth`,\n }),\n );\n};\n\nexport const callTool = <T extends m.ToolId>({\n toolId,\n toolParams,\n}: {\n toolId: T;\n toolParams: m.ToolParams<T>;\n}): Promise<m.ToolCallResponse> => {\n return request.post(\n endpoints.agents({\n path: `tools/${toolId}/call`,\n }),\n toolParams,\n );\n};\n\nexport const getToolCalls = (params: q.GetToolCallParams): Promise<q.ToolCallResults> => {\n return request.get(\n endpoints.agents({\n path: 'tools/calls',\n options: params,\n }),\n );\n};\n\n/* Files */\n\nexport const getFiles = (): Promise<f.TFile[]> => {\n return request.get(endpoints.files());\n};\n\nexport const getFileConfig = (): Promise<f.FileConfig> => {\n return request.get(`${endpoints.files()}/config`);\n};\n\nexport const uploadImage = (\n data: FormData,\n signal?: AbortSignal | null,\n): Promise<f.TFileUpload> => {\n const requestConfig = signal ? { signal } : undefined;\n return request.postMultiPart(endpoints.images(), data, requestConfig);\n};\n\nexport const uploadFile = (data: FormData, signal?: AbortSignal | null): Promise<f.TFileUpload> => {\n const requestConfig = signal ? { signal } : undefined;\n return request.postMultiPart(endpoints.files(), data, requestConfig);\n};\n\n/* actions */\n\nexport const updateAction = (data: m.UpdateActionVariables): Promise<m.UpdateActionResponse> => {\n const { assistant_id, version, ...body } = data;\n return request.post(\n endpoints.assistants({\n path: `actions/${assistant_id}`,\n version,\n }),\n body,\n );\n};\n\nexport function getActions(): Promise<a.Action[]> {\n return request.get(\n endpoints.agents({\n path: 'actions',\n }),\n );\n}\n\nexport const deleteAction = async ({\n assistant_id,\n action_id,\n model,\n version,\n endpoint,\n}: m.DeleteActionVariables & { version: number | string }): Promise<void> =>\n request.delete(\n endpoints.assistants({\n path: `actions/${assistant_id}/${action_id}/${model}`,\n version,\n endpoint,\n }),\n );\n\n/**\n * Agents\n */\n\nexport const createAgent = ({ ...data }: a.AgentCreateParams): Promise<a.Agent> => {\n return request.post(endpoints.agents({}), data);\n};\n\nexport const getAgentById = ({ agent_id }: { agent_id: string }): Promise<a.Agent> => {\n return request.get(\n endpoints.agents({\n path: agent_id,\n }),\n );\n};\n\nexport const updateAgent = ({\n agent_id,\n data,\n}: {\n agent_id: string;\n data: a.AgentUpdateParams;\n}): Promise<a.Agent> => {\n return request.patch(\n endpoints.agents({\n path: agent_id,\n }),\n data,\n );\n};\n\nexport const duplicateAgent = ({\n agent_id,\n}: m.DuplicateAgentBody): Promise<{ agent: a.Agent; actions: a.Action[] }> => {\n return request.post(\n endpoints.agents({\n path: `${agent_id}/duplicate`,\n }),\n );\n};\n\nexport const deleteAgent = ({ agent_id }: m.DeleteAgentBody): Promise<void> => {\n return request.delete(\n endpoints.agents({\n path: agent_id,\n }),\n );\n};\n\nexport const listAgents = (params: a.AgentListParams): Promise<a.AgentListResponse> => {\n return request.get(\n endpoints.agents({\n options: params,\n }),\n );\n};\n\nexport const revertAgentVersion = ({\n agent_id,\n version_index,\n}: {\n agent_id: string;\n version_index: number;\n}): Promise<a.Agent> => request.post(endpoints.revertAgentVersion(agent_id), { version_index });\n\n/* Tools */\n\nexport const getAvailableAgentTools = (): Promise<s.TPlugin[]> => {\n return request.get(\n endpoints.agents({\n path: 'tools',\n }),\n );\n};\n\n/* Actions */\n\nexport const updateAgentAction = (\n data: m.UpdateAgentActionVariables,\n): Promise<m.UpdateAgentActionResponse> => {\n const { agent_id, ...body } = data;\n return request.post(\n endpoints.agents({\n path: `actions/${agent_id}`,\n }),\n body,\n );\n};\n\nexport const deleteAgentAction = async ({\n agent_id,\n action_id,\n}: m.DeleteAgentActionVariables): Promise<void> =>\n request.delete(\n endpoints.agents({\n path: `actions/${agent_id}/${action_id}`,\n }),\n );\n\n/**\n * Imports a conversations file.\n *\n * @param data - The FormData containing the file to import.\n * @returns A Promise that resolves to the import start response.\n */\nexport const importConversationsFile = (data: FormData): Promise<t.TImportResponse> => {\n return request.postMultiPart(endpoints.importConversation(), data);\n};\n\nexport const uploadAvatar = (data: FormData): Promise<f.AvatarUploadResponse> => {\n return request.postMultiPart(endpoints.avatar(), data);\n};\n\nexport const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise<a.Assistant> => {\n return request.postMultiPart(\n endpoints.assistants({\n isAvatar: true,\n path: `${data.assistant_id}/avatar`,\n options: { model: data.model, endpoint: data.endpoint },\n version: data.version,\n }),\n data.formData,\n );\n};\n\nexport const uploadAgentAvatar = (data: m.AgentAvatarVariables): Promise<a.Agent> => {\n return request.postMultiPart(\n `${endpoints.images()}/agents/${data.agent_id}/avatar`,\n data.formData,\n );\n};\n\nexport const getFileDownload = async (userId: string, file_id: string): Promise<AxiosResponse> => {\n return request.getResponse(`${endpoints.files()}/download/${userId}/${file_id}`, {\n responseType: 'blob',\n headers: {\n Accept: 'application/octet-stream',\n },\n });\n};\n\nexport const getCodeOutputDownload = async (url: string): Promise<AxiosResponse> => {\n return request.getResponse(url, {\n responseType: 'blob',\n headers: {\n Accept: 'application/octet-stream',\n },\n });\n};\n\nexport const deleteFiles = async (payload: {\n files: f.BatchFile[];\n agent_id?: string;\n assistant_id?: string;\n tool_resource?: a.EToolResources;\n}): Promise<f.DeleteFilesResponse> =>\n request.deleteWithOptions(endpoints.files(), {\n data: payload,\n });\n\n/* Speech */\n\nexport const speechToText = (data: FormData): Promise<f.SpeechToTextResponse> => {\n return request.postMultiPart(endpoints.speechToText(), data);\n};\n\nexport const textToSpeech = (data: FormData): Promise<ArrayBuffer> => {\n return request.postTTS(endpoints.textToSpeechManual(), data);\n};\n\nexport const getVoices = (): Promise<f.VoiceResponse> => {\n return request.get(endpoints.textToSpeechVoices());\n};\n\nexport const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse> => {\n return request.get(endpoints.getCustomConfigSpeech());\n};\n\n/* conversations */\n\nexport function duplicateConversation(\n payload: t.TDuplicateConvoRequest,\n): Promise<t.TDuplicateConvoResponse> {\n return request.post(endpoints.duplicateConversation(), payload);\n}\n\nexport function forkConversation(payload: t.TForkConvoRequest): Promise<t.TForkConvoResponse> {\n return request.post(endpoints.forkConversation(), payload);\n}\n\nexport function deleteConversation(payload: t.TDeleteConversationRequest) {\n return request.deleteWithOptions(endpoints.deleteConversation(), { data: { arg: payload } });\n}\n\nexport function clearAllConversations(): Promise<unknown> {\n return request.delete(endpoints.deleteAllConversation());\n}\n\nexport const listConversations = (\n params?: q.ConversationListParams,\n): Promise<q.ConversationListResponse> => {\n return request.get(endpoints.conversations(params ?? {}));\n};\n\nexport function getConversations(cursor: string): Promise<t.TGetConversationsResponse> {\n return request.get(endpoints.conversations({ cursor }));\n}\n\nexport function getConversationById(id: string): Promise<s.TConversation> {\n return request.get(endpoints.conversationById(id));\n}\n\nexport function updateConversation(\n payload: t.TUpdateConversationRequest,\n): Promise<t.TUpdateConversationResponse> {\n return request.post(endpoints.updateConversation(), { arg: payload });\n}\n\nexport function archiveConversation(\n payload: t.TArchiveConversationRequest,\n): Promise<t.TArchiveConversationResponse> {\n return request.post(endpoints.updateConversation(), { arg: payload });\n}\n\nexport function genTitle(payload: m.TGenTitleRequest): Promise<m.TGenTitleResponse> {\n return request.post(endpoints.genTitle(), payload);\n}\n\nexport const listMessages = (params?: q.MessagesListParams): Promise<q.MessagesListResponse> => {\n return request.get(endpoints.messages(params ?? {}));\n};\n\nexport function updateMessage(payload: t.TUpdateMessageRequest): Promise<unknown> {\n const { conversationId, messageId, text } = payload;\n if (!conversationId) {\n throw new Error('conversationId is required');\n }\n\n return request.put(endpoints.messages({ conversationId, messageId }), { text });\n}\n\nexport function updateMessageContent(payload: t.TUpdateMessageContent): Promise<unknown> {\n const { conversationId, messageId, index, text } = payload;\n if (!conversationId) {\n throw new Error('conversationId is required');\n }\n\n return request.put(endpoints.messages({ conversationId, messageId }), { text, index });\n}\n\nexport const editArtifact = async ({\n messageId,\n ...params\n}: m.TEditArtifactRequest): Promise<m.TEditArtifactResponse> => {\n return request.post(`/api/messages/artifact/${messageId}`, params);\n};\n\nexport function getMessagesByConvoId(conversationId: string): Promise<s.TMessage[]> {\n if (\n conversationId === config.Constants.NEW_CONVO ||\n conversationId === config.Constants.PENDING_CONVO\n ) {\n return Promise.resolve([]);\n }\n return request.get(endpoints.messages({ conversationId }));\n}\n\nexport function getPrompt(id: string): Promise<{ prompt: t.TPrompt }> {\n return request.get(endpoints.getPrompt(id));\n}\n\nexport function getPrompts(filter: t.TPromptsWithFilterRequest): Promise<t.TPrompt[]> {\n return request.get(endpoints.getPromptsWithFilters(filter));\n}\n\nexport function getAllPromptGroups(): Promise<q.AllPromptGroupsResponse> {\n return request.get(endpoints.getAllPromptGroups());\n}\n\nexport function getPromptGroups(\n filter: t.TPromptGroupsWithFilterRequest,\n): Promise<t.PromptGroupListResponse> {\n return request.get(endpoints.getPromptGroupsWithFilters(filter));\n}\n\nexport function getPromptGroup(id: string): Promise<t.TPromptGroup> {\n return request.get(endpoints.getPromptGroup(id));\n}\n\nexport function createPrompt(payload: t.TCreatePrompt): Promise<t.TCreatePromptResponse> {\n return request.post(endpoints.postPrompt(), payload);\n}\n\nexport function updatePromptGroup(\n variables: t.TUpdatePromptGroupVariables,\n): Promise<t.TUpdatePromptGroupResponse> {\n return request.patch(endpoints.updatePromptGroup(variables.id), variables.payload);\n}\n\nexport function deletePrompt(payload: t.TDeletePromptVariables): Promise<t.TDeletePromptResponse> {\n return request.delete(endpoints.deletePrompt(payload));\n}\n\nexport function makePromptProduction(id: string): Promise<t.TMakePromptProductionResponse> {\n return request.patch(endpoints.updatePromptTag(id));\n}\n\nexport function updatePromptLabels(\n variables: t.TUpdatePromptLabelsRequest,\n): Promise<t.TUpdatePromptLabelsResponse> {\n return request.patch(endpoints.updatePromptLabels(variables.id), variables.payload);\n}\n\nexport function deletePromptGroup(id: string): Promise<t.TDeletePromptGroupResponse> {\n return request.delete(endpoints.deletePromptGroup(id));\n}\n\nexport function getCategories(): Promise<t.TGetCategoriesResponse> {\n return request.get(endpoints.getCategories());\n}\n\nexport function getRandomPrompts(\n variables: t.TGetRandomPromptsRequest,\n): Promise<t.TGetRandomPromptsResponse> {\n return request.get(endpoints.getRandomPrompts(variables.limit, variables.skip));\n}\n\n/* Roles */\nexport function getRole(roleName: string): Promise<r.TRole> {\n return request.get(endpoints.getRole(roleName));\n}\n\nexport function updatePromptPermissions(\n variables: m.UpdatePromptPermVars,\n): Promise<m.UpdatePermResponse> {\n return request.put(endpoints.updatePromptPermissions(variables.roleName), variables.updates);\n}\n\nexport function updateAgentPermissions(\n variables: m.UpdateAgentPermVars,\n): Promise<m.UpdatePermResponse> {\n return request.put(endpoints.updateAgentPermissions(variables.roleName), variables.updates);\n}\n\n/* Tags */\nexport function getConversationTags(): Promise<t.TConversationTagsResponse> {\n return request.get(endpoints.conversationTags());\n}\n\nexport function createConversationTag(\n payload: t.TConversationTagRequest,\n): Promise<t.TConversationTagResponse> {\n return request.post(endpoints.conversationTags(), payload);\n}\n\nexport function updateConversationTag(\n tag: string,\n payload: t.TConversationTagRequest,\n): Promise<t.TConversationTagResponse> {\n return request.put(endpoints.conversationTags(tag), payload);\n}\nexport function deleteConversationTag(tag: string): Promise<t.TConversationTagResponse> {\n return request.delete(endpoints.conversationTags(tag));\n}\n\nexport function addTagToConversation(\n conversationId: string,\n payload: t.TTagConversationRequest,\n): Promise<t.TTagConversationResponse> {\n return request.put(endpoints.addTagToConversation(conversationId), payload);\n}\nexport function rebuildConversationTags(): Promise<t.TConversationTagsResponse> {\n return request.post(endpoints.conversationTags('rebuild'));\n}\n\nexport function healthCheck(): Promise<string> {\n return request.get(endpoints.health());\n}\n\nexport function getUserTerms(): Promise<t.TUserTermsResponse> {\n return request.get(endpoints.userTerms());\n}\n\nexport function acceptTerms(): Promise<t.TAcceptTermsResponse> {\n return request.post(endpoints.acceptUserTerms());\n}\n\nexport function getBanner(): Promise<t.TBannerResponse> {\n return request.get(endpoints.banner());\n}\n\nexport function enableTwoFactor(): Promise<t.TEnable2FAResponse> {\n return request.get(endpoints.enableTwoFactor());\n}\n\nexport function verifyTwoFactor(payload: t.TVerify2FARequest): Promise<t.TVerify2FAResponse> {\n return request.post(endpoints.verifyTwoFactor(), payload);\n}\n\nexport function confirmTwoFactor(payload: t.TVerify2FARequest): Promise<t.TVerify2FAResponse> {\n return request.post(endpoints.confirmTwoFactor(), payload);\n}\n\nexport function disableTwoFactor(): Promise<t.TDisable2FAResponse> {\n return request.post(endpoints.disableTwoFactor());\n}\n\nexport function regenerateBackupCodes(): Promise<t.TRegenerateBackupCodesResponse> {\n return request.post(endpoints.regenerateBackupCodes());\n}\n\nexport function verifyTwoFactorTemp(\n payload: t.TVerify2FATempRequest,\n): Promise<t.TVerify2FATempResponse> {\n return request.post(endpoints.verifyTwoFactorTemp(), payload);\n}\n","export enum QueryKeys {\n messages = 'messages',\n sharedMessages = 'sharedMessages',\n sharedLinks = 'sharedLinks',\n allConversations = 'allConversations',\n archivedConversations = 'archivedConversations',\n searchConversations = 'searchConversations',\n conversation = 'conversation',\n searchEnabled = 'searchEnabled',\n user = 'user',\n name = 'name', // user key name\n models = 'models',\n balance = 'balance',\n endpoints = 'endpoints',\n presets = 'presets',\n searchResults = 'searchResults',\n tokenCount = 'tokenCount',\n availablePlugins = 'availablePlugins',\n startupConfig = 'startupConfig',\n assistants = 'assistants',\n assistant = 'assistant',\n agents = 'agents',\n agent = 'agent',\n endpointsConfigOverride = 'endpointsConfigOverride',\n files = 'files',\n fileConfig = 'fileConfig',\n tools = 'tools',\n toolAuth = 'toolAuth',\n toolCalls = 'toolCalls',\n agentTools = 'agentTools',\n actions = 'actions',\n assistantDocs = 'assistantDocs',\n agentDocs = 'agentDocs',\n fileDownload = 'fileDownload',\n voices = 'voices',\n customConfigSpeech = 'customConfigSpeech',\n prompts = 'prompts',\n prompt = 'prompt',\n promptGroups = 'promptGroups',\n allPromptGroups = 'allPromptGroups',\n promptGroup = 'promptGroup',\n categories = 'categories',\n randomPrompts = 'randomPrompts',\n roles = 'roles',\n conversationTags = 'conversationTags',\n health = 'health',\n userTerms = 'userTerms',\n banner = 'banner',\n}\n\nexport enum MutationKeys {\n fileUpload = 'fileUpload',\n fileDelete = 'fileDelete',\n updatePreset = 'updatePreset',\n deletePreset = 'deletePreset',\n loginUser = 'loginUser',\n logoutUser = 'logoutUser',\n refreshToken = 'refreshToken',\n avatarUpload = 'avatarUpload',\n speechToText = 'speechToText',\n textToSpeech = 'textToSpeech',\n assistantAvatarUpload = 'assistantAvatarUpload',\n agentAvatarUpload = 'agentAvatarUpload',\n updateAction = 'updateAction',\n updateAgentAction = 'updateAgentAction',\n deleteAction = 'deleteAction',\n deleteAgentAction = 'deleteAgentAction',\n revertAgentVersion = 'revertAgentVersion',\n deleteUser = 'deleteUser',\n updateRole = 'updateRole',\n enableTwoFactor = 'enableTwoFactor',\n verifyTwoFactor = 'verifyTwoFactor',\n}\n","import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport type {\n UseQueryOptions,\n UseMutationResult,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport { Constants, initialModelsConfig } from '../config';\nimport { defaultOrderQuery } from '../types/assistants';\nimport * as dataService from '../data-service';\nimport * as m from '../types/mutations';\nimport { QueryKeys } from '../keys';\nimport * as s from '../schemas';\nimport * as t from '../types';\n\nexport const useAbortRequestWithMessage = (): UseMutationResult<\n void,\n Error,\n { endpoint: string; abortKey: string; message: string }\n> => {\n const queryClient = useQueryClient();\n return useMutation(\n ({ endpoint, abortKey, message }) =>\n dataService.abortRequestWithMessage(endpoint, abortKey, message),\n {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.balance]);\n },\n },\n );\n};\n\nexport const useGetSharedMessages = (\n shareId: string,\n config?: UseQueryOptions<t.TSharedMessagesResponse>,\n): QueryObserverResult<t.TSharedMessagesResponse> => {\n return useQuery<t.TSharedMessagesResponse>(\n [QueryKeys.sharedMessages, shareId],\n () => dataService.getSharedMessages(shareId),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n\nexport const useGetSharedLinkQuery = (\n conversationId: string,\n config?: UseQueryOptions<t.TSharedLinkGetResponse>,\n): QueryObserverResult<t.TSharedLinkGetResponse> => {\n const queryClient = useQueryClient();\n return useQuery<t.TSharedLinkGetResponse>(\n [QueryKeys.sharedLinks, conversationId],\n () => dataService.getSharedLink(conversationId),\n {\n enabled:\n !!conversationId &&\n conversationId !== Constants.NEW_CONVO &&\n conversationId !== Constants.PENDING_CONVO,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n onSuccess: (data) => {\n queryClient.setQueryData([QueryKeys.sharedLinks, conversationId], {\n conversationId: data.conversationId,\n shareId: data.shareId,\n });\n },\n ...config,\n },\n );\n};\n\nexport const useGetConversationByIdQuery = (\n id: string,\n config?: UseQueryOptions<s.TConversation>,\n): QueryObserverResult<s.TConversation> => {\n return useQuery<s.TConversation>(\n [QueryKeys.conversation, id],\n () => dataService.getConversationById(id),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n\n//This isn't ideal because its just a query and we're using mutation, but it was the only way\n//to make it work with how the Chat component is structured\nexport const useGetConversationByIdMutation = (id: string): UseMutationResult<s.TConversation> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.getConversationById(id), {\n // onSuccess: (res: s.TConversation) => {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.conversation, id]);\n },\n });\n};\n\nexport const useUpdateMessageMutation = (\n id: string,\n): UseMutationResult<unknown, unknown, t.TUpdateMessageRequest, unknown> => {\n const queryClient = useQueryClient();\n return useMutation((payload: t.TUpdateMessageRequest) => dataService.updateMessage(payload), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.messages, id]);\n },\n });\n};\n\nexport const useUpdateMessageContentMutation = (\n conversationId: string,\n): UseMutationResult<unknown, unknown, t.TUpdateMessageContent, unknown> => {\n const queryClient = useQueryClient();\n return useMutation(\n (payload: t.TUpdateMessageContent) => dataService.updateMessageContent(payload),\n {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.messages, conversationId]);\n },\n },\n );\n};\n\nexport const useUpdateUserKeysMutation = (): UseMutationResult<\n t.TUser,\n unknown,\n t.TUpdateUserKeyRequest,\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation((payload: t.TUpdateUserKeyRequest) => dataService.updateUserKey(payload), {\n onSuccess: (data, variables) => {\n queryClient.invalidateQueries([QueryKeys.name, variables.name]);\n },\n });\n};\n\nexport const useClearConversationsMutation = (): UseMutationResult<unknown> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.clearAllConversations(), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.allConversations]);\n },\n });\n};\n\nexport const useRevokeUserKeyMutation = (name: string): UseMutationResult<unknown> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.revokeUserKey(name), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.name, name]);\n if (s.isAssistantsEndpoint(name)) {\n queryClient.invalidateQueries([QueryKeys.assistants, name, defaultOrderQuery]);\n queryClient.invalidateQueries([QueryKeys.assistantDocs]);\n queryClient.invalidateQueries([QueryKeys.assistants]);\n queryClient.invalidateQueries([QueryKeys.assistant]);\n queryClient.invalidateQueries([QueryKeys.actions]);\n queryClient.invalidateQueries([QueryKeys.tools]);\n }\n },\n });\n};\n\nexport const useRevokeAllUserKeysMutation = (): UseMutationResult<unknown> => {\n const queryClient = useQueryClient();\n return useMutation(() => dataService.revokeAllUserKeys(), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.name]);\n queryClient.invalidateQueries([\n QueryKeys.assistants,\n s.EModelEndpoint.assistants,\n defaultOrderQuery,\n ]);\n queryClient.invalidateQueries([\n QueryKeys.assistants,\n s.EModelEndpoint.azureAssistants,\n defaultOrderQuery,\n ]);\n queryClient.invalidateQueries([QueryKeys.assistantDocs]);\n queryClient.invalidateQueries([QueryKeys.assistants]);\n queryClient.invalidateQueries([QueryKeys.assistant]);\n queryClient.invalidateQueries([QueryKeys.actions]);\n queryClient.invalidateQueries([QueryKeys.tools]);\n },\n });\n};\n\nexport const useGetModelsQuery = (\n config?: UseQueryOptions<t.TModelsConfig>,\n): QueryObserverResult<t.TModelsConfig> => {\n return useQuery<t.TModelsConfig>([QueryKeys.models], () => dataService.getModels(), {\n initialData: initialModelsConfig,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n staleTime: Infinity,\n ...config,\n });\n};\n\nexport const useCreatePresetMutation = (): UseMutationResult<\n s.TPreset,\n unknown,\n s.TPreset,\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation((payload: s.TPreset) => dataService.createPreset(payload), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.presets]);\n },\n });\n};\n\nexport const useDeletePresetMutation = (): UseMutationResult<\n m.PresetDeleteResponse,\n unknown,\n s.TPreset | undefined,\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation((payload: s.TPreset | undefined) => dataService.deletePreset(payload), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.presets]);\n },\n });\n};\n\nexport const useUpdateTokenCountMutation = (): UseMutationResult<\n t.TUpdateTokenCountResponse,\n unknown,\n { text: string },\n unknown\n> => {\n const queryClient = useQueryClient();\n return useMutation(({ text }: { text: string }) => dataService.updateTokenCount(text), {\n onSuccess: () => {\n queryClient.invalidateQueries([QueryKeys.tokenCount]);\n },\n });\n};\n\nexport const useRegisterUserMutation = (\n options?: m.RegistrationOptions,\n): UseMutationResult<t.TError, unknown, t.TRegisterUser, unknown> => {\n const queryClient = useQueryClient();\n return useMutation<t.TRegisterUserResponse, t.TError, t.TRegisterUser>(\n (payload: t.TRegisterUser) => dataService.register(payload),\n {\n ...options,\n onSuccess: (...args) => {\n queryClient.invalidateQueries([QueryKeys.user]);\n if (options?.onSuccess) {\n options.onSuccess(...args);\n }\n },\n },\n );\n};\n\nexport const useUserKeyQuery = (\n name: string,\n config?: UseQueryOptions<t.TCheckUserKeyResponse>,\n): QueryObserverResult<t.TCheckUserKeyResponse> => {\n return useQuery<t.TCheckUserKeyResponse>(\n [QueryKeys.name, name],\n () => {\n if (!name) {\n return Promise.resolve({ expiresAt: '' });\n }\n return dataService.userKeyQuery(name);\n },\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n retry: false,\n ...config,\n },\n );\n};\n\nexport const useRequestPasswordResetMutation = (): UseMutationResult<\n t.TRequestPasswordResetResponse,\n unknown,\n t.TRequestPasswordReset,\n unknown\n> => {\n return useMutation((payload: t.TRequestPasswordReset) =>\n dataService.requestPasswordReset(payload),\n );\n};\n\nexport const useResetPasswordMutation = (): UseMutationResult<\n unknown,\n unknown,\n t.TResetPassword,\n unknown\n> => {\n return useMutation((payload: t.TResetPassword) => dataService.resetPassword(payload));\n};\n\nexport const useAvailablePluginsQuery = <TData = s.TPlugin[]>(\n config?: UseQueryOptions<s.TPlugin[], unknown, TData>,\n): QueryObserverResult<TData> => {\n return useQuery<s.TPlugin[], unknown, TData>(\n [QueryKeys.availablePlugins],\n () => dataService.getAvailablePlugins(),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n\nexport const useUpdateUserPluginsMutation = (\n _options?: m.UpdatePluginAuthOptions,\n): UseMutationResult<t.TUser, unknown, t.TUpdateUserPlugins, unknown> => {\n const queryClient = useQueryClient();\n const { onSuccess, ...options } = _options ?? {};\n return useMutation((payload: t.TUpdateUserPlugins) => dataService.updateUserPlugins(payload), {\n ...options,\n onSuccess: (...args) => {\n queryClient.invalidateQueries([QueryKeys.user]);\n onSuccess?.(...args);\n },\n });\n};\n\nexport const useGetCustomConfigSpeechQuery = (\n config?: UseQueryOptions<t.TCustomConfigSpeechResponse>,\n): QueryObserverResult<t.TCustomConfigSpeechResponse> => {\n return useQuery<t.TCustomConfigSpeechResponse>(\n [QueryKeys.customConfigSpeech],\n () => dataService.getCustomConfigSpeech(),\n {\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n refetchOnMount: false,\n ...config,\n },\n );\n};\n"],"names":["Tools","EToolResources","AnnotationTypes","StepStatus","MessageContentTypes","RunStatus","AuthTypeEnum","AuthorizationTypeEnum","TokenExchangeMethodEnum","FilePurpose","AssistantStreamEvents","AuthType","defaultOrderQuery","order","limit","z","string","uuid","EModelEndpoint","BedrockProviders","authTypeSchema","nativeEnum","Set","agents","openAI","bedrock","azureOpenAI","anthropic","custom","google","ImageDetail","ReasoningEffort","_a","low","auto","high","eImageDetailSchema","eReasoningEffortSchema","_b","agent","id","name","description","instructions","model","model_parameters","tools","provider","projectIds","artifacts","isCollaborative","recursion_limit","undefined","execute_code","file_search","web_search","type","function","parameters","properties","required","EAgent","openAISettings","default","temperature","min","max","step","top_p","presence_penalty","frequency_penalty","resendFiles","maxContextTokens","max_tokens","imageDetail","LEGACY_ANTHROPIC_MAX_OUTPUT","anthropicSettings","promptCache","thinking","thinkingBudget","maxOutputTokens","reset","modelName","test","set","value","topP","topK","legacy","agentsSettings","_d","eModelEndpointSchema","extendedModelEndpointSchema","union","tPluginAuthConfigSchema","object","authField","label","tPluginSchema","pluginKey","icon","optional","authConfig","array","authenticated","boolean","chatMenu","isButton","toolkit","tExampleSchema","input","content","output","agentOptionSettings","functions","classic","tAgentOptionsSchema","skipCompletion","number","messageId","endpoint","clientId","nullable","conversationId","parentMessageId","responseMessageId","overrideParentMessageId","bg","title","or","literal","sender","text","generation","isCreatedByUser","error","clientTimestamp","createdAt","Date","toISOString","updatedAt","current","unfinished","searchResult","finish_reason","thread_id","iconURL","coerceNumber","transform","val","trim","parseFloat","DocumentType","lazy","null","record","tConversationSchema","endpointType","isArchived","user","messages","modelLabel","userLabel","promptPrefix","system","context","examples","tags","file_ids","reasoning_effort","assistant_id","agent_id","region","maxTokens","additionalModelRequestFields","additional_instructions","append_current_datetime","presetOverride","unknown","stop","greeting","spec","expiredAt","resendImages","agentOptions","chatGptLabel","tPresetSchema","omit","merge","presetId","defaultPreset","pick","shareId","isPublic","_id","tag","count","position","googleBaseSchema","obj","removeNullishValues","catch","presencePenalty","frequencyPenalty","stopSequences","strip","gptPluginsBaseSchema","removeEmptyStrings","newObj","__assign","Object","keys","forEach","key","result","_c","_e","_f","_g","_h","_j","_k","_l","_m","_o","_p","length","bannerId","message","displayFrom","displayTo","tModelSpecSchema","preset","showIconInMenu","showIconInHeader","authType","specsConfigSchema","enforce","prioritize","list","addedEndpoints","assistants","azureAssistants","excelFileTypes","__spreadArray","supportedMimeTypes","defaultSizeLimit","assistantsFileConfig","fileLimit","fileSizeLimit","totalSizeLimit","disabled","FileSources","FileContext","supportedMimeTypesSchema","any","refine","mimeTypes","every","mimeType","RegExp","endpointFileConfigSchema","fileConfigSchema","endpoints","serverFileSizeLimit","avatarSizeLimit","imageGeneration","percentage","px","envVarRegex","extractEnvVariable","trimmed","singleMatch","match","varName","process","env","regex","matches","exec","push","fullMatch","index","i","envValue","substring","SettingsViews","BaseOptionsSchema","iconPath","timeout","initTimeout","StdioOptionsSchema","extend","command","args","processedEnv","_i","entries","stderr","WebSocketOptionsSchema","url","pipe","protocol","URL","SSEOptionsSchema","headers","StreamableHTTPOptionsSchema","MCPOptionsSchema","MCPServersSchema","Capabilities","AgentCapabilities","fileSourceSchema","modelConfigSchema","deploymentName","version","azureBaseSchema","apiKey","serverless","instanceName","addParams","dropParams","forcePrompt","baseURL","additionalHeaders","azureGroupSchema","group","models","and","azureGroupConfigsSchema","baseEndpointSchema","streamRate","titlePrompt","titleModel","availableRegions","RateLimitPrefix","assistantEndpointSchema","disableBuilder","pollIntervalMs","timeoutMs","supportedIds","excludedIds","privateAssistants","retrievalModels","capabilities","code_interpreter","image_vision","retrieval","actions","fetch","userIdQuery","titleConvo","titleMethod","defaultAgentCapabilities","chain","ocr","agentsEndpointSChema","recursionLimit","maxRecursionLimit","allowedProviders","endpointSchema","safeParse","success","concat","values","join","summarize","summaryModel","modelDisplayLabel","customParams","defaultParamsEndpoint","paramDefinitions","strict","customOrder","directEndpoint","titleMessageRole","azureEndpointSchema","groups","plugins","partial","ttsOpenaiSchema","voices","ttsAzureOpenAISchema","apiVersion","ttsElevenLabsSchema","websocketUrl","voice_settings","similarity_boost","stability","style","use_speaker_boost","pronunciation_dictionary_locators","ttsLocalaiSchema","backend","ttsSchema","openai","elevenlabs","localai","sttOpenaiSchema","sttAzureOpenAISchema","sttSchema","speechTab","conversationMode","advancedMode","speechToText","engineSTT","languageSTT","autoTranscribeAudio","decibelValue","autoSendText","textToSpeech","engineTTS","voice","languageTTS","automaticPlayback","playbackRate","cacheTTS","EImageOutputType","rateLimitSchema","fileUploads","ipMax","ipWindowInMinutes","userMax","userWindowInMinutes","conversationsImport","tts","stt","OCRStrategy","SearchCategories","SearchProviders","ScraperTypes","RerankerTypes","SafeSearchTypes","termsOfServiceSchema","externalUrl","openNewTab","modalAcceptance","modalTitle","modalContent","intefaceSchema","privacyPolicy","termsOfService","customWelcome","endpointsMenu","modelSelect","sidePanel","multiConvo","bookmarks","presets","prompts","temporaryChat","runCode","webSearch","turnstileOptionsSchema","language","size","enum","turnstileSchema","siteKey","options","KnownEndpoints","FetchTokenConfig","webSearchSchema","serperApiKey","firecrawlApiKey","firecrawlApiUrl","jinaApiKey","cohereApiKey","searchProvider","scraperType","rerankerType","scraperTimeout","safeSearch","MODERATE","ocrSchema","mistralModel","strategy","MISTRAL_OCR","balanceSchema","enabled","startBalance","autoRefillEnabled","refillIntervalValue","refillIntervalUnit","refillAmount","cache","secureImageLinks","imageOutputType","PNG","includedTools","filteredTools","mcpServers","interface","turnstile","fileStrategy","local","allowedDomains","registration","socialLogins","balance","speech","rateLimits","fileConfig","modelSpecs","all","gptPlugins","data","chatGPTBrowser","ollama","deepseek","xai","VisionModes","InfiniteCollections","Time","CacheKeys","ViolationTypes","ErrorTypes","AuthKeys","ImageDetailCost","SettingsTabValues","STTProviders","TTSProviders","Constants","LocalStorageKeys","ForkOptions","CohereConstants","SystemCategories","sharedOpenAIModels","defaultModels","openAIModels","initialModelsConfig","initial","filter","str","params","rest","__rest","query","Array","isArray","map","v","encodeURIComponent","String","buildQuery","shareRoot","keysEndpoint","conversationsRoot","_post","axios","post","JSON","stringify","sent","isRefreshing","failedQueue","refreshToken","retry","endpoints.refreshToken","dispatchTokenUpdatedEvent","token","defaults","common","setTokenHeader","window","dispatchEvent","CustomEvent","detail","processQueue","prom","reject","resolve","interceptors","response","use","__awaiter","originalRequest","config","Promise","includes","status","_retry","console","warn","err_1","location","href","log","err_2","request","get","getResponse","postMultiPart","formData","postTTS","responseType","put","delete","deleteWithOptions","patch","revokeUserKey","endpoints.revokeUserKey","revokeAllUserKeys","getSharedMessages","endpoints.shareMessages","getSharedLink","endpoints.getSharedLink","updateUserKey","payload","Error","QueryKeys","MutationKeys","userKeyQuery","endpoints.userKeyQuery","clearAllConversations","getConversationById","endpoints.conversationById","useAbortRequestWithMessage","queryClient","useQueryClient","useMutation","abortKey","endpoints.abortRequest","arg","dataService.abortRequestWithMessage","onSuccess","invalidateQueries","useGetSharedMessages","useQuery","sharedMessages","dataService.getSharedMessages","refetchOnWindowFocus","refetchOnReconnect","refetchOnMount","useGetSharedLinkQuery","sharedLinks","dataService.getSharedLink","NEW_CONVO","PENDING_CONVO","setQueryData","useGetConversationByIdQuery","conversation","dataService.getConversationById","useGetConversationByIdMutation","useUpdateMessageMutation","endpoints.messages","dataService.updateMessage","useUpdateMessageContentMutation","dataService.updateMessageContent","useUpdateUserKeysMutation","dataService.updateUserKey","variables","useClearConversationsMutation","dataService.clearAllConversations","allConversations","useRevokeUserKeyMutation","dataService.revokeUserKey","_endpoint","toLowerCase","endsWith","assistantDocs","assistant","useRevokeAllUserKeysMutation","dataService.revokeAllUserKeys","s.EModelEndpoint","useGetModelsQuery","initialData","staleTime","Infinity","useCreatePresetMutation","dataService.createPreset","useDeletePresetMutation","useUpdateTokenCountMutation","dataService.updateTokenCount","tokenCount","useRegisterUserMutation","dataService.register","arguments","apply","useUserKeyQuery","dataService.userKeyQuery","expiresAt","useRequestPasswordResetMutation","dataService.requestPasswordReset","useResetPasswordMutation","dataService.resetPassword","useAvailablePluginsQuery","availablePlugins","useUpdateUserPluginsMutation","_options","dataService.updateUserPlugins","useGetCustomConfigSpeechQuery","customConfigSpeech"],"mappings":"uIAiBYA,EASAC,EAoXAC,EAKAC,EAQAC,EAOAC,EAsEAC,EAMAC,EAMAC,EAmEAC,2rEAtiBZ,SAAYT,GACVA,EAAA,aAAA,eACAA,EAAA,iBAAA,mBACAA,EAAA,YAAA,cACAA,EAAA,WAAA,aACAA,EAAA,UAAA,YACAA,EAAA,SAAA,UACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAED,SAAYC,GACVA,EAAA,iBAAA,mBACAA,EAAA,aAAA,eACAA,EAAA,YAAA,cACAA,EAAA,WAAA,aACAA,EAAA,IAAA,KACD,CAND,CAAYA,IAAAA,EAMX,CAAA,IA8WD,SAAYC,GACVA,EAAA,cAAA,gBACAA,EAAA,UAAA,WACD,CAHD,CAAYA,IAAAA,EAGX,CAAA,IAED,SAAYC,GACVA,EAAA,YAAA,cAC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