@@ -18,6 +18,7 @@ import {
1818 EDIT_FORMAT_INSTRUCTIONS_TRUNCATED ,
1919 EDIT_FORMAT_INSTRUCTIONS_WHOLE
2020} from '@/constants/edit-format-instructions'
21+ import { find_relevant_files_instructions_prefix as default_find_relevant_files_instructions_prefix } from '@/constants/instructions'
2122import { use_translation } from '../../i18n/use-translation'
2223
2324type ClearChecksBehavior = 'ignore-open-editors' | 'uncheck-all'
@@ -28,13 +29,17 @@ type Props = {
2829 send_with_shift_enter : boolean
2930 check_new_files : boolean
3031 checkpoint_lifespan : number
32+ find_relevant_files_instructions_prefix : string
3133 gemini_user_id : number | null
3234 ai_studio_user_id : number | null
3335 on_gemini_user_id_change : ( id : number | null ) => void
3436 on_ai_studio_user_id_change : ( id : number | null ) => void
3537 on_automatic_checkpoints_toggle : ( disabled : boolean ) => void
3638 on_send_with_shift_enter_change : ( enabled : boolean ) => void
3739 on_check_new_files_change : ( enabled : boolean ) => void
40+ on_find_relevant_files_instructions_prefix_change : (
41+ instructions : string
42+ ) => void
3843 on_checkpoint_lifespan_change : ( hours : number | undefined ) => void
3944 clear_checks_in_workspace_behavior : ClearChecksBehavior
4045 edit_format_instructions : EditFormatInstructions
@@ -59,6 +64,10 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
5964 const [ context_size_warning_threshold , set_context_size_warning_threshold ] =
6065 useState < number > ( )
6166 const [ checkpoint_lifespan , set_checkpoint_lifespan ] = useState < number > ( )
67+ const [
68+ find_relevant_files_instructions_prefix ,
69+ set_find_relevant_files_instructions_prefix
70+ ] = useState ( '' )
6271 const [ gemini_user_id_str , set_gemini_user_id_str ] = useState ( '' )
6372 const [ ai_studio_user_id_str , set_ai_studio_user_id_str ] = useState ( '' )
6473 const [ instructions , set_instructions ] = useState < EditFormatInstructions > ( {
@@ -82,6 +91,12 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
8291 set_checkpoint_lifespan ( props . checkpoint_lifespan )
8392 } , [ props . checkpoint_lifespan ] )
8493
94+ useEffect ( ( ) => {
95+ set_find_relevant_files_instructions_prefix (
96+ props . find_relevant_files_instructions_prefix || ''
97+ )
98+ } , [ props . find_relevant_files_instructions_prefix ] )
99+
85100 useEffect ( ( ) => {
86101 set_gemini_user_id_str (
87102 props . gemini_user_id === null || props . gemini_user_id === undefined
@@ -121,6 +136,17 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
121136 }
122137 }
123138
139+ const handle_find_relevant_files_instructions_prefix_blur = ( ) => {
140+ props . on_find_relevant_files_instructions_prefix_change (
141+ find_relevant_files_instructions_prefix
142+ )
143+ if ( find_relevant_files_instructions_prefix == '' ) {
144+ set_find_relevant_files_instructions_prefix (
145+ default_find_relevant_files_instructions_prefix
146+ )
147+ }
148+ }
149+
124150 const handle_checkpoint_lifespan_blur = ( ) => {
125151 if ( checkpoint_lifespan && checkpoint_lifespan > 0 ) {
126152 props . on_checkpoint_lifespan_change ( checkpoint_lifespan )
@@ -277,6 +303,19 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
277303 />
278304 }
279305 />
306+ < UiItem
307+ title = { t ( 'general.find-relevant-files-instructions-prefix.title' ) }
308+ description = { t (
309+ 'general.find-relevant-files-instructions-prefix.description'
310+ ) }
311+ slot_below = {
312+ < UiTextarea
313+ value = { find_relevant_files_instructions_prefix }
314+ on_change = { set_find_relevant_files_instructions_prefix }
315+ on_blur = { handle_find_relevant_files_instructions_prefix_blur }
316+ />
317+ }
318+ />
280319 </ UiGroup >
281320
282321 < UiGroup title = { t ( 'general.checkpoints.title' ) } >
0 commit comments