(prompt: string)
| 1238 | * stays. |
| 1239 | */ |
| 1240 | export function stripSystemReminders(prompt: string): string { |
| 1241 | // Only the text up to the last closing tag can hold a complete block, and |
| 1242 | // bounding the scan there keeps an unclosed tag from rescanning the tail. |
| 1243 | const end = prompt.lastIndexOf(SYSTEM_REMINDER_CLOSE); |
| 1244 | if (end < 0) return prompt.trim(); |
| 1245 | const head = prompt.slice(0, end + SYSTEM_REMINDER_CLOSE.length); |
| 1246 | return (head.replace(SYSTEM_REMINDER_BLOCK, '\n') + prompt.slice(head.length)).trim(); |
| 1247 | } |
no outgoing calls
no test coverage detected