mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-19 17:50:37 -07:00
fix: shorten tool call IDs and fix duplicate tool name in truncated output filenames (#18600)
This commit is contained in:
@@ -168,7 +168,7 @@ describe('Turn', () => {
|
||||
}),
|
||||
);
|
||||
expect(event2.value.callId).toEqual(
|
||||
expect.stringMatching(/^tool2-\d{13}-\w{10,}$/),
|
||||
expect.stringMatching(/^tool2_\d{13}_\d+$/),
|
||||
);
|
||||
expect(turn.pendingToolCalls[1]).toEqual(event2.value);
|
||||
expect(turn.getDebugResponses().length).toBe(1);
|
||||
|
||||
@@ -233,6 +233,8 @@ export type ServerGeminiStreamEvent =
|
||||
|
||||
// A turn manages the agentic loop turn within the server context.
|
||||
export class Turn {
|
||||
private callCounter = 0;
|
||||
|
||||
readonly pendingToolCalls: ToolCallRequestInfo[] = [];
|
||||
private debugResponses: GenerateContentResponse[] = [];
|
||||
private pendingCitations = new Set<string>();
|
||||
@@ -398,11 +400,9 @@ export class Turn {
|
||||
fnCall: FunctionCall,
|
||||
traceId?: string,
|
||||
): ServerGeminiStreamEvent | null {
|
||||
const callId =
|
||||
fnCall.id ??
|
||||
`${fnCall.name}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
||||
const name = fnCall.name || 'undefined_tool_name';
|
||||
const args = fnCall.args || {};
|
||||
const callId = fnCall.id ?? `${name}_${Date.now()}_${this.callCounter++}`;
|
||||
|
||||
const toolCallRequest: ToolCallRequestInfo = {
|
||||
callId,
|
||||
|
||||
Reference in New Issue
Block a user