Skip to content

Commit e1b3ce5

Browse files
authored
revert 6b9b778 (#26893)
1 parent 8e58df7 commit e1b3ce5

2 files changed

Lines changed: 1 addition & 76 deletions

File tree

packages/core/src/core/geminiChat.test.ts

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -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[] = [

packages/core/src/core/geminiChat.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,7 @@ function isValidContent(content: Content): boolean {
146146
if (part === undefined || Object.keys(part).length === 0) {
147147
return false;
148148
}
149-
if (
150-
!part.thought &&
151-
!part.functionCall &&
152-
!part.functionResponse &&
153-
!part.inlineData &&
154-
!part.fileData &&
155-
part.text !== undefined &&
156-
part.text === ''
157-
) {
149+
if (!part.thought && part.text !== undefined && part.text === '') {
158150
return false;
159151
}
160152
}

0 commit comments

Comments
 (0)