(log: LogOption)
| 2844 | |
| 2845 | // Filter out /insights meta-sessions (facet extraction API calls get logged as sessions) |
| 2846 | const isMetaSession = (log: LogOption): boolean => { |
| 2847 | for (const msg of log.messages.slice(0, 5)) { |
| 2848 | if (msg.type === 'user' && msg.message) { |
| 2849 | const content = msg.message.content |
| 2850 | if (typeof content === 'string') { |
| 2851 | if ( |
| 2852 | content.includes('RESPOND WITH ONLY A VALID JSON OBJECT') || |
| 2853 | content.includes('record_facets') |
| 2854 | ) { |
| 2855 | return true |
| 2856 | } |
| 2857 | } |
| 2858 | } |
| 2859 | } |
| 2860 | return false |
| 2861 | } |
| 2862 | |
| 2863 | // Load uncached sessions in batches to yield to event loop between batches |
| 2864 | const LOAD_BATCH_SIZE = 10 |
no outgoing calls
no test coverage detected