( chatHistory: ChatHistoryItem[], )
| 172 | * @returns The index of the compaction message, or null if not found |
| 173 | */ |
| 174 | export function findCompactionIndex( |
| 175 | chatHistory: ChatHistoryItem[], |
| 176 | ): number | null { |
| 177 | const compactedIndex = chatHistory.findIndex( |
| 178 | (item) => item.conversationSummary !== undefined, |
| 179 | ); |
| 180 | return compactedIndex === -1 ? null : compactedIndex; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Gets the history to send to the LLM, taking compaction into account |
no outgoing calls
no test coverage detected