Add AI Features Behind a Transcript Store, Not a Live Call
说明与用途
通过存储转录而非实时调用来添加 AI 功能,提高了可靠性,支持重试并实现审计。
问题
Live AI calls in request paths cause failures and loss of data when the provider errors, making it hard to debug and recover.
结果
The new design eliminates live call failures by persisting transcripts, enabling retries, auditing, and smoother user experience.
工作流
- 1. User triggers AI feature via POST request.
- 2. Handler validates permissions and incident existence.
- 3. Handler creates a transcript row with status 'queued' and stores input payload.
- 4. Background worker picks up queued rows, calls the AI provider, updates status to 'running' and then to 'succeeded' or 'failed' with output payload.
- 5. UI polls the transcript row endpoint to display current status and result.
- 6. On failure, UI shows error and allows retry; transcript remains for incident review.
证据
I opened the API logs, found a 502 from the provider, and discovered nothing durable remained.
The HTTP handler writes a queued transcript, and a worker may fill the output later.
- 记录日期: 2026-09-15T15:45:35.011Z