@@ -8,21 +8,22 @@ function isNudgeItem(item: any, nudgeText: string): boolean {
88 return false
99}
1010
11- function injectSynth ( input : any [ ] , instruction : string , nudgeText : string ) : boolean {
11+ function injectSynth ( input : any [ ] , instruction : string , nudgeText : string , systemReminder : string ) : boolean {
12+ const fullInstruction = systemReminder + '\n\n' + instruction
1213 for ( let i = input . length - 1 ; i >= 0 ; i -- ) {
1314 const item = input [ i ]
1415 if ( item . type === 'message' && item . role === 'user' ) {
1516 if ( isNudgeItem ( item , nudgeText ) ) continue
1617
1718 if ( typeof item . content === 'string' ) {
1819 if ( item . content . includes ( instruction ) ) return false
19- item . content = item . content + '\n\n' + instruction
20+ item . content = item . content + '\n\n' + fullInstruction
2021 } else if ( Array . isArray ( item . content ) ) {
2122 const alreadyInjected = item . content . some (
2223 ( part : any ) => part ?. type === 'input_text' && typeof part . text === 'string' && part . text . includes ( instruction )
2324 )
2425 if ( alreadyInjected ) return false
25- item . content . push ( { type : 'input_text' , text : instruction } )
26+ item . content . push ( { type : 'input_text' , text : fullInstruction } )
2627 }
2728 return true
2829 }
@@ -47,8 +48,8 @@ export const openaiResponsesFormat: FormatDescriptor = {
4748 return body . input
4849 } ,
4950
50- injectSynth ( data : any [ ] , instruction : string , nudgeText : string ) : boolean {
51- return injectSynth ( data , instruction , nudgeText )
51+ injectSynth ( data : any [ ] , instruction : string , nudgeText : string , systemReminder : string ) : boolean {
52+ return injectSynth ( data , instruction , nudgeText , systemReminder )
5253 } ,
5354
5455 injectPrunableList ( data : any [ ] , injection : string ) : boolean {
0 commit comments