import { CustomHeaders, EditorConfig } from './config-provider'; /** * 请求选项 */ export interface RequestOptions extends Omit { /** 自定义请求头 */ headers?: CustomHeaders; /** 超时时间(毫秒) */ timeout?: number; } /** * 合并请求头 * 优先级:传入的 headers > config.ai/upload.headers > config.customHeaders */ export declare function mergeHeaders(config: EditorConfig, additionalHeaders?: CustomHeaders, options?: { includeAiKey?: boolean; }): CustomHeaders; /** * 构建完整的 URL */ export declare function buildUrl(config: EditorConfig, path: string): string; /** * 发起 HTTP 请求 */ export declare function request(config: EditorConfig, url: string, options?: RequestOptions): Promise; /** * GET 请求 */ export declare function get(config: EditorConfig, url: string, options?: RequestOptions): Promise; /** * POST 请求 */ export declare function post(config: EditorConfig, url: string, body?: unknown, options?: RequestOptions): Promise; /** * 创建 XHR 请求(用于需要进度回调的场景,如文件上传) */ export declare function createXhrRequest(config: EditorConfig, url: string, options?: { method?: string; headers?: CustomHeaders; onProgress?: (progress: number) => void; onLoad?: (response: string, status: number) => void; onError?: (error: Error) => void; onAbort?: () => void; }): XMLHttpRequest; /** * 获取 AI API 请求头 */ export declare function getAiHeaders(config: EditorConfig): CustomHeaders; /** * 获取上传请求头 */ export declare function getUploadHeaders(config: EditorConfig): CustomHeaders; /** * 获取 AI Copilot API 地址 */ export declare function getAiCopilotUrl(config: EditorConfig): string; /** * 获取 AI 命令 API 地址 */ export declare function getAiCommandUrl(config: EditorConfig): string; /** * 获取 AI 配置 */ export declare function getAiConfig(config: EditorConfig): { copilotUrl: string; commandUrl: string; headers: CustomHeaders; apiKey: string | undefined; model: string | undefined; customCopilot: ((prompt: string, context: string) => Promise) | undefined; customCommand: ((messages: unknown[], options?: unknown) => Promise) | undefined; }; /** * 获取上传配置 */ export declare function getUploadConfig(config: EditorConfig): { url: string; fieldName: string; maxSize: number; acceptTypes: string[] | undefined; headers: CustomHeaders; extraData: Record | undefined; customUpload: ((file: File, onProgress?: (progress: number) => void) => Promise) | undefined; };