mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
Session-Level Conversation History Management (#1113)
This commit is contained in:
@@ -14,6 +14,7 @@ export const GOOGLE_ACCOUNTS_FILENAME = 'google_accounts.json';
|
||||
export const OAUTH_FILE = 'oauth_creds.json';
|
||||
const TMP_DIR_NAME = 'tmp';
|
||||
const BIN_DIR_NAME = 'bin';
|
||||
const PROJECT_DIR_NAME = 'projects';
|
||||
|
||||
export class Storage {
|
||||
private readonly targetDir: string;
|
||||
@@ -66,6 +67,12 @@ export class Storage {
|
||||
return path.join(this.targetDir, QWEN_DIR);
|
||||
}
|
||||
|
||||
getProjectDir(): string {
|
||||
const projectId = this.sanitizeCwd(this.getProjectRoot());
|
||||
const projectsDir = path.join(Storage.getGlobalQwenDir(), PROJECT_DIR_NAME);
|
||||
return path.join(projectsDir, projectId);
|
||||
}
|
||||
|
||||
getProjectTempDir(): string {
|
||||
const hash = this.getFilePathHash(this.getProjectRoot());
|
||||
const tempDir = Storage.getGlobalTempDir();
|
||||
@@ -117,4 +124,8 @@ export class Storage {
|
||||
getHistoryFilePath(): string {
|
||||
return path.join(this.getProjectTempDir(), 'shell_history');
|
||||
}
|
||||
|
||||
private sanitizeCwd(cwd: string): string {
|
||||
return cwd.replace(/[^a-zA-Z0-9]/g, '-');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user