(item: LLMInteractionItem)
| 101 | } |
| 102 | |
| 103 | private getInteractionData(item: LLMInteractionItem) { |
| 104 | let interaction = this.interactions[item.interactionId]; |
| 105 | if (interaction !== undefined) { |
| 106 | return interaction; |
| 107 | } |
| 108 | |
| 109 | let usedPrefixes = Object.values(this.interactions).map( |
| 110 | (interaction) => interaction.prefix, |
| 111 | ); |
| 112 | |
| 113 | // Select a prefix that is not currently in use, and is |
| 114 | // also not the last retired prefix - but with the |
| 115 | // exception that we can reuse the empty prefix " " |
| 116 | // immediately - this isn't confusing. |
| 117 | let i = 0; |
| 118 | let prefix; |
| 119 | while (true) { |
| 120 | const candidate = i < LOG_PREFIXES.length ? LOG_PREFIXES[i] : `X`; |
| 121 | if ( |
| 122 | !usedPrefixes.includes(candidate) && |
| 123 | (candidate === " " || candidate !== this.lastFreedPrefix) |
| 124 | ) { |
| 125 | prefix = candidate; |
| 126 | break; |
| 127 | } |
| 128 | i++; |
| 129 | } |
| 130 | |
| 131 | this.interactions[item.interactionId] = { |
| 132 | prefix, |
| 133 | startItem: item, |
| 134 | lastItem: null, |
| 135 | }; |
| 136 | |
| 137 | return this.interactions[item.interactionId]; |
| 138 | } |
| 139 | |
| 140 | private formatTimestamp( |
| 141 | interaction: InteractionData, |
no outgoing calls
no test coverage detected