dsh-audiogen 0.4.2 → 0.4.3
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 +331 -326
- package/lib/client.js.map +1 -1
- package/lib/index.js +6 -2
- package/package.json +1 -1
- package/src/client/SettingsCard.tsx +6 -1
- package/src/index.ts +8 -5
- package/src/protocol.ts +1 -1
package/lib/index.js
CHANGED
|
@@ -3035,7 +3035,7 @@ const Config = z.object({
|
|
|
3035
3035
|
defaultChannelId: z.string().default(""),
|
|
3036
3036
|
defaultModel: z.string().default(""),
|
|
3037
3037
|
autoSaveToLibrary: z.boolean().default(false),
|
|
3038
|
-
maxConcurrentGenerations: z.number().default(DEFAULT_MAX_CONCURRENT)
|
|
3038
|
+
maxConcurrentGenerations: z.union([z.number(), z.string()]).default(DEFAULT_MAX_CONCURRENT)
|
|
3039
3039
|
});
|
|
3040
3040
|
const DEFAULT_ENABLED = true;
|
|
3041
3041
|
const DEFAULT_ANNOUNCE = true;
|
|
@@ -3129,7 +3129,11 @@ function apply(ctx, config) {
|
|
|
3129
3129
|
defaultChannelId,
|
|
3130
3130
|
defaultModel: typeof value.defaultModel === "string" ? value.defaultModel.trim() : "",
|
|
3131
3131
|
autoSaveToLibrary: value.autoSaveToLibrary === true,
|
|
3132
|
-
maxConcurrentGenerations:
|
|
3132
|
+
maxConcurrentGenerations: (() => {
|
|
3133
|
+
const rawMax = value.maxConcurrentGenerations;
|
|
3134
|
+
const parsedMax = typeof rawMax === "number" ? rawMax : typeof rawMax === "string" && rawMax.trim() !== "" ? Number(rawMax.trim()) : NaN;
|
|
3135
|
+
return Number.isFinite(parsedMax) ? Math.max(1, Math.min(20, Math.floor(parsedMax))) : DEFAULT_MAX_CONCURRENT;
|
|
3136
|
+
})()
|
|
3133
3137
|
};
|
|
3134
3138
|
};
|
|
3135
3139
|
const budget = createGenerationBudget(() => resolve().maxConcurrentGenerations);
|
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.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -737,7 +737,12 @@ export function AudioGenSettingsCard(props: AudioGenSettingsCardProps) {
|
|
|
737
737
|
className={css.input}
|
|
738
738
|
value={state.maxConcurrentGenerations.text}
|
|
739
739
|
disabled={!state.writable}
|
|
740
|
-
onChange={event =>
|
|
740
|
+
onChange={event => {
|
|
741
|
+
const raw = event.target.value
|
|
742
|
+
const parsed = Number(raw)
|
|
743
|
+
const value = raw === '' || !Number.isFinite(parsed) ? '' : String(Math.max(1, Math.min(20, Math.floor(parsed))))
|
|
744
|
+
props.edit('maxConcurrentGenerations', value)
|
|
745
|
+
}}
|
|
741
746
|
/>
|
|
742
747
|
</label>
|
|
743
748
|
</div>
|
package/src/index.ts
CHANGED
|
@@ -41,7 +41,8 @@ export interface Config {
|
|
|
41
41
|
defaultChannelId?: string
|
|
42
42
|
defaultModel?: string
|
|
43
43
|
autoSaveToLibrary?: boolean
|
|
44
|
-
|
|
44
|
+
/** 设置卡按文本编辑,保存值可能是数字或数字字符串。 */
|
|
45
|
+
maxConcurrentGenerations?: number | string
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const DEFAULT_MAX_CONCURRENT = 5
|
|
@@ -64,7 +65,7 @@ export const Config: z<Config> = z.object({
|
|
|
64
65
|
defaultChannelId: z.string().default(''),
|
|
65
66
|
defaultModel: z.string().default(''),
|
|
66
67
|
autoSaveToLibrary: z.boolean().default(false),
|
|
67
|
-
maxConcurrentGenerations: z.number().default(DEFAULT_MAX_CONCURRENT),
|
|
68
|
+
maxConcurrentGenerations: z.union([z.number(), z.string()]).default(DEFAULT_MAX_CONCURRENT),
|
|
68
69
|
})
|
|
69
70
|
|
|
70
71
|
const DEFAULT_ENABLED = true
|
|
@@ -184,9 +185,11 @@ export function apply(ctx: Context, config?: Config): void {
|
|
|
184
185
|
defaultChannelId,
|
|
185
186
|
defaultModel: typeof value.defaultModel === 'string' ? value.defaultModel.trim() : '',
|
|
186
187
|
autoSaveToLibrary: value.autoSaveToLibrary === true,
|
|
187
|
-
maxConcurrentGenerations:
|
|
188
|
-
|
|
189
|
-
:
|
|
188
|
+
maxConcurrentGenerations: (() => {
|
|
189
|
+
const rawMax = value.maxConcurrentGenerations
|
|
190
|
+
const parsedMax = typeof rawMax === 'number' ? rawMax : typeof rawMax === 'string' && rawMax.trim() !== '' ? Number(rawMax.trim()) : NaN
|
|
191
|
+
return Number.isFinite(parsedMax) ? Math.max(1, Math.min(20, Math.floor(parsedMax))) : DEFAULT_MAX_CONCURRENT
|
|
192
|
+
})(),
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
|
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.3'
|
|
12
12
|
|
|
13
13
|
/** Same-origin route family (loopback-only, mirroring dsh-imagegen). */
|
|
14
14
|
export const SETTINGS_API = {
|