MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / callGeminiAPI

Function callGeminiAPI

scripts/update-template.js:550–565  ·  view source on GitHub ↗

* 增强的 Gemini API 调用函数(向后兼容) * @param {string} apiKey - API 密钥 * @param {string} prompt - 提示词 * @returns {Promise } 调用结果

(apiKey, prompt)

Source from the content-addressed store, hash-verified

548 * @returns {Promise<Object>} 调用结果
549 */
550async function callGeminiAPI(apiKey, prompt) {
551 try {
552 const client = new GeminiClient(apiKey);
553 return await client.generateContent(prompt);
554 } catch (error) {
555 logger.error('Failed to initialize Gemini client', {
556 error: error.message,
557 type: error.type
558 });
559 return {
560 success: false,
561 error: error.message,
562 type: error.type || ErrorTypes.API_ERROR
563 };
564 }
565}
566
567/**
568 * 提交记录解析器

Callers 1

summarizeWithGeminiFunction · 0.85

Calls 2

generateContentMethod · 0.95
errorMethod · 0.80

Tested by

no test coverage detected