* 增强的 Gemini API 调用函数(向后兼容) * @param {string} apiKey - API 密钥 * @param {string} prompt - 提示词 * @returns {Promise } 调用结果
(apiKey, prompt)
| 548 | * @returns {Promise<Object>} 调用结果 |
| 549 | */ |
| 550 | async 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 | * 提交记录解析器 |
no test coverage detected