Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions electron/services/chatService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5959,19 +5959,27 @@ class ChatService {
if (cachePath) {
return join(cachePath, 'Voices')
}
// 回退到默认目录
const documentsPath = app.getPath('documents')
return join(documentsPath, 'WeFlow', 'Voices')
return join(this.getDefaultDocumentsBaseDir(), 'Voices')
}

private getEmojiCacheDir(): string {
const cachePath = this.configService.get('cachePath')
if (cachePath) {
return join(cachePath, 'Emojis')
}
// 回退到默认目录
const documentsPath = app.getPath('documents')
return join(documentsPath, 'WeFlow', 'Emojis')
return join(this.getDefaultDocumentsBaseDir(), 'Emojis')
}

private getDefaultDocumentsBaseDir(): string {
const workerUserDataPath = String(process.env.WEFLOW_USER_DATA_PATH || process.env.WEFLOW_CONFIG_CWD || '').trim()
if (workerUserDataPath) {
return join(workerUserDataPath, 'documents-fallback', 'WeFlow')
}
const documentsPath = app?.getPath?.('documents')
if (documentsPath) {
return join(documentsPath, 'WeFlow')
}
return join(this.configService.getCacheBasePath(), '..')
}

clearCaches(options?: { includeMessages?: boolean; includeContacts?: boolean; includeEmojis?: boolean }): { success: boolean; error?: string } {
Expand Down Expand Up @@ -7373,7 +7381,7 @@ class ChatService {
/** 获取持久化转写缓存文件路径 */
private getTranscriptCachePath(): string {
const cachePath = this.configService.get('cachePath')
const base = cachePath || join(app.getPath('documents'), 'WeFlow')
const base = cachePath || this.getDefaultDocumentsBaseDir()
return join(base, 'Voices', 'transcripts.json')
}

Expand Down
Loading
Loading