@@ -20,6 +20,11 @@ import {
2020} from '@/views/settings/types/messages'
2121import { GeneralSection } from './sections/GeneralSection'
2222import { use_translation , TranslationKey } from '@/views/i18n/use-translation'
23+ import {
24+ commit_message_instructions as default_commit_message_instructions ,
25+ voice_input_instructions as default_voice_input_instructions
26+ } from '@/constants/instructions'
27+ import { default_system_instructions } from '@shared/constants/default-system-instructions'
2328
2429type NavItem =
2530 | 'general'
@@ -84,6 +89,7 @@ type Props = {
8489 edit_context_system_instructions : string
8590 intelligent_update_configs : ConfigurationForClient [ ]
8691 prune_context_configs : ConfigurationForClient [ ]
92+ voice_input_instructions : string
8793 commit_message_instructions : string
8894 commit_message_auto_accept_after : number | null
8995 context_size_warning_threshold : number
@@ -113,6 +119,7 @@ type Props = {
113119 instructions : EditFormatInstructions
114120 ) => void
115121 on_edit_context_system_instructions_change : ( instructions : string ) => void
122+ on_voice_input_instructions_change : ( instructions : string ) => void
116123 on_automatic_checkpoints_toggle : ( disabled : boolean ) => void
117124 on_checkpoint_lifespan_change : ( hours : number | undefined ) => void
118125 on_gemini_user_id_change : ( id : number | null ) => void
@@ -166,6 +173,7 @@ export const Home: React.FC<Props> = (props) => {
166173 'commit-messages' : null
167174 } )
168175 const [ commit_instructions , set_commit_instructions ] = useState ( '' )
176+ const [ voice_input_instructions , set_voice_input_instructions ] = useState ( '' )
169177 const [
170178 commit_message_auto_accept_after_str ,
171179 set_commit_message_auto_accept_after_str
@@ -254,6 +262,10 @@ export const Home: React.FC<Props> = (props) => {
254262 set_commit_instructions ( props . commit_message_instructions || '' )
255263 } , [ props . commit_message_instructions ] )
256264
265+ useEffect ( ( ) => {
266+ set_voice_input_instructions ( props . voice_input_instructions || '' )
267+ } , [ props . voice_input_instructions ] )
268+
257269 useEffect ( ( ) => {
258270 set_commit_message_auto_accept_after_str (
259271 props . commit_message_auto_accept_after === null ||
@@ -465,11 +477,18 @@ export const Home: React.FC<Props> = (props) => {
465477 < Textarea
466478 value = { edit_context_instructions }
467479 on_change = { set_edit_context_instructions }
468- on_blur = { ( ) =>
480+ on_blur = { ( ) => {
469481 props . on_edit_context_system_instructions_change (
470482 edit_context_instructions
471483 )
472- }
484+ if (
485+ edit_context_instructions == '' &&
486+ props . edit_context_system_instructions ==
487+ default_system_instructions
488+ ) {
489+ set_edit_context_instructions ( default_system_instructions )
490+ }
491+ } }
473492 />
474493 }
475494 />
@@ -593,7 +612,9 @@ export const Home: React.FC<Props> = (props) => {
593612 </ Button >
594613 }
595614 >
596- < Notice type = "info" > A request includes the selected files.</ Notice >
615+ < Notice type = "info" >
616+ A request includes the editor with cursor and the selected files.
617+ </ Notice >
597618 { props . code_at_cursor_configs . length == 0 && (
598619 < Notice type = "warning" >
599620 Add a configuration to use this feature.
@@ -690,6 +711,30 @@ export const Home: React.FC<Props> = (props) => {
690711 props . on_unset_default_config ( 'VOICE_INPUT' )
691712 }
692713 />
714+ < Item
715+ title = "Instructions"
716+ description = "Instructions for the model to process voice input."
717+ slot_below = {
718+ < Textarea
719+ value = { voice_input_instructions }
720+ on_change = { set_voice_input_instructions }
721+ on_blur = { ( ) => {
722+ props . on_voice_input_instructions_change (
723+ voice_input_instructions
724+ )
725+ if (
726+ voice_input_instructions == '' &&
727+ props . voice_input_instructions ==
728+ default_voice_input_instructions
729+ ) {
730+ set_voice_input_instructions (
731+ default_voice_input_instructions
732+ )
733+ }
734+ } }
735+ />
736+ }
737+ />
693738 </ Group >
694739 </ Section >
695740
@@ -745,9 +790,18 @@ export const Home: React.FC<Props> = (props) => {
745790 < Textarea
746791 value = { commit_instructions }
747792 on_change = { set_commit_instructions }
748- on_blur = { ( ) =>
793+ on_blur = { ( ) => {
749794 props . on_commit_instructions_change ( commit_instructions )
750- }
795+ if (
796+ commit_instructions == '' &&
797+ props . commit_message_instructions ==
798+ default_commit_message_instructions
799+ ) {
800+ set_commit_instructions (
801+ default_commit_message_instructions
802+ )
803+ }
804+ } }
751805 />
752806 }
753807 />
0 commit comments