Skip to content

Commit a6711d9

Browse files
committed
Remove context size warning threshold feature and its UI, simplify ContextUtilisation to a plain token count label, revert Tabs to WEB/API labels with separator styling, and drop the top task add button
- make tabs look more like... - should not show border under active tab [Image] - remove 'context size warning threshold' ├── apps │ └── editor │ ├── package.json │ └── src │ └── views │ ├── prompt │ │ ├── backend │ │ │ └── prompt-view-provider.ts │ │ ├── frontend │ │ │ ├── Main │ │ │ │ ├── Main.tsx │ │ │ │ ├── MainView │ │ │ │ │ ├── MainView.tsx │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ │ ├── Prompt.tsx │ │ │ └── hooks │ │ │ └── use-prompt │ │ │ ├── index.ts │ │ │ └── use-prompt.ts │ │ └── types │ │ └── messages.ts │ └── settings │ ├── backend │ │ ├── message-handlers │ │ │ └── index.ts │ │ └── settings-view-provider.ts │ ├── frontend │ │ ├── Home │ │ │ ├── Home.tsx │ │ │ └── sections │ │ │ └── GeneralSection.tsx │ │ ├── Settings.tsx │ │ ├── hooks │ │ │ └── use-settings.ts │ │ └── i18n │ │ └── translations │ │ ├── general.ts │ │ └── index.ts │ └── types │ └── messages.ts └── packages └── ui └── src └── components └── editor └── prompt ├── ContextUtilisation │ ├── ContextUtilisation.module.scss │ ├── ContextUtilisation.stories.tsx │ ├── ContextUtilisation.tsx │ └── index.ts └── Tabs ├── Tabs.module.scss ├── Tabs.tsx └── index.ts
1 parent 42dbc6e commit a6711d9

24 files changed

Lines changed: 39 additions & 357 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -974,10 +974,6 @@
974974
"type": "boolean",
975975
"scope": "resource"
976976
},
977-
"codeWebChat.contextSizeWarningThreshold": {
978-
"type": "number",
979-
"scope": "resource"
980-
},
981977
"codeWebChat.checkpointLifespan": {
982978
"type": "number",
983979
"scope": "resource"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export const CHECKPOINT_DEFAULT_LIFESPAN = 24
2-
export const DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD = 60000
32
export const MAX_FILE_TOKENS_FOR_COMMIT_MESSAGE = 20000
43
export const MAX_PROMPT_CHARS_IN_COMMIT_MESSAGE = 1000
54
export const GIT_LOG_SINCE_DURATION = '6 months ago'

‎apps/editor/src/views/prompt/backend/prompt-view-provider.ts‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ import { ApiPromptType, WebPromptType } from '@shared/types/prompt-types'
109109
import { Logger } from '@shared/utils/logger'
110110
import { ResponseHistoryItem } from '@shared/types/response-history-item'
111111
import { dictionary } from '@shared/constants/dictionary'
112-
import { DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD } from '@/constants/values'
113112
import { ModelProvidersManager } from '@/services/model-providers-manager'
114113
import { SharedContextState } from '@/context/shared-context-state'
115114
import { webview_html } from '@/views/shared/utils/webview-html'
@@ -369,12 +368,6 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
369368
this.send_web_configurations_to_webview(this.webview_view.webview)
370369
}
371370

372-
if (
373-
event.affectsConfiguration('codeWebChat.contextSizeWarningThreshold')
374-
) {
375-
this._send_context_size_warning_threshold()
376-
}
377-
378371
if (event.affectsConfiguration('codeWebChat.apiConfigurations')) {
379372
handle_get_api_configurations(this)
380373
}
@@ -642,8 +635,6 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
642635
handle_request_editor_state(this)
643636
} else if (message.command == 'REQUEST_EDITOR_SELECTION_STATE') {
644637
handle_request_editor_selection_state(this)
645-
} else if (message.command == 'GET_CONTEXT_SIZE_WARNING_THRESHOLD') {
646-
this._send_context_size_warning_threshold()
647638
} else if (message.command == 'REQUEST_CURRENTLY_OPEN_FILE_TEXT') {
648639
this.send_currently_open_file_text()
649640
} else if (message.command == 'REORDER_WEB_CONFIGURATIONS') {
@@ -876,18 +867,6 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
876867
})
877868
}
878869

879-
private _send_context_size_warning_threshold() {
880-
if (!this.webview_view) return
881-
const config = vscode.workspace.getConfiguration('codeWebChat')
882-
const threshold =
883-
config.get<number>('contextSizeWarningThreshold') ||
884-
DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD
885-
this.send_message({
886-
command: 'CONTEXT_SIZE_WARNING_THRESHOLD',
887-
threshold
888-
})
889-
}
890-
891870
public set_undo_button_state = (can_undo: boolean) => {
892871
this.send_message({
893872
command: 'CAN_UNDO_CHANGED',

‎apps/editor/src/views/prompt/frontend/Home/Home.tsx‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { ResponseHistoryItem } from '@shared/types/response-history-item'
1111
import { Separator as UiSeparator } from '@ui/components/editor/prompt/Separator'
1212
import { AsciiArtEffect } from '@ui/components/editor/prompt/AsciiArtEffect'
1313
import { Translation, use_translation } from '../i18n/use-translation'
14-
import { IconButton as UiIconButton } from '@ui/components/editor/common/IconButton'
1514
import { CompactableActionButton } from '@ui/components/editor/prompt/CompactableActionButton'
1615
import { Tasks as UiTasks } from '@ui/components/editor/prompt/Tasks'
1716
import { use_tasks } from './hooks/use-tasks'
@@ -224,22 +223,12 @@ export const Home: React.FC<Props> = (props) => {
224223
</div>
225224
</div>
226225
)}
227-
{roots.length > 0 && (
228-
<UiIconButton
229-
codicon_icon="add"
230-
title={t('home.tasks.add')}
231-
on_click={(e) => {
232-
e.stopPropagation()
233-
if (active_root) {
234-
handle_add(active_root, tasks[active_root], 'top')
235-
}
236-
}}
237-
/>
238-
)}
239226
</>
240227
}
241228
/>
242229

230+
<UiSeparator height={6} />
231+
243232
{roots.length == 0 && (
244233
<div className={styles.inner__empty}>{t('home.tasks.empty')}</div>
245234
)}

‎apps/editor/src/views/prompt/frontend/Home/hooks/use-tasks.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,14 @@ export const use_tasks = (vscode: any) => {
100100
)
101101
}
102102

103-
const handle_add = (
104-
root: string,
105-
root_tasks: Task[],
106-
placement: 'top' | 'bottom' = 'bottom'
107-
) => {
103+
const handle_add = (root: string, root_tasks: Task[]) => {
108104
const new_task: Task = {
109105
text: '',
110106
is_checked: false,
111107
created_at: Date.now(),
112108
children: []
113109
}
114-
const new_list =
115-
placement == 'top' ? [new_task, ...root_tasks] : [...root_tasks, new_task]
110+
const new_list = [...root_tasks, new_task]
116111
handle_tasks_change(root, new_list)
117112
}
118113

‎apps/editor/src/views/prompt/frontend/Main/Main.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type Props = {
4444
current_selection?: SelectionState | null
4545
chat_input_focus_and_select_key: number
4646
chat_input_focus_key: number
47-
context_size_warning_threshold: number
4847
selected_files: string[]
4948
send_with_shift_enter: boolean
5049
currently_open_file_text?: string
@@ -498,7 +497,6 @@ export const Main: React.FC<Props> = (props) => {
498497
token_count={props.token_count}
499498
web_prompt_type={props.web_prompt_type}
500499
api_prompt_type={props.api_prompt_type}
501-
context_size_warning_threshold={props.context_size_warning_threshold}
502500
on_web_prompt_type_change={props.on_web_prompt_type_change}
503501
on_api_prompt_type_change={props.on_api_prompt_type_change}
504502
edit_format={edit_format}

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ type Props = {
5656
current_selection?: SelectionState | null
5757
chat_history: string[]
5858
token_count: number
59-
context_size_warning_threshold: number
6059
web_prompt_type: WebPromptType
6160
api_prompt_type: ApiPromptType
6261
on_web_prompt_type_change: (prompt_type: WebPromptType) => void
@@ -383,9 +382,6 @@ export const MainView: React.FC<Props> = (props) => {
383382
/>
384383
<UiContextUtilisation
385384
current_context_size={props.token_count}
386-
context_size_warning_threshold={
387-
props.context_size_warning_threshold
388-
}
389385
is_context_disabled={false}
390386
/>
391387
</div>
@@ -394,15 +390,17 @@ export const MainView: React.FC<Props> = (props) => {
394390

395391
<UiTabs
396392
tabs={[
397-
{ id: 'chatbots', label: t('home.mode.chatbots') },
398-
{ id: 'api-calls', label: t('home.mode.api-calls') }
393+
{ id: 'web', label: 'WEB' },
394+
{ id: 'api', label: 'API' }
399395
]}
400-
active_tab={props.mode == MODE.WEB ? 'chatbots' : 'api-calls'}
396+
active_tab={props.mode == MODE.WEB ? 'web' : 'api'}
401397
on_tab_change={(id) =>
402-
props.on_mode_change(id == 'chatbots' ? MODE.WEB : MODE.API)
398+
props.on_mode_change(id == 'web' ? MODE.WEB : MODE.API)
403399
}
404400
/>
405401

402+
<UiSeparator height={6} />
403+
406404
{props.mode == MODE.WEB && (
407405
<UiConfigurations
408406
configurations={web_configurations}

‎apps/editor/src/views/prompt/frontend/Prompt.tsx‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export const Prompt = () => {
5353
chat_input_focus_key,
5454
set_chat_input_focus_key,
5555
chat_input_focus_and_select_key,
56-
context_size_warning_threshold,
5756
can_undo,
5857
send_with_shift_enter,
5958
handle_instructions_change,
@@ -156,8 +155,7 @@ export const Prompt = () => {
156155
is_connected === undefined ||
157156
api_prompt_type === undefined ||
158157
current_selection === undefined ||
159-
workspace_folder_count === undefined ||
160-
context_size_warning_threshold === undefined
158+
workspace_folder_count === undefined
161159
) {
162160
return null
163161
}
@@ -349,7 +347,6 @@ export const Prompt = () => {
349347
chat_input_focus_and_select_key
350348
}
351349
chat_input_focus_key={chat_input_focus_key}
352-
context_size_warning_threshold={context_size_warning_threshold}
353350
selected_files={selected_files}
354351
send_with_shift_enter={send_with_shift_enter}
355352
on_pasted_lines_click={handle_pasted_lines_click}

‎apps/editor/src/views/prompt/frontend/hooks/use-prompt/use-prompt.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ export const use_prompt = (vscode: any) => {
3737
handle_tabs_reorder
3838
} = use_instructions(vscode, mode, web_prompt_type, api_prompt_type)
3939

40-
const [context_size_warning_threshold, set_context_size_warning_threshold] =
41-
useState<number>()
4240
const [can_undo, set_can_undo] = useState<boolean>(false)
4341
const [send_with_shift_enter, set_send_with_shift_enter] = useState(false)
4442
const [is_recording, set_is_recording] = useState(false)
@@ -110,8 +108,6 @@ export const use_prompt = (vscode: any) => {
110108
message.command == 'RESET_APPLY_BUTTON_TEMPORARY_DISABLED_STATE'
111109
) {
112110
set_apply_button_enabling_trigger_count((c) => c + 1)
113-
} else if (message.command == 'CONTEXT_SIZE_WARNING_THRESHOLD') {
114-
set_context_size_warning_threshold(message.threshold)
115111
} else if (message.command == 'CAN_UNDO_CHANGED') {
116112
set_can_undo(message.can_undo)
117113
} else if (message.command == 'RECORDING_STATE') {
@@ -136,7 +132,6 @@ export const use_prompt = (vscode: any) => {
136132
{ command: 'GET_WEB_PROMPT_TYPE' },
137133
{ command: 'GET_API_PROMPT_TYPE' },
138134
{ command: 'GET_CONNECTION_STATUS' },
139-
{ command: 'GET_CONTEXT_SIZE_WARNING_THRESHOLD' },
140135
{ command: 'GET_SEND_WITH_SHIFT_ENTER' },
141136
{ command: 'REQUEST_CAN_UNDO' },
142137
{ command: 'GET_SETUP_PROGRESS' },
@@ -221,7 +216,6 @@ export const use_prompt = (vscode: any) => {
221216
chat_input_focus_key,
222217
set_chat_input_focus_key,
223218
chat_input_focus_and_select_key,
224-
context_size_warning_threshold,
225219
can_undo,
226220
send_with_shift_enter,
227221
handle_instructions_change,

‎apps/editor/src/views/prompt/types/messages.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ export interface SaveHistoryMessage extends BaseMessage {
147147
prompt_type: 'ask-about-files' | 'edit-files'
148148
}
149149

150-
export interface GetContextSizeWarningThresholdMessage extends BaseMessage {
151-
command: 'GET_CONTEXT_SIZE_WARNING_THRESHOLD'
152-
}
153-
154150
export interface CreateWebConfigurationMessage extends BaseMessage {
155151
command: 'CREATE_WEB_CONFIGURATION'
156152
reference_index?: number
@@ -535,7 +531,6 @@ export type FrontendMessage =
535531
| GetHistoryMessage
536532
| GetResponseHistoryMessage
537533
| SaveHistoryMessage
538-
| GetContextSizeWarningThresholdMessage
539534
| CreateWebConfigurationMessage
540535
| UpdateWebConfigurationMessage
541536
| DeleteWebConfigurationMessage
@@ -670,11 +665,6 @@ export interface TokenCountMessage extends BaseMessage {
670665
token_count: number
671666
}
672667

673-
export interface ContextSizeWarningThresholdMessage extends BaseMessage {
674-
command: 'CONTEXT_SIZE_WARNING_THRESHOLD'
675-
threshold: number
676-
}
677-
678668
export interface WebConfigurationUpdatedMessage extends BaseMessage {
679669
command: 'WEB_CONFIGURATION_UPDATED'
680670
}
@@ -871,7 +861,6 @@ export type BackendMessage =
871861
| ChatHistoryMessage
872862
| ResponseHistoryMessage
873863
| TokenCountMessage
874-
| ContextSizeWarningThresholdMessage
875864
| WebConfigurationUpdatedMessage
876865
| NewlyPickedModelMessage
877866
| NewlyPickedChatbotMessage

0 commit comments

Comments
 (0)