diff --git a/client/src/services/defaults.ts b/client/src/services/defaults.ts
index 1d0afa5..9adfaaf 100644
--- a/client/src/services/defaults.ts
+++ b/client/src/services/defaults.ts
@@ -69,6 +69,7 @@ export const DEFAULTS: Record = {
// ── 应用设置 ──
autoCheckUpdate: true, // 自动检查更新。可选: true | false
+ historyEnabled: true, // 保存历史记录(文本+录音)。关闭后不再保存新记录,适合共享电脑。可选: true | false
audioRetentionEnabled: true, // 保留录音文件。可选: true | false
audioRetentionDays: -1, // 录音保留天数。可选: 7 | 30 | 90 | -1(永久)
logRetentionDays: 30, // 日志保留天数。可选: 7 | 15 | 30 | 90
diff --git a/client/src/services/recorder/RecorderOrchestrator.ts b/client/src/services/recorder/RecorderOrchestrator.ts
index 5b557be..617ff6e 100644
--- a/client/src/services/recorder/RecorderOrchestrator.ts
+++ b/client/src/services/recorder/RecorderOrchestrator.ts
@@ -603,6 +603,7 @@ export class RecorderOrchestrator {
const wallSec = this.wallTimeAtStopSec > 0 ? this.wallTimeAtStopSec : audioDur
// Save audio even for empty results
const saveAndRecord = async () => {
+ if (!(await getSetting('historyEnabled', true))) return
let audioFilePath: string | undefined
const recordId = Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
const saveAudioEnabled = await getSetting('audioRetentionEnabled', true)
@@ -703,6 +704,7 @@ export class RecorderOrchestrator {
const wallSec = this.wallTimeAtStopSec > 0 ? this.wallTimeAtStopSec : audioDur
if (audioDur >= 0.5 && this.recordedChunks.length > 0) {
const saveErrorHistory = async () => {
+ if (!(await getSetting('historyEnabled', true))) return
let audioFilePath: string | undefined
const recordId = Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
const saveAudioEnabled = await getSetting('audioRetentionEnabled', true)
@@ -1353,6 +1355,7 @@ export class RecorderOrchestrator {
this.timedOutProcessingContext = null
void (async () => {
try {
+ if (!(await getSetting('historyEnabled', true))) return
let audioFilePath: string | undefined
const recordId = Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
const saveAudioEnabled = await getSetting('audioRetentionEnabled', true)
@@ -1614,38 +1617,41 @@ export class RecorderOrchestrator {
})
try {
- // Save audio file if we have recorded chunks
- let audioFilePath: string | undefined
- const recordId = Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
- const saveAudioEnabled = await getSetting('audioRetentionEnabled', true)
- if (saveAudioEnabled && this.recordedChunks.length > 0) {
- try {
- const savedPath = await saveRecordingAudio(recordId, this.recordedChunks)
- if (savedPath) audioFilePath = savedPath
- } catch (err) {
- addRuntimeEvent('warn', 'recorder', '保存音频文件失败', { error: String(err) })
+ // 关闭历史记录时不保存任何记录与音频(共享电脑隐私),但仍完成文本插入
+ if (await getSetting('historyEnabled', true)) {
+ // Save audio file if we have recorded chunks
+ let audioFilePath: string | undefined
+ const recordId = Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
+ const saveAudioEnabled = await getSetting('audioRetentionEnabled', true)
+ if (saveAudioEnabled && this.recordedChunks.length > 0) {
+ try {
+ const savedPath = await saveRecordingAudio(recordId, this.recordedChunks)
+ if (savedPath) audioFilePath = savedPath
+ } catch (err) {
+ addRuntimeEvent('warn', 'recorder', '保存音频文件失败', { error: String(err) })
+ }
}
+
+ const providerMeta = await this.buildProviderMetadata(result)
+
+ await addHistory({
+ id: recordId,
+ timestamp: Date.now(),
+ asrText: result.asrText,
+ llmText: textToPaste,
+ asrMs: result.asrMs,
+ llmMs: result.llmMs,
+ durationSec: wallSec,
+ audioDurationSec: audioDur > 0 ? audioDur : undefined,
+ asrDurationSec: result.durationSec > 0 ? result.durationSec : undefined,
+ charCount: hasText ? textToPaste.length : 0,
+ isEmpty: !hasText,
+ audioFilePath,
+ ...this.buildHistoryMetadata(promptResolution),
+ ...providerMeta,
+ })
+ void bridge.emit('history-updated')
}
-
- const providerMeta = await this.buildProviderMetadata(result)
-
- await addHistory({
- id: recordId,
- timestamp: Date.now(),
- asrText: result.asrText,
- llmText: textToPaste,
- asrMs: result.asrMs,
- llmMs: result.llmMs,
- durationSec: wallSec,
- audioDurationSec: audioDur > 0 ? audioDur : undefined,
- asrDurationSec: result.durationSec > 0 ? result.durationSec : undefined,
- charCount: hasText ? textToPaste.length : 0,
- isEmpty: !hasText,
- audioFilePath,
- ...this.buildHistoryMetadata(promptResolution),
- ...providerMeta,
- })
- void bridge.emit('history-updated')
} catch (error) {
addRuntimeEvent('warn', 'recorder', '写入历史记录失败', { error: String(error) })
}