mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 19:14:33 -07:00
Show model in history (#13034)
This commit is contained in:
committed by
GitHub
parent
0fcbff506e
commit
ab11b2c27f
@@ -254,6 +254,7 @@ describe('Gemini Client (client.ts)', () => {
|
||||
getSkipNextSpeakerCheck: vi.fn().mockReturnValue(false),
|
||||
getUseSmartEdit: vi.fn().mockReturnValue(false),
|
||||
getUseModelRouter: vi.fn().mockReturnValue(false),
|
||||
getShowModelInfoInChat: vi.fn().mockReturnValue(false),
|
||||
getContinueOnFailedApiCall: vi.fn(),
|
||||
getProjectRoot: vi.fn().mockReturnValue('/test/project/root'),
|
||||
storage: {
|
||||
@@ -1488,6 +1489,7 @@ ${JSON.stringify(
|
||||
|
||||
// Assert
|
||||
expect(events).toEqual([
|
||||
{ type: GeminiEventType.ModelInfo, value: 'default-routed-model' },
|
||||
{ type: GeminiEventType.InvalidStream },
|
||||
{ type: GeminiEventType.Content, value: 'Continued content' },
|
||||
]);
|
||||
@@ -1539,7 +1541,10 @@ ${JSON.stringify(
|
||||
const events = await fromAsync(stream);
|
||||
|
||||
// Assert
|
||||
expect(events).toEqual([{ type: GeminiEventType.InvalidStream }]);
|
||||
expect(events).toEqual([
|
||||
{ type: GeminiEventType.ModelInfo, value: 'default-routed-model' },
|
||||
{ type: GeminiEventType.InvalidStream },
|
||||
]);
|
||||
|
||||
// Verify that turn.run was called only once
|
||||
expect(mockTurnRunFn).toHaveBeenCalledTimes(1);
|
||||
@@ -1573,10 +1578,12 @@ ${JSON.stringify(
|
||||
const events = await fromAsync(stream);
|
||||
|
||||
// Assert
|
||||
// We expect 2 InvalidStream events (original + 1 retry)
|
||||
expect(events.length).toBe(2);
|
||||
// We expect 3 events (model_info + original + 1 retry)
|
||||
expect(events.length).toBe(3);
|
||||
expect(
|
||||
events.every((e) => e.type === GeminiEventType.InvalidStream),
|
||||
events
|
||||
.filter((e) => e.type !== GeminiEventType.ModelInfo)
|
||||
.every((e) => e.type === GeminiEventType.InvalidStream),
|
||||
).toBe(true);
|
||||
|
||||
// Verify that turn.run was called twice
|
||||
|
||||
@@ -521,6 +521,7 @@ export class GeminiClient {
|
||||
modelToUse = decision.model;
|
||||
// Lock the model for the rest of the sequence
|
||||
this.currentSequenceModel = modelToUse;
|
||||
yield { type: GeminiEventType.ModelInfo, value: modelToUse };
|
||||
}
|
||||
|
||||
const resultStream = turn.run(modelToUse, request, linkedSignal);
|
||||
|
||||
@@ -62,6 +62,7 @@ export enum GeminiEventType {
|
||||
Retry = 'retry',
|
||||
ContextWindowWillOverflow = 'context_window_will_overflow',
|
||||
InvalidStream = 'invalid_stream',
|
||||
ModelInfo = 'model_info',
|
||||
}
|
||||
|
||||
export type ServerGeminiRetryEvent = {
|
||||
@@ -80,6 +81,11 @@ export type ServerGeminiInvalidStreamEvent = {
|
||||
type: GeminiEventType.InvalidStream;
|
||||
};
|
||||
|
||||
export type ServerGeminiModelInfoEvent = {
|
||||
type: GeminiEventType.ModelInfo;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export interface StructuredError {
|
||||
message: string;
|
||||
status?: number;
|
||||
@@ -212,7 +218,8 @@ export type ServerGeminiStreamEvent =
|
||||
| ServerGeminiUserCancelledEvent
|
||||
| ServerGeminiRetryEvent
|
||||
| ServerGeminiContextWindowWillOverflowEvent
|
||||
| ServerGeminiInvalidStreamEvent;
|
||||
| ServerGeminiInvalidStreamEvent
|
||||
| ServerGeminiModelInfoEvent;
|
||||
|
||||
// A turn manages the agentic loop turn within the server context.
|
||||
export class Turn {
|
||||
|
||||
Reference in New Issue
Block a user