(item: ContextItemWithId)
| 1189 | } |
| 1190 | |
| 1191 | private async isItemTooBig(item: ContextItemWithId) { |
| 1192 | const { config } = await this.configHandler.loadConfig(); |
| 1193 | if (!config) { |
| 1194 | return false; |
| 1195 | } |
| 1196 | |
| 1197 | const llm = config?.selectedModelByRole.chat; |
| 1198 | if (!llm) { |
| 1199 | throw new Error("No chat model selected"); |
| 1200 | } |
| 1201 | |
| 1202 | const tokens = countTokens(item.content, llm.model); |
| 1203 | |
| 1204 | if (tokens > llm.contextLength - llm.completionOptions!.maxTokens!) { |
| 1205 | return true; |
| 1206 | } |
| 1207 | |
| 1208 | return false; |
| 1209 | } |
| 1210 | |
| 1211 | private handleAddAutocompleteModel( |
| 1212 | msg: Message<{ |
no test coverage detected