fix(core): Prepend user message to loop detection history if it starts with a function call (#11860)

This commit is contained in:
Sandy Tao
2025-10-24 21:22:26 -07:00
committed by GitHub
parent 73570f1c86
commit a2d7f82b49
2 changed files with 37 additions and 0 deletions

View File

@@ -404,6 +404,12 @@ export class LoopDetectionService {
...trimmedHistory,
{ role: 'user', parts: [{ text: taskPrompt }] },
];
if (contents.length > 0 && isFunctionCall(contents[0])) {
contents.unshift({
role: 'user',
parts: [{ text: 'Recent conversation history:' }],
});
}
const schema: Record<string, unknown> = {
type: 'object',
properties: {