| 20 | * Similar to findThinkingTriggerPositions in thinking.ts. |
| 21 | */ |
| 22 | export function findBtwTriggerPositions(text: string): Array<{ |
| 23 | word: string |
| 24 | start: number |
| 25 | end: number |
| 26 | }> { |
| 27 | const positions: Array<{ word: string; start: number; end: number }> = [] |
| 28 | const matches = text.matchAll(BTW_PATTERN) |
| 29 | |
| 30 | for (const match of matches) { |
| 31 | if (match.index !== undefined) { |
| 32 | positions.push({ |
| 33 | word: match[0], |
| 34 | start: match.index, |
| 35 | end: match.index + match[0].length, |
| 36 | }) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | return positions |
| 41 | } |
| 42 | |
| 43 | export type SideQuestionResult = { |
| 44 | response: string | null |