The route destructured PROMPTS/INJECTION_GUARD/wrapUserText from ../utils/prompts, but PROMPTS is the module's default export and the other two live in ../utils/promptSafe. All three resolved to undefined, so every /api/generate-pe-narrative request crashed with "Cannot read properties of undefined (reading 'peGuideNarrative')" and the client surfaced "Request failed" for PE Guide narrative and summary generation. Split the require into the two-line form that every other AI route already uses. |
||
|---|---|---|
| .. | ||
| db | ||
| middleware | ||
| routes | ||
| utils | ||