import { Infer } from "../../../../services/extension/types"; import { Context, Schema } from "koishi"; interface SearchConfig { endpoint: string; limit: number; sources: string[]; format: "json" | "html"; customUA: string; usePuppeteer: boolean; httpTimeout: number; puppeteerTimeout: number; puppeteerWaitTime: number; } export default class SearchExtension { ctx: Context; config: SearchConfig; static readonly Config: Schema; static readonly inject: { required: string[]; optional: string[]; }; constructor(ctx: Context, config: SearchConfig); fetchWebPage(args: Infer<{ url: string; format: "html" | "text"; max_length: number; include_links: boolean; max_links: number; use_dynamic: boolean; }>): Promise>; /** * 使用 Puppeteer 获取并提取网页内容 * @param url 要获取的网页URL * @param isDynamic 是否使用动态加载模式 (page.goto) 或静态加载模式 (http.get + page.setContent) * @param maxLinks 要提取的最大链接数,为0则不提取 * @returns 包含标题、HTML内容、纯文本和链接的对象 */ private _fetchAndExtractWithPuppeteer; webSearch(args: Infer<{ query: string; }>): Promise>; } export {};