(question: string, answer: string)
| 543 | |
| 544 | // 格式化回答消息 |
| 545 | function formatResponse(question: string, answer: string): string { |
| 546 | let finalText = ""; |
| 547 | |
| 548 | if (question.trim()) { |
| 549 | // 添加问题部分 |
| 550 | finalText += "<b>Q:</b>\n"; |
| 551 | const htmlQuestion = markdownToHtml(question); |
| 552 | finalText += `<blockquote>${htmlQuestion}</blockquote>\n\n`; |
| 553 | } |
| 554 | |
| 555 | // 添加回答部分 |
| 556 | finalText += "<b>A:</b>\n"; |
| 557 | const htmlAnswer = markdownToHtml(answer); |
| 558 | finalText += `<blockquote>${htmlAnswer}</blockquote>`; |
| 559 | |
| 560 | return finalText; |
| 561 | } |
| 562 | |
| 563 | // 清理临时文件 |
| 564 | async function cleanupTempFile(filePath?: string): Promise<void> { |
no test coverage detected