UNPKG

@mxlabs/okxnotify

Version:

OKX notification package with Feishu, Cloudflare Workers, and Gemini AI agent integration - Complete bundle

97 lines (96 loc) 2.64 kB
import { IBrowserRenderScrapeResult } from '../cloudflare'; import { GEMINI_MODEL } from '../constant'; export declare const getHtmlList: (resultList: IBrowserRenderScrapeResult["results"]) => (string | undefined)[]; /** * 获取Gemini返回的text内容 * @param response Gemini返回的response * @returns 返回的text内容 */ export declare const getGeminiText: (response: { candidates: { content: { parts: { text: string; }[]; }; }[]; }) => string; /** * 将Gemini的response转换为text * @param response Gemini的response * @returns 返回的text内容 */ export declare const responseToText: (response: IGeminiResponse) => string; /** * 获取Gemini Model 的URL * @param model Gemini的模型 * @param ability Gemini的ability * @returns 返回的URL */ export declare const GET_MODEL_URL: (model: GEMINI_MODEL, ability?: string) => string; /** * Gemini 生成内容配置 * @see https://ai.google.dev/api/generate-content?hl=zh-cn#v1beta.GenerationConfig */ export interface GEMINI_GENERATION_CONFIG { /** 随机数重要字段 */ temperature: number; topP: number; topK: number; seed: number; presencePenalty: number; frequencyPenalty: number; responseLogprobs: boolean; logprobs: number; enableEnhancedCivicAnswers: boolean; speechConfig: Record<string, any>; thinkingConfig: Record<string, any>; mediaResolution: string; } /** * 获取Gemini 生成的内容 * @param params * @returns */ export declare const fetchGeminiTextAnlysis: (params: { text: string; prompt: string; model?: GEMINI_MODEL; generationConfig?: GEMINI_GENERATION_CONFIG; }) => Promise<string>; /** * 获取Scrape抓取页面指定元素,网页内容并使用Gemini进行分析 * 适用场景: * - SSR 页面渲染 * - 需要抓取指定元素 * - 返回数组 * @param params 包含url和elements选择器数组 * @returns 分析后的内容 */ export declare const fetchHtmlScrapeAndAnalysis: (params: { url: string; selector: string; prompt: string; model?: GEMINI_MODEL; }) => Promise<string>; interface IGeminiResponse { candidates: { content: { parts: { text: string; }[]; }; }[]; } /** * 获取网页内容并使用Gemini进行分析 * @param params 包含url和elements选择器数组 * @returns 分析后的内容 */ export declare const fetchHtmlWaitSelectorAndAnalysis: (params: { url: string; selector: string; prompt: string; model?: GEMINI_MODEL; }) => Promise<string>; export {};