import type { UpstreamInterceptor } from './types.js'; /** * Qwen 上下文缓存拦截器 * * 当请求的目标模型包含 "qwen" 时,自动在请求体中的适当位置插入 * cache_control: { type: "ephemeral" } 标记,触发阿里云百炼上下文缓存。 */ /** * 在 tools 数组的最后一条上添加 cache_control。 * 如果 tools 为空或不存在,返回原数组。 */ export declare function addCacheControlToTools(tools: any[] | undefined): any[] | undefined; /** * 在 messages 数组的最后一条的 content 上添加 cache_control。 * - content 是数组:在 content[0] 上加 * - content 是字符串:转成 [{ type: 'text', text, cache_control }] * - 无 messages 或为空:返回原数组 */ export declare function addCacheControlToLastMessage(messages: any[] | undefined): any[] | undefined; /** * 确保 content 是数组格式。 * 如果是 string,转为 [{ type: 'text', text: content }]。 * 如果已经是数组,原样返回。其他情况返回 undefined。 */ export declare function ensureContentArray(content: any): any[] | undefined; /** * 在 content 数组的最后一个 text block 上添加 cache_control。 * 如果数组为空或没有 text block,返回原数组(不计数)。 */ export declare function addCacheControlToLastTextBlock(blocks: any[]): any[]; /** * 在 system messages 上按顺序添加 cache_control,最多不超过 quota 条。 * 返回处理后的 messages 新数组。 */ export declare function addCacheControlToSystemMessages(messages: any[], quota: number): any[]; /** * Qwen 上下文缓存拦截器。 * * 触发条件:realModel 小写包含 "qwen" 且 body 有非空 messages。 * 按优先级注入最多 4 个 cache_control 标记。 */ export declare const qwenCacheInterceptor: UpstreamInterceptor; //# sourceMappingURL=qwen-cache.d.ts.map