MCPcopy
hub / github.com/continuedev/continue / isItemTooBig

Method isItemTooBig

core/core.ts:1191–1209  ·  view source on GitHub ↗
(item: ContextItemWithId)

Source from the content-addressed store, hash-verified

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<{

Callers 1

Calls 2

countTokensFunction · 0.90
loadConfigMethod · 0.45

Tested by

no test coverage detected