mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Introduce a config module to manage configuration (#22)
* Introduce a config module to manage configuration * Remove public modifier
This commit is contained in:
@@ -3,6 +3,7 @@ import { SchemaUnion, Type } from '@google/genai'; // Assuming these types exist
|
||||
import { GeminiClient } from '../core/gemini-client.js'; // Assuming this path
|
||||
import { exec } from 'child_process'; // Needed for Windows process check
|
||||
import { promisify } from 'util'; // To promisify exec
|
||||
import { globalConfig } from '../config/config.js';
|
||||
|
||||
// Promisify child_process.exec for easier async/await usage
|
||||
const execAsync = promisify(exec);
|
||||
@@ -60,7 +61,7 @@ export class BackgroundTerminalAnalyzer {
|
||||
initialDelayMs?: number;
|
||||
} = {}, // Provide default options
|
||||
) {
|
||||
this.ai = aiClient || new GeminiClient(); // Call constructor without model
|
||||
this.ai = aiClient || new GeminiClient(globalConfig); // Call constructor without model
|
||||
this.pollIntervalMs = options.pollIntervalMs ?? 5000; // Default 5 seconds
|
||||
this.maxAttempts = options.maxAttempts ?? 6; // Default 6 attempts (approx 30s total)
|
||||
this.initialDelayMs = options.initialDelayMs ?? 500; // Default 0.5s initial delay
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
import process from 'node:process';
|
||||
import path from 'node:path'; // Import the 'path' module
|
||||
|
||||
/**
|
||||
* Returns the target directory, using the provided argument or the current working directory.
|
||||
*/
|
||||
export function getTargetDirectory(targetDirArg: string | undefined): string {
|
||||
return targetDirArg || process.cwd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortens a path string if it exceeds maxLen, prioritizing the start and end segments.
|
||||
* Example: /path/to/a/very/long/file.txt -> /path/.../long/file.txt
|
||||
|
||||
Reference in New Issue
Block a user