Skip to content

Commit 92e1ffe

Browse files
committed
Remove find relevant files instructions prefix functionality and its associated handlers
- read 'relevant files instructions prefix' only in `apps/editor/src/views/panel/backend/message-handlers/handle-send-to-browser.ts` and `apps/editor/src/views/panel/backend/message-handlers/handle-find-relevant-files.ts`, remove any other handling from the panel.
1 parent 8c026dc commit 92e1ffe

10 files changed

Lines changed: 3 additions & 131 deletions

File tree

‎apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ import { replace_fragment_symbol } from '../utils/replace-fragment-symbol'
2929
import { apply_reasoning_effort } from '@/utils/apply-reasoning-effort'
3030
import { EditContextMessage } from '@/views/panel/types/messages'
3131
import { dictionary } from '@shared/constants/dictionary'
32-
import {
33-
find_relevant_files_instructions_prefix,
34-
find_relevant_files_format
35-
} from '@/constants/instructions'
3632
import {
3733
EDIT_FORMAT_INSTRUCTIONS_WHOLE,
3834
EDIT_FORMAT_INSTRUCTIONS_TRUNCATED,
@@ -406,11 +402,8 @@ export const handle_edit_context = async (
406402
processed_instructions = replace_fragment_symbol(processed_instructions)
407403
}
408404

409-
const is_find_relevant_files =
410-
panel_provider.api_prompt_type == 'find-relevant-files'
411-
const collected = await files_collector.collect_files({
412-
compact: is_find_relevant_files
413-
})
405+
panel_provider.api_prompt_type == 'find-relevant-files'
406+
const collected = await files_collector.collect_files({})
414407
const collected_files = collected.other_files + collected.recent_files
415408

416409
if (!collected_files) {
@@ -467,15 +460,7 @@ export const handle_edit_context = async (
467460
config.get<string>(instructions_key) || default_instructions
468461

469462
let system_instructions_xml = ''
470-
if (is_find_relevant_files) {
471-
const config_find_relevant_files_instructions_prefix = config.get<string>(
472-
'findRelevantFilesInstructionsPrefix'
473-
)
474-
const instructions_to_use =
475-
config_find_relevant_files_instructions_prefix ||
476-
find_relevant_files_instructions_prefix
477-
system_instructions_xml = `${instructions_to_use}\n${find_relevant_files_format}`
478-
} else if (edit_format_instructions) {
463+
if (edit_format_instructions) {
479464
system_instructions_xml = `<system>\n${edit_format_instructions}\n</system>`
480465
}
481466

‎apps/editor/src/views/panel/backend/message-handlers/handle-get-find-relevant-files-instructions-prefix.ts‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎apps/editor/src/views/panel/backend/message-handlers/handle-save-find-relevant-files-instructions-prefix.ts‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎apps/editor/src/views/panel/backend/message-handlers/index.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export * from './handle-preview-generated-code'
5858
export * from './handle-fix-all-failed-files'
5959
export * from './handle-find-relevant-files'
6060
export * from './handle-cancel-intelligent-update-file-in-preview'
61-
export * from './handle-get-find-relevant-files-instructions-prefix'
62-
export * from './handle-save-find-relevant-files-instructions-prefix'
6361
export * from './handle-open-file-and-select'
6462
export * from './handle-open-external-url'
6563
export * from './handle-save-prompt-image'

‎apps/editor/src/views/panel/backend/panel-provider.ts‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ import {
7878
handle_delete_task,
7979
handle_fix_all_failed_files,
8080
handle_find_relevant_files,
81-
handle_get_find_relevant_files_instructions_prefix,
82-
handle_save_find_relevant_files_instructions_prefix,
8381
handle_open_external_url,
8482
handle_hash_sign_quick_pick,
8583
handle_open_file_and_select,
@@ -528,14 +526,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
528526
if (event.affectsConfiguration('codeWebChat.sendWithShiftEnter')) {
529527
this._send_send_with_shift_enter()
530528
}
531-
532-
if (
533-
event.affectsConfiguration(
534-
'codeWebChat.findRelevantFilesInstructionsPrefix'
535-
)
536-
) {
537-
handle_get_find_relevant_files_instructions_prefix(this)
538-
}
539529
}
540530
)
541531

@@ -990,16 +980,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
990980
panel_provider: this,
991981
files_to_fix: message.files
992982
})
993-
} else if (
994-
message.command == 'GET_FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX'
995-
) {
996-
handle_get_find_relevant_files_instructions_prefix(this)
997-
} else if (
998-
message.command == 'SAVE_FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX'
999-
) {
1000-
await handle_save_find_relevant_files_instructions_prefix(
1001-
message.prefix
1002-
)
1003983
} else if (message.command == 'UPSERT_CONFIGURATION') {
1004984
await handle_upsert_configuration(this, message)
1005985
} else if (message.command == 'DELETE_CONFIGURATION') {

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ type Props = {
6161
currently_open_file_text?: string
6262
on_pasted_lines_click: (path: string, start?: string, end?: string) => void
6363
are_keyboard_shortcuts_disabled: boolean
64-
find_relevant_files_instructions_prefix: string
65-
on_find_relevant_files_instructions_prefix_change: (prefix: string) => void
6664
on_open_url: (url: string) => void
6765
on_open_website: (url: string) => void
6866
on_paste_image: (base64_content: string) => void
@@ -847,12 +845,6 @@ export const Main: React.FC<Props> = (props) => {
847845
on_pasted_lines_click={props.on_pasted_lines_click}
848846
currently_open_file_text={props.currently_open_file_text}
849847
are_keyboard_shortcuts_disabled={props.are_keyboard_shortcuts_disabled}
850-
find_relevant_files_instructions_prefix={
851-
props.find_relevant_files_instructions_prefix
852-
}
853-
on_find_relevant_files_instructions_prefix_change={
854-
props.on_find_relevant_files_instructions_prefix_change
855-
}
856848
on_open_url={props.on_open_url}
857849
on_open_website={props.on_open_website}
858850
on_paste_image={props.on_paste_image}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ type Props = {
109109
on_open_url: (url: string) => void
110110
on_open_website: (url: string) => void
111111
are_keyboard_shortcuts_disabled: boolean
112-
find_relevant_files_instructions_prefix: string
113-
on_find_relevant_files_instructions_prefix_change: (prefix: string) => void
114112
on_paste_image: (base64_content: string) => void
115113
on_open_image: (hash: string) => void
116114
on_paste_text: (text: string) => void
@@ -302,12 +300,6 @@ export const MainView: React.FC<Props> = (props) => {
302300
on_open_website={props.on_open_website}
303301
invocation_count={current_invocation_count}
304302
on_invocation_count_change={handle_invocation_count_change}
305-
find_relevant_files_instructions_prefix={
306-
props.find_relevant_files_instructions_prefix
307-
}
308-
on_find_relevant_files_instructions_prefix_change={
309-
props.on_find_relevant_files_instructions_prefix_change
310-
}
311303
on_paste_image={props.on_paste_image}
312304
on_open_image={props.on_open_image}
313305
on_paste_pasted_text={props.on_paste_text}

‎apps/editor/src/views/panel/frontend/Panel.tsx‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ export const Panel = () => {
7373
is_timeline_collapsed,
7474
handle_timeline_collapsed_change,
7575
handle_task_forward,
76-
find_relevant_files_instructions_prefix,
77-
handle_find_relevant_files_instructions_prefix_change,
7876
handle_paste_image,
7977
handle_open_image,
8078
handle_paste_long_text,
@@ -396,12 +394,6 @@ export const Panel = () => {
396394
}
397395
on_pasted_lines_click={handle_pasted_lines_click}
398396
currently_open_file_text={currently_open_file_text}
399-
find_relevant_files_instructions_prefix={
400-
find_relevant_files_instructions_prefix
401-
}
402-
on_find_relevant_files_instructions_prefix_change={
403-
handle_find_relevant_files_instructions_prefix_change
404-
}
405397
on_open_url={handle_open_url}
406398
on_open_website={handle_open_website}
407399
on_paste_image={handle_paste_image}

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ export const use_panel = (vscode: any) => {
5151
configurations_collapsed_by_api_mode,
5252
set_configurations_collapsed_by_api_mode
5353
] = useState<{ [mode in ApiPromptType]?: boolean }>({})
54-
const [
55-
find_relevant_files_instructions_prefix,
56-
set_find_relevant_files_instructions_prefix
57-
] = useState<string>('')
5854
const [is_recording, set_is_recording] = useState(false)
5955
const [setup_progress, set_setup_progress] = useState<SetupProgress>()
6056
const [
@@ -103,15 +99,6 @@ export const use_panel = (vscode: any) => {
10399
})
104100
}
105101

106-
const handle_find_relevant_files_instructions_prefix_change = (
107-
prefix: string
108-
) => {
109-
post_message(vscode, {
110-
command: 'SAVE_FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX',
111-
prefix
112-
})
113-
}
114-
115102
const handle_set_recording_state = (is_recording: boolean) => {
116103
post_message(vscode, {
117104
command: 'SET_RECORDING_STATE',
@@ -162,8 +149,6 @@ export const use_panel = (vscode: any) => {
162149
set_context_size_warning_threshold(message.threshold)
163150
} else if (message.command == 'CAN_UNDO_CHANGED') {
164151
set_can_undo(message.can_undo)
165-
} else if (message.command == 'FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX') {
166-
set_find_relevant_files_instructions_prefix(message.prefix)
167152
} else if (message.command == 'RECORDING_STATE') {
168153
set_is_recording(message.is_recording)
169154
} else if (message.command == 'SETUP_PROGRESS') {
@@ -187,7 +172,6 @@ export const use_panel = (vscode: any) => {
187172
{ command: 'GET_COLLAPSED_STATES' },
188173
{ command: 'GET_CHECKPOINTS' },
189174
{ command: 'REQUEST_CAN_UNDO' },
190-
{ command: 'GET_FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX' },
191175
{ command: 'GET_SETUP_PROGRESS' },
192176
{ command: 'GET_FIND_RELEVANT_FILES_SHRINK_SOURCE_CODE' }
193177
]
@@ -312,15 +296,13 @@ export const use_panel = (vscode: any) => {
312296
: false,
313297
is_timeline_collapsed,
314298
handle_task_forward,
315-
find_relevant_files_instructions_prefix,
316299
handle_instructions_change,
317300
handle_web_prompt_type_change,
318301
handle_api_prompt_type_change,
319302
handle_mode_change,
320303
handle_presets_collapsed_change,
321304
handle_timeline_collapsed_change,
322305
handle_configurations_collapsed_change,
323-
handle_find_relevant_files_instructions_prefix_change,
324306
handle_paste_image,
325307
handle_open_image,
326308
handle_paste_long_text,

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,6 @@ export interface UpdateFileProgressMessage extends BaseMessage {
489489
apply_tokens_per_second?: number
490490
}
491491

492-
export interface GetFindRelevantFilesInstructionsPrefixMessage extends BaseMessage {
493-
command: 'GET_FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX'
494-
}
495-
496-
export interface SaveFindRelevantFilesInstructionsPrefixMessage extends BaseMessage {
497-
command: 'SAVE_FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX'
498-
prefix: string
499-
}
500-
501492
export interface OpenExternalUrlMessage extends BaseMessage {
502493
command: 'OPEN_EXTERNAL_URL'
503494
url: string
@@ -670,8 +661,6 @@ export type FrontendMessage =
670661
| DeleteTaskMessage
671662
| PreviewGeneratedCodeMessage
672663
| UpdateFileProgressMessage
673-
| GetFindRelevantFilesInstructionsPrefixMessage
674-
| SaveFindRelevantFilesInstructionsPrefixMessage
675664
| OpenExternalUrlMessage
676665
| UpsertConfigurationMessage
677666
| DeleteConfigurationMessage
@@ -937,11 +926,6 @@ export interface TasksMessage extends BaseMessage {
937926
tasks: Record<string, Task[]>
938927
}
939928

940-
export interface FindRelevantFilesInstructionsPrefixMessage extends BaseMessage {
941-
command: 'FIND_RELEVANT_FILES_INSTRUCTIONS_PREFIX'
942-
prefix: string
943-
}
944-
945929
export interface FindRelevantFilesShrinkSourceCodeMessage extends BaseMessage {
946930
command: 'FIND_RELEVANT_FILES_SHRINK_SOURCE_CODE'
947931
shrink_source_code: boolean
@@ -1013,7 +997,6 @@ export type BackendMessage =
1013997
| ShowPreviewOngoingModalMessage
1014998
| TasksMessage
1015999
| UpdateFileProgressMessage
1016-
| FindRelevantFilesInstructionsPrefixMessage
10171000
| RecordingStateMessage
10181001
| FindRelevantFilesShrinkSourceCodeMessage
10191002
| SetupProgressMessage

0 commit comments

Comments
 (0)