File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -409,7 +409,6 @@ export default class I18nPlugin extends AdminForthPlugin {
409409 icon : 'flowbite:language-outline' ,
410410 // if optional `confirm` is provided, user will be asked to confirm action
411411 confirm : 'Are you sure you want to translate selected items?' ,
412- state : 'selected' ,
413412 allowed : async ( { resource, adminUser, selectedIds, allowedActions } ) => {
414413 console . log ( 'allowedActions' , JSON . stringify ( allowedActions ) ) ;
415414 return allowedActions . edit ;
@@ -507,9 +506,11 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
507506 const resp = await this . options . completeAdapter . complete (
508507 prompt ,
509508 [ ] ,
510- 300 ,
509+ prompt . length * 2 ,
511510 ) ;
512511
512+ console . log ( `🪲🔪LLM resp >> ${ prompt . length } , <<${ resp . content . length } :\n\n` , JSON . stringify ( resp ) ) ;
513+
513514
514515 if ( resp . error ) {
515516 throw new AiTranslateError ( resp . error ) ;
@@ -803,7 +804,9 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
803804
804805 if ( params ) {
805806 for ( const [ key , value ] of Object . entries ( params ) ) {
806- result = result . replace ( `{${ key } }` , value ) ;
807+ if ( result ) {
808+ result = result . replace ( `{${ key } }` , value ) ;
809+ }
807810 }
808811 }
809812 return result ;
You can’t perform that action at this time.
0 commit comments