@@ -2904,73 +2904,6 @@ describe('GeminiChat', () => {
29042904 } ) ;
29052905 } ) ;
29062906
2907- describe ( 'getHistory with curated: true' , ( ) => {
2908- it ( 'should not drop model turns with function calls and empty text' , ( ) => {
2909- const history : Content [ ] = [
2910- { role : 'user' , parts : [ { text : 'Hello' } ] } ,
2911- {
2912- role : 'model' ,
2913- parts : [ { functionCall : { name : 'test_tool' , args : { } } , text : '' } ] ,
2914- } ,
2915- {
2916- role : 'user' ,
2917- parts : [ { functionResponse : { name : 'test_tool' , response : { } } } ] ,
2918- } ,
2919- ] ;
2920- const chatWithHistory = new GeminiChat ( mockConfig , '' , [ ] , history ) ;
2921-
2922- const curatedHistory = chatWithHistory . getHistory ( true ) ;
2923-
2924- expect ( curatedHistory . length ) . toBe ( 3 ) ;
2925- expect ( curatedHistory [ 1 ] . role ) . toBe ( 'model' ) ;
2926- expect ( curatedHistory [ 1 ] . parts ! [ 0 ] . functionCall ) . toBeDefined ( ) ;
2927- } ) ;
2928-
2929- it ( 'should not drop model turns with inlineData and empty text' , ( ) => {
2930- const history : Content [ ] = [
2931- { role : 'user' , parts : [ { text : 'Hello' } ] } ,
2932- {
2933- role : 'model' ,
2934- parts : [
2935- {
2936- inlineData : { mimeType : 'image/jpeg' , data : 'base64...' } ,
2937- text : '' ,
2938- } ,
2939- ] ,
2940- } ,
2941- ] ;
2942- const chatWithHistory = new GeminiChat ( mockConfig , '' , [ ] , history ) ;
2943-
2944- const curatedHistory = chatWithHistory . getHistory ( true ) ;
2945-
2946- expect ( curatedHistory . length ) . toBe ( 2 ) ;
2947- expect ( curatedHistory [ 1 ] . role ) . toBe ( 'model' ) ;
2948- expect ( curatedHistory [ 1 ] . parts ! [ 0 ] . inlineData ) . toBeDefined ( ) ;
2949- } ) ;
2950-
2951- it ( 'should not drop model turns with fileData and empty text' , ( ) => {
2952- const history : Content [ ] = [
2953- { role : 'user' , parts : [ { text : 'Hello' } ] } ,
2954- {
2955- role : 'model' ,
2956- parts : [
2957- {
2958- fileData : { mimeType : 'image/jpeg' , fileUri : 'https://...' } ,
2959- text : '' ,
2960- } ,
2961- ] ,
2962- } ,
2963- ] ;
2964- const chatWithHistory = new GeminiChat ( mockConfig , '' , [ ] , history ) ;
2965-
2966- const curatedHistory = chatWithHistory . getHistory ( true ) ;
2967-
2968- expect ( curatedHistory . length ) . toBe ( 2 ) ;
2969- expect ( curatedHistory [ 1 ] . role ) . toBe ( 'model' ) ;
2970- expect ( curatedHistory [ 1 ] . parts ! [ 0 ] . fileData ) . toBeDefined ( ) ;
2971- } ) ;
2972- } ) ;
2973-
29742907 describe ( 'stripToolCallIdPrefixes' , ( ) => {
29752908 it ( 'should strip tool name prefix matching the tool name' , ( ) => {
29762909 const contents : Content [ ] = [
0 commit comments