* 生成内容 * @param {string} prompt * @returns {Promise }
(prompt)
| 524 | * @returns {Promise<Object>} |
| 525 | */ |
| 526 | async generateContent(prompt) { |
| 527 | // 验证输入 |
| 528 | if (!Validator.validatePrompt(prompt)) { |
| 529 | return { |
| 530 | success: false, |
| 531 | error: 'Invalid prompt', |
| 532 | type: ErrorTypes.API_ERROR |
| 533 | }; |
| 534 | } |
| 535 | |
| 536 | // 清理输入 |
| 537 | const sanitizedPrompt = Validator.sanitizeInput(prompt); |
| 538 | |
| 539 | // 执行 API 调用 |
| 540 | return this.executeWithRetry(sanitizedPrompt); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | /** |
no test coverage detected