mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-24 18:27:01 -07:00
fix(context): Fix model config name.
This commit is contained in:
@@ -139,7 +139,11 @@ export class ContextManager {
|
||||
this.hasPerformedHotStart = true;
|
||||
if (this.buffer.nodes.length > 0) {
|
||||
const nodesForHotStart = [...this.buffer.nodes, ...previewNodes];
|
||||
await this.performHotStartCalibration(nodesForHotStart, abortSignal);
|
||||
await this.performHotStartCalibration(
|
||||
nodesForHotStart,
|
||||
this.env.model,
|
||||
abortSignal,
|
||||
);
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -468,6 +472,7 @@ export class ContextManager {
|
||||
|
||||
private async performHotStartCalibration(
|
||||
nodes: readonly ConcreteNode[],
|
||||
model: string,
|
||||
abortSignal?: AbortSignal,
|
||||
) {
|
||||
const history = this.env.graphMapper.fromGraph(nodes);
|
||||
@@ -475,7 +480,7 @@ export class ContextManager {
|
||||
|
||||
try {
|
||||
const { totalTokens } = await this.env.llmClient.countTokens({
|
||||
modelConfigKey: { model: 'context-calibrator' },
|
||||
modelConfigKey: { model },
|
||||
contents,
|
||||
abortSignal,
|
||||
});
|
||||
|
||||
@@ -116,6 +116,7 @@ export async function initializeContextManager(
|
||||
|
||||
const env = new ContextEnvironmentImpl(
|
||||
() => config.getBaseLlmClient(),
|
||||
() => config.getActiveModel(),
|
||||
config.getSessionId(),
|
||||
lastPromptId,
|
||||
logDir,
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface RenderOptions {
|
||||
|
||||
export interface ContextEnvironment {
|
||||
readonly llmClient: BaseLlmClient;
|
||||
readonly model: string;
|
||||
readonly promptId: string;
|
||||
readonly sessionId: string;
|
||||
readonly traceDir: string;
|
||||
|
||||
@@ -21,6 +21,7 @@ describe('ContextEnvironmentImpl', () => {
|
||||
|
||||
const env = new ContextEnvironmentImpl(
|
||||
() => mockLlmClient,
|
||||
() => 'mock-model',
|
||||
'mock-session',
|
||||
'mock-prompt',
|
||||
'/tmp/trace',
|
||||
|
||||
@@ -19,6 +19,7 @@ export class ContextEnvironmentImpl implements ContextEnvironment {
|
||||
|
||||
constructor(
|
||||
private readonly llmClientProvider: () => BaseLlmClient,
|
||||
private readonly activeModel: () => string,
|
||||
readonly sessionId: string,
|
||||
readonly promptId: string,
|
||||
readonly traceDir: string,
|
||||
@@ -37,4 +38,8 @@ export class ContextEnvironmentImpl implements ContextEnvironment {
|
||||
get llmClient(): BaseLlmClient {
|
||||
return this.llmClientProvider();
|
||||
}
|
||||
|
||||
get model(): string {
|
||||
return this.activeModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ export class SimulationHarness {
|
||||
|
||||
this.env = new ContextEnvironmentImpl(
|
||||
() => mockLlmClient,
|
||||
() => 'mock-model',
|
||||
'sim-prompt',
|
||||
'sim-session',
|
||||
mockTempDir,
|
||||
|
||||
@@ -181,7 +181,8 @@ export function createMockEnvironment(
|
||||
|
||||
let env = new ContextEnvironmentImpl(
|
||||
() => llmClient as BaseLlmClient,
|
||||
'mock-session',
|
||||
() => 'mock-session',
|
||||
'mock-model',
|
||||
'mock-prompt-id',
|
||||
'/tmp/.gemini/trace',
|
||||
'/tmp/.gemini/tool-outputs',
|
||||
@@ -196,6 +197,7 @@ export function createMockEnvironment(
|
||||
if (overrides.llmClient) {
|
||||
env = new ContextEnvironmentImpl(
|
||||
() => overrides.llmClient!,
|
||||
() => overrides.model!,
|
||||
env.sessionId,
|
||||
env.promptId,
|
||||
env.traceDir,
|
||||
@@ -276,6 +278,7 @@ export function createMockContextConfig(
|
||||
getTargetDir: vi.fn().mockReturnValue('/tmp'),
|
||||
getSessionId: vi.fn().mockReturnValue('test-session'),
|
||||
getExperimentalContextManagementConfig: vi.fn().mockReturnValue(undefined),
|
||||
getActiveModel: vi.fn().mockReturnValue('mock-model'),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
@@ -303,6 +306,7 @@ export function setupContextComponentTest(
|
||||
|
||||
const env = new ContextEnvironmentImpl(
|
||||
() => config.getBaseLlmClient(),
|
||||
() => config.getActiveModel(),
|
||||
'test prompt-id',
|
||||
'test-session',
|
||||
'/tmp',
|
||||
|
||||
Reference in New Issue
Block a user