feat: Add deterministic cache control (#411)

* feat: add deterministic cache control
This commit is contained in:
tanzhenxin
2025-08-21 18:33:13 +08:00
committed by GitHub
parent cd5e592b6a
commit 742337c390
13 changed files with 757 additions and 527 deletions

View File

@@ -204,7 +204,6 @@ export interface ConfigParameters {
folderTrust?: boolean;
ideMode?: boolean;
enableOpenAILogging?: boolean;
sampling_params?: Record<string, unknown>;
systemPromptMappings?: Array<{
baseUrls: string[];
modelNames: string[];
@@ -213,6 +212,9 @@ export interface ConfigParameters {
contentGenerator?: {
timeout?: number;
maxRetries?: number;
samplingParams?: {
[key: string]: unknown;
};
};
cliVersion?: string;
loadMemoryFromIncludeDirectories?: boolean;
@@ -289,10 +291,10 @@ export class Config {
| undefined;
private readonly experimentalAcp: boolean = false;
private readonly enableOpenAILogging: boolean;
private readonly sampling_params?: Record<string, unknown>;
private readonly contentGenerator?: {
timeout?: number;
maxRetries?: number;
samplingParams?: Record<string, unknown>;
};
private readonly cliVersion?: string;
private readonly loadMemoryFromIncludeDirectories: boolean = false;
@@ -367,7 +369,6 @@ export class Config {
this.ideClient = IdeClient.getInstance();
this.systemPromptMappings = params.systemPromptMappings;
this.enableOpenAILogging = params.enableOpenAILogging ?? false;
this.sampling_params = params.sampling_params;
this.contentGenerator = params.contentGenerator;
this.cliVersion = params.cliVersion;
@@ -757,10 +758,6 @@ export class Config {
return this.enableOpenAILogging;
}
getSamplingParams(): Record<string, unknown> | undefined {
return this.sampling_params;
}
getContentGeneratorTimeout(): number | undefined {
return this.contentGenerator?.timeout;
}
@@ -769,6 +766,12 @@ export class Config {
return this.contentGenerator?.maxRetries;
}
getContentGeneratorSamplingParams(): ContentGeneratorConfig['samplingParams'] {
return this.contentGenerator?.samplingParams as
| ContentGeneratorConfig['samplingParams']
| undefined;
}
getCliVersion(): string | undefined {
return this.cliVersion;
}