dsh-audiogen 0.4.7 → 0.4.8
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/lib/client.js +363 -344
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -0
- package/package.json +1 -1
- package/src/client/studio-view.tsx +24 -2
- package/src/protocol.ts +1 -1
- package/src/routes.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -1688,6 +1688,7 @@ function parseGenerateRequest(body) {
|
|
|
1688
1688
|
...num(body.cfgScale) !== void 0 ? { cfgScale: num(body.cfgScale) } : {},
|
|
1689
1689
|
...typeof body.format === "string" && body.format.trim() !== "" ? { format: body.format.trim() } : {},
|
|
1690
1690
|
...typeof body.channelId === "string" && body.channelId !== "" ? { channelId: body.channelId } : {},
|
|
1691
|
+
...typeof body.taskId === "string" && body.taskId.trim() !== "" ? { taskId: body.taskId.trim() } : {},
|
|
1691
1692
|
...str(body.emotion) !== void 0 ? { emotion: str(body.emotion) } : {},
|
|
1692
1693
|
...num(body.vol) !== void 0 ? { vol: num(body.vol) } : {},
|
|
1693
1694
|
...num(body.pitch) !== void 0 ? { pitch: num(body.pitch) } : {},
|
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.
|
|
4
|
+
"version": "0.4.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -533,8 +533,9 @@ export function StudioView(props: {
|
|
|
533
533
|
setTasks(current => current.filter(task => task.id !== taskId))
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
-
/** 从历史参数回填表单(参考 AI 生图「恢复」):配置 + prompt 一键复用。
|
|
537
|
-
|
|
536
|
+
/** 从历史参数回填表单(参考 AI 生图「恢复」):配置 + prompt 一键复用。
|
|
537
|
+
* compareModelsRestore:对比任务恢复为对比模式;overridesRestore 由各模型 params 差异重建。 */
|
|
538
|
+
const restoreFromParams = (params: Record<string, unknown>, modeValue: AudioMode, singleModel: string, compareModelsRestore?: string[], overridesRestore?: Record<string, Record<string, string>>): void => {
|
|
538
539
|
const str = (key: string): string | undefined => {
|
|
539
540
|
const v = params[key]
|
|
540
541
|
return typeof v === 'string' && v.trim() !== '' ? v.trim() : undefined
|
|
@@ -606,9 +607,29 @@ export function StudioView(props: {
|
|
|
606
607
|
if (previewValue !== undefined) setPreviewText(previewValue)
|
|
607
608
|
const channelIdValue = str('channelId')
|
|
608
609
|
if (channelIdValue !== undefined && modeValue === 'voice_design') setDesignChannelId(channelIdValue)
|
|
610
|
+
// 恢复对比任务时重建每模型参数覆盖(各模型 params 与第一项的差异);单条恢复清空覆盖。
|
|
611
|
+
setOverrides(overridesRestore ?? {})
|
|
609
612
|
props.showToast('已恢复该次生成的配置,可直接再次生成')
|
|
610
613
|
}
|
|
611
614
|
|
|
615
|
+
/** 由对比历史条目重建每模型参数覆盖:以第一项为全局基准,其余条目与基准不同的字段即覆盖。 */
|
|
616
|
+
const overridesOfCompare = (models: Array<{ model: string; entry: HistoryEntry }>): Record<string, Record<string, string>> => {
|
|
617
|
+
const base = (models[0]?.entry.params ?? {}) as Record<string, unknown>
|
|
618
|
+
const out: Record<string, Record<string, string>> = {}
|
|
619
|
+
for (const item of models.slice(1)) {
|
|
620
|
+
const params = (item.entry.params ?? {}) as Record<string, unknown>
|
|
621
|
+
const diff: Record<string, string> = {}
|
|
622
|
+
for (const [key, value] of Object.entries(params)) {
|
|
623
|
+
if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') continue
|
|
624
|
+
if (key === 'taskId' || key === 'upstream') continue
|
|
625
|
+
if (typeof base[key] === typeof value && String(base[key]) === String(value)) continue
|
|
626
|
+
diff[key] = String(value)
|
|
627
|
+
}
|
|
628
|
+
if (Object.keys(diff).length > 0) out[item.model] = diff
|
|
629
|
+
}
|
|
630
|
+
return out
|
|
631
|
+
}
|
|
632
|
+
|
|
612
633
|
/** 调用宿主增强(Agent 默认模型),结果先预览再应用。 */
|
|
613
634
|
const runEnhance = async (): Promise<void> => {
|
|
614
635
|
if (prompt.trim() === '') {
|
|
@@ -1235,6 +1256,7 @@ export function StudioView(props: {
|
|
|
1235
1256
|
item.mode,
|
|
1236
1257
|
item.models[0]?.model ?? '',
|
|
1237
1258
|
item.models.map(model => model.model),
|
|
1259
|
+
overridesOfCompare(item.models),
|
|
1238
1260
|
)}>↺</button>
|
|
1239
1261
|
<button type="button" className={css.historyIcon} title="删除整个对比任务" onClick={() => void deleteHistoryEntries(item.models.map(model => model.entry.id))}>✕</button>
|
|
1240
1262
|
</div>
|
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.
|
|
11
|
+
export const PLUGIN_VERSION = '0.4.8'
|
|
12
12
|
|
|
13
13
|
/** Same-origin route family (loopback-only, mirroring dsh-imagegen). */
|
|
14
14
|
export const SETTINGS_API = {
|
package/src/routes.ts
CHANGED
|
@@ -144,6 +144,8 @@ function parseGenerateRequest(body: Record<string, unknown>): GenerateAudioReque
|
|
|
144
144
|
...(num(body.cfgScale) !== undefined ? { cfgScale: num(body.cfgScale)! } : {}),
|
|
145
145
|
...(typeof body.format === 'string' && body.format.trim() !== '' ? { format: body.format.trim() } : {}),
|
|
146
146
|
...(typeof body.channelId === 'string' && body.channelId !== '' ? { channelId: body.channelId } : {}),
|
|
147
|
+
// 对比任务的任务 id:随 params 一起入历史,供客户端按 taskId 聚合出对比卡片。
|
|
148
|
+
...(typeof body.taskId === 'string' && body.taskId.trim() !== '' ? { taskId: body.taskId.trim() } : {}),
|
|
147
149
|
// ---- MiniMax TTS 专属字段(其他厂商忽略) ----
|
|
148
150
|
...(str(body.emotion) !== undefined ? { emotion: str(body.emotion)! } : {}),
|
|
149
151
|
...(num(body.vol) !== undefined ? { vol: num(body.vol)! } : {}),
|