mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
Refactor: Centralize GeminiClient in Config (#693)
Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
parent
1dcf0a4cbd
commit
e428707e07
4 changed files with 79 additions and 50 deletions
|
|
@ -21,6 +21,7 @@ import { WebFetchTool } from '../tools/web-fetch.js';
|
|||
import { ReadManyFilesTool } from '../tools/read-many-files.js';
|
||||
import { MemoryTool, setGeminiMdFilename } from '../tools/memoryTool.js';
|
||||
import { WebSearchTool } from '../tools/web-search.js';
|
||||
import { GeminiClient } from '../core/client.js';
|
||||
import { GEMINI_CONFIG_DIR as GEMINI_DIR } from '../tools/memoryTool.js';
|
||||
|
||||
export enum ApprovalMode {
|
||||
|
|
@ -86,6 +87,7 @@ export class Config {
|
|||
private approvalMode: ApprovalMode;
|
||||
private readonly vertexai: boolean | undefined;
|
||||
private readonly showMemoryUsage: boolean;
|
||||
private readonly geminiClient: GeminiClient;
|
||||
|
||||
constructor(params: ConfigParameters) {
|
||||
this.apiKey = params.apiKey;
|
||||
|
|
@ -112,6 +114,7 @@ export class Config {
|
|||
}
|
||||
|
||||
this.toolRegistry = createToolRegistry(this);
|
||||
this.geminiClient = new GeminiClient(this);
|
||||
}
|
||||
|
||||
getApiKey(): string {
|
||||
|
|
@ -200,6 +203,10 @@ export class Config {
|
|||
getShowMemoryUsage(): boolean {
|
||||
return this.showMemoryUsage;
|
||||
}
|
||||
|
||||
getGeminiClient(): GeminiClient {
|
||||
return this.geminiClient;
|
||||
}
|
||||
}
|
||||
|
||||
function findEnvFile(startDir: string): string | null {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue