Skip to content

Commit aef49f4

Browse files
committed
Simplify shrink token calculation by removing unnecessary content length tracking
1 parent a6c25c8 commit aef49f4

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

apps/editor/src/commands/find-relevant-files-command.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ export const find_relevant_files_command = (
121121
folder_path
122122

123123
let full_tokens = 0
124-
let full_content_length = 0
125-
let shrunk_content_length = 0
124+
let shrink_tokens = 0
126125

127126
const files_data: {
128127
file_path: string
@@ -156,24 +155,15 @@ export const find_relevant_files_command = (
156155
shrunk_content
157156
})
158157

159-
full_content_length += content.length
160-
shrunk_content_length += shrunk_content.length
161-
162158
const token_count =
163159
await workspace_provider.calculate_file_tokens(file_path)
164160
full_tokens += token_count.total
161+
shrink_tokens += token_count.shrink
165162
} catch (e) {}
166163
}
167164
}
168165
)
169166

170-
const shrink_tokens =
171-
full_content_length > 0
172-
? Math.floor(
173-
full_tokens * (shrunk_content_length / full_content_length)
174-
)
175-
: 0
176-
177167
let go_back_to_input = false
178168
while (true) {
179169
const shrink_items: vscode.QuickPickItem[] = [

0 commit comments

Comments
 (0)