Skip to content

Commit 104e64a

Browse files
committed
Introduce is_no_context_mode to disable token count calculations and checkbox states in the workspace provider
- switching to 'no context' prompt type doesn't clear badge token counter
1 parent 589aeef commit 104e64a

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎apps/editor/src/context/context-initialization.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,14 @@ export const context_initialization = async (
134134
const update_view_badges = async () => {
135135
let context_token_count = 0
136136
if (context_provider && context_view) {
137-
const token_counts =
138-
await workspace_provider.get_checked_files_token_count()
139-
const files_count = workspace_provider.use_shrink_token_count
140-
? token_counts.shrink
141-
: token_counts.total
142-
context_token_count = files_count
137+
if (!workspace_provider.is_no_context_mode) {
138+
const token_counts =
139+
await workspace_provider.get_checked_files_token_count()
140+
const files_count = workspace_provider.use_shrink_token_count
141+
? token_counts.shrink
142+
: token_counts.total
143+
context_token_count = files_count
144+
}
143145

144146
workspace_view.badge = {
145147
value: round_token_count_for_badge(context_token_count),

‎apps/editor/src/context/providers/workspace/workspace-provider.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface IWorkspaceProvider {
3434
frf: { checked_files: string[]; checked_timestamps: Record<string, number> }
3535
}
3636
readonly is_frf_mode: boolean
37+
readonly is_no_context_mode: boolean
3738
}
3839

3940
export class WorkspaceProvider
@@ -69,6 +70,10 @@ export class WorkspaceProvider
6970
return this._is_frf_mode
7071
}
7172

73+
public get is_no_context_mode(): boolean {
74+
return this._is_no_context_mode
75+
}
76+
7277
private get _checked_items() {
7378
return this._is_frf_mode
7479
? this._frf_state.checked_items
@@ -692,7 +697,7 @@ export class WorkspaceProvider
692697
: undefined
693698

694699
const formatted_selected =
695-
selected_token_count !== undefined && selected_token_count > 0
700+
selected_token_count !== undefined && selected_token_count > 0 && !this._is_no_context_mode
696701
? display_token_count(selected_token_count)
697702
: undefined
698703

0 commit comments

Comments
 (0)