feat: improve agent snapshot history

This commit is contained in:
Tyke Chen
2026-07-10 11:44:35 +08:00
parent 8ec5851027
commit a5aee109fe
23 changed files with 2833 additions and 130 deletions
+20 -2
View File
@@ -1,19 +1,37 @@
import { defineStore } from 'pinia'
const SPEED_PITCH_FIELDS = ['ttsVolume', 'ttsRate', 'ttsPitch'] as const
type SpeedPitchField = typeof SPEED_PITCH_FIELDS[number]
type SpeedPitchSettings = Record<SpeedPitchField, number>
export const useSpeedPitch = defineStore('speedPitch', () => {
const speedPitch = ref({
const speedPitch = ref<SpeedPitchSettings>({
ttsVolume: 0,
ttsRate: 0,
ttsPitch: 0,
})
const changedFields = ref<SpeedPitchField[]>([])
const updateSpeedPitch = (val: typeof speedPitch.value) => {
const updateSpeedPitch = (val: SpeedPitchSettings, options: { changedFields?: SpeedPitchField[] } = {}) => {
speedPitch.value = val
if (options.changedFields) {
changedFields.value = Array.from(new Set([
...changedFields.value,
...options.changedFields,
]))
}
}
const resetChangedFields = () => {
changedFields.value = []
}
return {
speedPitch,
changedFields,
updateSpeedPitch,
resetChangedFields,
}
}, {
persist: {