dsh-audiogen 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-audiogen",
3
3
  "description": "AI audio generation plugin for the dsh web GUI: multi-vendor TTS/music/sound-effect channels (OpenAI-compatible, ElevenLabs, MiniMax, Stability AI and custom), per-channel model/voice catalogs, Agent tool and a sidebar AI 音频 panel.",
4
- "version": "0.4.9",
4
+ "version": "0.4.10",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -278,8 +278,23 @@ export function StudioView(props: {
278
278
  // 历史记录分类 tab
279
279
  const [historyTab, setHistoryTab] = useState<HistoryTab>('all')
280
280
  // 模型对比
281
- const [compareMode, setCompareMode] = useState(false)
282
- const [compareModels, setCompareModels] = useState<string[]>([])
281
+ /** 对比模式与对比模型选择按模式独立保存:恢复对比任务或切换模式时不会串到其他模块。 */
282
+ const [compareModeByMode, setCompareModeByMode] = useState<Record<AudioMode, boolean>>({ tts: false, music: false, sfx: false, voice_design: false })
283
+ const compareMode = compareModeByMode[mode] ?? false
284
+ const setCompareMode = (next: boolean): void => {
285
+ const target = mode
286
+ setCompareModeByMode(current => (current[target] === next ? current : { ...current, [target]: next }))
287
+ }
288
+ const [compareModelsByMode, setCompareModelsByMode] = useState<Record<AudioMode, string[]>>({ tts: [], music: [], sfx: [], voice_design: [] })
289
+ const compareModels = compareModelsByMode[mode] ?? []
290
+ const setCompareModels = (next: string[] | ((current: string[]) => string[])): void => {
291
+ const target = mode
292
+ setCompareModelsByMode(current => {
293
+ const previous = current[target] ?? []
294
+ const updated = typeof next === 'function' ? next(previous) : next
295
+ return updated === previous ? current : { ...current, [target]: updated }
296
+ })
297
+ }
283
298
  // 每模型参数覆盖(留空 = 自动沿用全局)
284
299
  const [overrides, setOverrides] = useState<Record<string, Record<string, string>>>({})
285
300
  const { entries, reload, clear } = useHistory()
@@ -564,11 +579,12 @@ export function StudioView(props: {
564
579
  }
565
580
  const modelValue = str('model') ?? singleModel
566
581
  if (modelValue !== '') setModel(modelValue)
582
+ // 直接写入被恢复模式自己的槽位(此闭包里 mode 仍是旧值)。
567
583
  if (compareModelsRestore !== undefined && compareModelsRestore.length > 0) {
568
- setCompareMode(true)
569
- setCompareModels(compareModelsRestore)
584
+ setCompareModeByMode(current => ({ ...current, [modeValue]: true }))
585
+ setCompareModelsByMode(current => ({ ...current, [modeValue]: compareModelsRestore }))
570
586
  } else {
571
- setCompareMode(false)
587
+ setCompareModeByMode(current => ({ ...current, [modeValue]: false }))
572
588
  }
573
589
  const voiceValue = str('voice')
574
590
  if (voiceValue !== undefined) setVoice(voiceValue)
package/src/protocol.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  export const AUDIOGEN_SETTINGS_NAMESPACE = 'dsh-audiogen'
9
9
 
10
10
  /** Published package version shared by the host updater and the client UI. */
11
- export const PLUGIN_VERSION = '0.4.9'
11
+ export const PLUGIN_VERSION = '0.4.10'
12
12
 
13
13
  /** Same-origin route family (loopback-only, mirroring dsh-imagegen). */
14
14
  export const SETTINGS_API = {
@@ -163,7 +163,7 @@ export interface GenerateAudioRequest {
163
163
  loop?: boolean
164
164
  /** ElevenLabs 音效:提示词影响度 0-1(prompt_influence,默认 0.3)。 */
165
165
  promptInfluence?: number
166
- /** Stable Audio 随机种子(seed,0-4294967294,默认 0=随机)。 */
166
+ /** Stable Audio 随机种子(seed,0.4.104967294,默认 0=随机)。 */
167
167
  seed?: number
168
168
  /** Stable Audio 采样步数(steps,按模型收敛:stable-audio-2: 30-100;2.5/3: 4-8)。 */
169
169
  steps?: number