mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 09:03:54 +08:00
feat: improve agent snapshot history
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user